▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/Piston API
Piston API

Piston API

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

Оцените первым
925
4

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

})


</details>

---

**Main Features:**  
- Configurable piston push limit
- Pistons move tile entities
- Pistons don't destroy fluid states (while [Fluidlogged API](/mod/fluidlogged-api) is installed)
- [Quark](/mod/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?

Мод Piston API куда интереснее в компании: поднимите сервер Майнкрафт с уже установленным модом, позовите друзей и играйте по своим правилам. Хостинг Майнкрафт для мода Piston API будет готов за пару минут - BungeeHost сделает всё за вас.

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

1.12.x

Платформы

Поддерживаемые окружения

Клиент и сервер

Ссылки

Создатели

Детали

Лицензия:
Опубликован:3 года назад
Обновлён:2 года назад
Главная