Mod

Piston API

Quick rating

Piston API

No reviews yet

Adds pushable tile entities, and lets players & mod devs handle piston interactions!

Redstone Improvements
API/Library
Mod Loaders
Forge
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Required
Server Required

About

Project Details

Type
Mod
License
All Rights Reserved
Latest Version
Piston-API-v1.0.1-mc1.12.2.jar
Authors
CurseForge
Modrinth

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID
Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

⚠️ Piston API is no longer maintained on CurseForge!

The latest versions of Piston API can be downloaded here from Modrinth.

Modrinth is a new and modern platform for hosting Minecraft mods, which respects both users and authors alike. Modrinth makes it easier than ever to find and download mods thanks to their improved search features, lightning-fast downloads, and purpose-built platform for Minecraft. It also ensures that creators are paid fairly for their work, by giving them 100% of the ad revenue their projects earn -- without making you sit through advertisements to download your favorite mods.

modrinth_vector.svg


Piston API is a small mod that lets mods and modpacks handle piston interactions!


 API Features:

  • Give custom blocks advanced piston interactions:

Piston API gives blocks a way to have position & world sensitive interactions with pistons! Mainly the block's pushability, and its stickiness.

IPushableBehavior:

  • This interface adds one method getPushReaction (which takes in the block source & piston info, and returns the EnumPushReaction). Blocks should implement this if they have advanced push reaction logic. This interface overrides vanilla's getPushReaction(IBlockState) method, blocks that don't implement the interface fallback on vanilla's method. For modpack devs: Each block's push reaction can be overriden by calling PushReactionHanlder.overridePushReaction through Groovyscript during postInit (mod devs should not do this!)
  • Grovvyscript examples:
import static git.jbredwards.piston_api.mod.asm.PushReactionHandler.overridePushReaction
import net.minecraft.block.material.EnumPushReaction

//makes dirt be destroyed by pistons when pushed (like grass or leaves)
overridePushReaction(block('minecraft:dirt'), EnumPushReaction.DESTROY)

//makes orange wool not pushable by pistons, while leaving the rest pushable
def orangeWool = blockstate('minecraft:wool', 1)
overridePushReaction(block('minecraft:wool'), {source, pistonInfo -> orangeWool == source.getBlockState() ? EnumPushReaction.BLOCK : EnumPushReaction.NORMAL})

IStickyBehavior:

  • This interface adds two methods: getStickReaction (which takes in the block source, the neighbor block to test, and piston info, and returns the EnumStickReaction), and hasStickySide (which takes in the block source & piston info, and returns whether the block has any potentially sticky sides). Blocks should implement this if they have advanced stickiness logic. This interface overrides forge's isStickyBlock(IBlockState) method, blocks that don't implement the interface fallback on forge's method. For modpack devs: Each block's stick result can be overriden by calling StickReactionHanlder.overrideStickReaction through Groovyscript during postInit (mod devs should not do this!)
import static git.jbredwards.piston_api.mod.asm.StickReactionHandler.overrideStickReaction
import git.jbredwards.piston_api.api.piston.EnumStickReaction

//makes slime blocks not sticky
overrideStickReaction(block('minecraft:slime'), EnumStickReaction.PASS)

//makes crafting tables sticky
overrideStickReaction(block('minecraft:crafting_table'), EnumStickReaction.STICK)

//makes bookshelves never stick to anything
overrideStickReaction(block('minecraft:bookshelf'), EnumStickReaction.NEVER)

//makes stained glass sticky, but only to the same color
overrideStickReaction(block('minecraft:stained_glass'), {source, other, pistonInfo -> source.getBlockState() == other.getBlockState() ? EnumStickReaction.STICK : EnumStickReaction.PASS})

//a more complicated example, makes the open part of logs sticky
import static git.jbredwards.piston_api.api.block.IStickyBehavior.getConnectingSide
import net.minecraft.block.BlockLog
overrideStickReaction([block('minecraft:log'), block('minecraft:log2')], {source, other, pistonInfo ->
    def connectingAxis = BlockLog.EnumAxis.fromFacingAxis(getConnectingSide(source, other).getAxis())
    def logAxis = source.getBlockState().getValue(BlockLog.LOG_AXIS)

    connectingAxis == logAxis ? EnumStickReaction.STICK : EnumStickReaction.PASS
})

Main Features:

  • Configurable piston push limit
  • Pistons move tile entities
  • Pistons don't destroy fluid states (while Fluidlogged API is installed)
  • Quark mod compatibility

Small Features:

  • Override existing piston interactions
  • Chests stick each other when pushed
  • Play block breaking sounds and particles when blocks are destroyed by pistons

---

This mod will not be ported

A small mod that lets mods and modpacks handle piston interactions!


API Features:

Give custom blocks advanced piston interactions

Piston API gives blocks a way to have position & world sensitive interactions with pistons! Mainly the block's pushability, and its stickiness.

IPushableBehavior:

  • This interface adds one method getPushReaction (which takes in the block source & piston info, and returns the EnumPushReaction). Blocks should implement this if they have advanced push reaction logic. This interface overrides vanilla's getPushReaction(IBlockState) method, blocks that don't implement the interface fallback on vanilla's method. For modpack devs: Each block's push reaction can be overriden by calling PushReactionHanlder.overridePushReaction through Groovyscript during postInit (mod devs should not do this!)
  • Grovvyscript examples:
import static git.jbredwards.piston_api.mod.asm.PushReactionHandler.overridePushReaction
import net.minecraft.block.material.EnumPushReaction

//makes dirt be destroyed by pistons when pushed (like grass or leaves)
overridePushReaction(block('minecraft:dirt'), EnumPushReaction.DESTROY)

//makes orange wool not pushable by pistons, while leaving the rest pushable
def orangeWool = blockstate('minecraft:wool', 1)
overridePushReaction(block('minecraft:wool'), {source, pistonInfo -> orangeWool == source.getBlockState() ? EnumPushReaction.BLOCK : EnumPushReaction.NORMAL})

IStickyBehavior:

  • This interface adds two methods: getStickReaction (which takes in the block source, the neighbor block to test, and piston info, and returns the EnumStickReaction), and hasStickySide (which takes in the block source & piston info, and returns whether the block has any potentially sticky sides). Blocks should implement this if they have advanced stickiness logic. This interface overrides forge's isStickyBlock(IBlockState) method, blocks that don't implement the interface fallback on forge's method. For modpack devs: Each block's stick result can be overriden by calling StickReactionHanlder.overrideStickReaction through Groovyscript during postInit (mod devs should not do this!)
  • Groovyscript examples:

import static git.jbredwards.piston_api.mod.asm.StickReactionHandler.overrideStickReaction
import git.jbredwards.piston_api.api.piston.EnumStickReaction

//makes slime blocks not sticky
overrideStickReaction(block('minecraft:slime'), EnumStickReaction.PASS)

//makes crafting tables sticky
overrideStickReaction(block('minecraft:crafting_table'), EnumStickReaction.STICK)

//makes bookshelves never stick to anything
overrideStickReaction(block('minecraft:bookshelf'), EnumStickReaction.NEVER)

//makes stained glass sticky, but only to the same color
overrideStickReaction(block('minecraft:stained_glass'), {source, other, pistonInfo -> source.getBlockState() == other.getBlockState() ? EnumStickReaction.STICK : EnumStickReaction.PASS})

//a more complicated example, makes the open part of logs sticky
import static git.jbredwards.piston_api.api.block.IStickyBehavior.getConnectingSide
import net.minecraft.block.BlockLog
overrideStickReaction([block('minecraft:log'), block('minecraft:log2')], {source, other, pistonInfo ->
    def connectingAxis = BlockLog.EnumAxis.fromFacingAxis(getConnectingSide(source, other).getAxis())
    def logAxis = source.getBlockState().getValue(BlockLog.LOG_AXIS)

    connectingAxis == logAxis ? EnumStickReaction.STICK : EnumStickReaction.PASS
})

Main Features:

  • Configurable piston push limit
  • Pistons move tile entities
  • Pistons don't destroy fluid states (while Fluidlogged API is installed)
  • Quark mod compatibility

Small Features:

  • Override existing piston interactions
  • Chests stick each other when pushed
  • Play block breaking sounds and particles when blocks are destroyed by pistons

This mod will not be ported

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~7,000
Total Downloads
CurseForge
~6,000
Modrinth
<1,000
Last Updated
CurseForge
Created
CurseForge
Modrinth
Last synced
When ModDex last fetched and imported data for this project from CurseForge or Modrinth. High-traffic and active projects are checked more often.
Next pipeline sync