Piston API
作者:jbredwards
Adds pushable tile entities, and lets players and mod devs handle piston interactions!
介绍
中文介绍正在准备中,下面暂时显示原文。
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
常见问题
Piston API 支持哪些 Minecraft 版本?
Piston API 支持 Minecraft Java 版 1.12.2,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。
Piston API 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端和服务端都要装。
jbredwards 的其他作品
查看全部 →
Baubley Elytra
by jbredwards
Fixes lots of bugs with Baubles, also lets players put their elytra in the baubles body slot!
128.5万
4 个月前
Modrinth · CurseForge
Fluidlogged API
by embeddedt, Cleanroom 等
A library mod that adds highly customizable fluidlogging to 1.12.2!
113.6万
3 个月前
Modrinth · CurseForge
JSON Paintings
by jbredwards
Easily add custom paintings through a json file!
82万
2 个月前
Modrinth · CurseForge
Loading Progress Bar
by jbredwards
Brings back the progress bar from old versions
43.7万
3 年前
CurseForge
评论
登录后评论和评分