#Can someone help me how to make an electric furnace
3 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
StartupEvents.registry('block', event => {
event.create('machine_furnace')
.displayName('Energy Powered Furnace')
.material('stone')
.soundType('netherite_block')
.hardness(3.5)
.requiresTool(true)
.blockEntity(entityInfo => {
entityInfo.inventory(2);
entityInfo.rightClickOpensInventory();
entityInfo.energyStorage(100000, 1000, 1000);
entityInfo.serverTick(20, 0, entity => {
let input = entity.inventory.get(0); // Get input slot
let output = entity.inventory.get(1); // Get output slot
let energyPerTick = 1000;
if (input && entity.energyStored() >= energyPerTick) {
entity.consumeEnergy(energyPerTick);
entity.progress = (entity.progress || 0) + 1;
if (entity.progress >= 100) {
entity.inventory.extract(0, 1);
entity.inventory.insert(1, 'minecraft:iron_ingot', 1);
entity.progress = 0;
}
}
if (entity.energyStored() < entity.maxEnergyStored()) {
let receivedEnergy = 500;
entity.receiveEnergy(receivedEnergy);
}
});
});
});