强力JS

从1.20.1重写而来,PowerfulJS现在确实很强大!

资源介绍

强大的JS 从1.20.1重写而来,PowerfulJS现在确实很强大! PowerfulJS 1.21现在对能力(Capabilities)有更好的处理,完整的 ProbeJS 支持,以及更好的性能! 对于旧的PowerfulJS文档,请查看 GitHub仓库 能力系统简介 Neoforge的能力系统统一了物品、方块、实体等的实现,以处理通用行为。因此,任何实现了 item handler 能力的方块都能向漏斗接收或提供物品,任何实现了 fluid handler 能力的物品都能被Mekanism流体罐填充。 PowerfulJS使得模组包制作者能够向这些对象添加能力。因此,通过附加能力,你可以让熔炉具有FE或流体存储功能,或者让一个电池外壳能够被填充以制作电池……可能性是无限的。 快速使用 本节介绍如何使用PowerfulJS实现一些简单功能。代码在安装了PowerfulJS后即可运行,但建议始终安装ProbeJS,以便在VSCode中获得IDE支持。 1. 添加能力 能力可以附加到三种类型的对象上: item , block 和 entity ,还有一种第四类型是 block entity ,但它包含在 block 能力中。 能力注册在启动时触发,添加能力的简单示例如下: PowerfulEvents.registerCapabilities(event => {     // Adds a capability that has constant FE supply     //     // So the redstone block now can produce 100FE/t constantly,     // however, you need an extractor (like MEK cable with     // extract mode) in order to get the energy, as the block     // itself won't distribute energy to surroundings     event.registerBlock('powerfuljs:constant_energy', {         maxExtract: 100,         maxReceive: 0,     }, "redstone_block")     // Adds a tank that has a fixed capacity with defined     // max I/O     event.registerBlockEntity('powerfuljs:fixed_storage_fluid', {         capacity: 2000,         maxExtract: 250,         maxReceive: 250,     }, 'minecraft:furnace')     // and so does the FE energy storage     event.registerBlockEntity('powerfuljs:fixed_storage_fe', {         maxExtract: 1000,         maxReceive: 1000,         capacity: 10000,     }, 'minecraft:furnace')     // Adds a fluid capability that has constant fluid supply     //     // Just connect a pipe and extract infinite lava!     // OVERPOWERED!!!!!     event.registerBlock('powerfuljs:constant_fluid', {         content: Fluid.of('lava', 1000),         maxReceive: 0     }, 'minecraft:lava')         // ...so you can limit it by making it only available         // at certain condition, like here we check if it's a         // source block and in a "nether" biome, which is the         // nether_waste.         //         // However, you shall not rely on this validator if the         // block can change its state while working, like furnace         // The capability will be reused for many machines for         // performance reason, and `validate` will not be called         // as the capability is already provided         .validate((blockContext, info) => {             return blockContext.state().fluidState.source &&                 blockContext.level().getBiome(blockContext.pos())                     .registeredName                     .includes("nether")         })     // Also make the `netherrack` and `soul sand` able to be filled     // with lava     //     // When filled, they are turned into `magma block`     //     // There are some differences in different capability builders,     // you can use ProbeJS to find out what kind of stuffs are     // supported by each builder     event.registerItem('powerfuljs:fixed_storage_fluid', {         capacity: 1000,         maxReceive: 20,         maxExtract: 20,     &n…

在鱼乐云资源中心浏览该资源,登录后可一键安装到你的游戏服务器。

返回资源中心