CurseForge · Minecraft mod
Piston API
Adds pushable tile entities, and lets players and mod devs handle piston interactions!
Quick answer
Which Piston API release should I use?
Piston API 1.0.2 targets 1.12.2 with Forge. Installation on the client is optional. Installation on the dedicated server is optional. No extra mods listed for this file.
Where it goes
Is Piston API required on the client, server, or both?
Installation on the client is optional. Installation on the dedicated server is optional.
The source marks this as usable on both the client and server.
What else does Piston API 1.0.2 need?
1.0.2. Change the file and its required mods may change too.
This file does not list any required mods. Do not add a library just because a different file uses it.
This file does not list any required or optional mods.
Before you install it
Add Piston API without breaking your instance.
Built for Piston API 1.0.2. Pick another file and the loader, install side or required mods may change.
- 01
Stick to this file
Use 1.0.2. It targets 1.12.2 with Forge; another release may have different loader, side or dependency requirements.
- 02
Bring the mods it needs
This file does not list any required mods. Do not add a library just because a different file uses it.
- 03
Put it on the correct side
Installation on the client is optional. Installation on the dedicated server is optional.
- 04
Pick the file you checked
Use the “Get this file” button beside 1.0.2. It opens that exact file at the source.
About this project
What does Piston API add?
⚠️ 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.
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 theEnumPushReaction). Blocks should implement this if they have advanced push reaction logic. This interface overrides vanilla'sgetPushReaction(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 callingPushReactionHanlder.overridePushReactionthrough 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 theEnumStickReaction), andhasStickySide(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'sisStickyBlock(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 callingStickReactionHanlder.overrideStickReactionthrough 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
Project description from CurseForge.
Pick your setup
Piston API by Minecraft version and loader
Choose the version and loader you play, then open the matching release.
Check the dependencies, then try the file in a copied instance before changing a world you care about.
Recent files
Piston API versions and loaders
1.0.2
Piston-API-v1.0.2-mc1.12.2.jar
14 Apr 2024
Piston-API-v1.0.1-mc1.12.2.jar
20 May 2023
Piston-API-v1.0.0-mc1.12.2.jar
10 Apr 2023
Looking for an older file? The official CurseForge project page is in Resources.