
Piston API
Adds pushable tile entities, and lets players and mod devs handle piston interactions!
About this Mod
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.
- 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})
- 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!) - 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
Available Versions
How to Install Piston API on Your Server
Order Server
Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).
Set forge Loader
In the panel under "Egg", select the forge loader and matching Minecraft version (1.12.2).
Install Mod
Open the mod browser in the dashboard and search for "Piston API". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.
Compatibility
Mod Loaders
Minecraft Versions
1.12.2
Server-side
✓ RequiredRecommended RAM
4 GB(min. 3 GB)Frequently Asked Questions
Piston API server crashes on startup – what to do?
Most common cause: wrong forge version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.12.2). You can switch loaders with one click in the panel.
Is Piston API compatible with forge?
Piston API officially supports forge for Minecraft 1.12.2. The Mado dashboard automatically detects incompatible loader combinations.
Server lagging with Piston API – how to optimize performance?
Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Piston API consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.
Similar Mods
Rent Modded Server
Install Piston API with just one click on your server.