Loading...
Beta Modpages Unclaimed

Piston API

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

0 Likes
4568 Downloads
Created by jbredwards

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.


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


AD Become Premium to remove Ads!

What means Verified?

  • Compatibility: The mod should be compatible with the latest version of Minecraft and be clearly labeled with its supported versions.
  • Functionality: The mod should work as advertised and not cause any game-breaking bugs or crashes.
  • Security: The mod should not contain any malicious code or attempts to steal personal information.
  • Performance: The mod should not cause a significant decrease in the game's performance, such as by causing lag or reducing frame rates.
  • Originality: The mod should be original and not a copy of someone else's work.
  • Up-to-date: The mod should be regularly updated to fix bugs, improve performance, and maintain compatibility with the latest version of Minecraft.
  • Support: The mod should have an active developer who provides support and troubleshooting assistance to users.
  • License: The mod should be released under a clear and open source license that allows others to use, modify, and redistribute the code.
  • Documentation: The mod should come with clear and detailed documentation on how to install and use it.

AD Become Premium to remove Ads!

How to Install

1

Download Forge & Java

Download Forge from the offical Site or here. If you dont have Java installed then install it now from here. After Downloading Forge you can run the file with Java.

2

Prepare

Lounch Minecraft and select your Forge istallation as Version this will create a Folder called Mods.

3

Add Mods

Type Win+R and type %appdata% and open the .minecraft Folder. There will you find your Folder called Mods. Place all Mods you want to play in this Folder

4

Enjoy

You are now Ready. Re-start your Game and start Playing.

More Mods like this

Mantle

Shared code for Forge mods

AutoRegLib

A library to ease menial tasks in mod development.

CraftTweaker

CraftTweaker allows modpacks and servers to customize the game. With CraftTweaker you can change recipes, script events, add new commands and even change item properties!

CoFH Core

Contains Core Functionality for all Team CoFH mods. Also does some really cool stuff on its own!

Patchouli

Accessible, Data-Driven, Dependency-Free Documentation for Minecraft Modders and Pack Makers

Baubles

An addon module and API for Thaumcraft