This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// priority: 0 | |
// This script, by default, creates a BlockEntity (that can do energy + items -> items) per call to processor() in block startup event. | |
// the blocks created also have their own recipe type and they are directional. | |
// if you want to make the output extractable with automation, you'll have to use PowerfulJS and make some modifications to this script. | |
// if you know how to read code, good! | |
const Mth = Java.loadClass("net.minecraft.util.Mth") | |
const Explosion = Java.loadClass("net.minecraft.world.level.Explosion") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StartupEvents.registry('block', event => { | |
event.create('output_item', 'entity').material('metal').hardness(1.0).displayName('Item Output Hatch') | |
.entity(builder => { | |
builder.itemHandler(9, false) | |
}) | |
event.create('input_item', 'entity').material('metal').hardness(1.0).displayName('Item Input Hatch') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StartupEvents.registry('menu', event => { | |
event.create('grass_block', 'block') | |
.addOutputSlot(98, 36, 0, 0, 1, 'minecraft:crafting') | |
.loop(builder => { | |
for (let y = 0; y < 3; y++) { | |
for(let x = 0; x < 3; x++) { | |
builder.addSlot(x * 18 + 8 /*<- the width of a slot, remember to add this*/, y * 18 + 18, x + y * 3, 0) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StartupEvents.registry('block', event => { | |
let CAP_PREDICATE = be => { | |
return be != null && (be.getCapability(ForgeCapabilities.ITEM_HANDLER).present || be.getCapability(ForgeCapabilities.FLUID_HANDLER).present || be.getCapability(ForgeCapabilities.ENERGY).present) | |
} | |
event.create('multi_block', 'multiblock').material('wood').hardness(1.0).displayName('Multiblock') | |
.entity(builder => { // adds a BlockEntity onto this block | |
builder.ticker((level, pos, state, be) => { // a tick method, called on block entity tick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// priority: 0 | |
const Mth = Java.loadClass("net.minecraft.util.Mth") | |
const Boolean = Java.loadClass('java.lang.Boolean') | |
StartupEvents.registry('block', event => { | |
event.create('example_block_2', 'entity').material('wood').hardness(1.0).displayName('Example Block') | |
.entity(builder => { | |
builder.ticker((level, pos, state, be) => { | |
if (!level.clientSide) { |