我人麻了
这写的像屎山代码…
大佬们能不能帮我改简单点a
package hskgzscz.procedures;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;
import net.minecraft.client.gui.components.EditBox;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.HashMap;
public class CesProcedure {
public static void execute(LevelAccessor world, double x, double y, double z, HashMap guistate) {
if (guistate == null)
return;
double fireHeight = 0;
double previousRecipe = 0;
previousRecipe = new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "recipe");
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(
capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(
capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval
.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE
.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval
.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE
.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(
ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,
null)
.ifPresent(capability -> _retval
.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE
.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos,
int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(
ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,
null)
.ifPresent(capability -> _retval
.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0))
.getItem() == Blocks.DIAMOND_ORE.asItem()) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos,
int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(
ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(
CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(
capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0))
.getItem() == Blocks.DIAMOND_ORE.asItem()) {
if (guistate.get("text:textFieldName") instanceof EditBox _tf)
_tf.setValue("Text");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem()) {
if (guistate.get("text:textFieldName") instanceof EditBox _tf)
_tf.setValue("Text");
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Blocks.DIAMOND_ORE.asItem() && ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 2)).getItem() == Items.DIAMOND && new Object() {
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
AtomicInteger _retval = new AtomicInteger(0);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
return _retval.get();
}
}.getAmount(world, new BlockPos(x, y, z), 2) <= 62 || new Object() {
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
AtomicInteger _retval = new AtomicInteger(0);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
return _retval.get();
}
}.getAmount(world, new BlockPos(x, y, z), 2) == 0)) {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("recipe", 0);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
} else if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 0)).getItem() == Items.DIAMOND_SWORD && new Object() {
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
AtomicInteger _retval = new AtomicInteger(0);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
return _retval.get();
}
}.getAmount(world, new BlockPos(x, y, z), 2) == 0) {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("recipe", 1);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
} else {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("recipe", (-1));
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
if (previousRecipe != new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "recipe")) {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("timer", 0);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "recipe") >= 0) {
if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "timer") >= 20) {
if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "recipe") == 0) {
{
BlockEntity _ent = world.getBlockEntity(new BlockPos(x, y, z));
if (_ent != null) {
final int _slotid = 0;
final int _amount = 1;
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable) {
ItemStack _stk = capability.getStackInSlot(_slotid).copy();
_stk.shrink(_amount);
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _stk);
}
});
}
}
{
BlockEntity _ent = world.getBlockEntity(new BlockPos(x, y, z));
if (_ent != null) {
final int _slotid = 2;
final ItemStack _setstack = new ItemStack(Items.DIAMOND);
_setstack.setCount((int) (new Object() {
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
AtomicInteger _retval = new AtomicInteger(0);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
return _retval.get();
}
}.getAmount(world, new BlockPos(x, y, z), 2) + 2));
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable)
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
});
}
}
} else if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "recipe") == 1) {
{
BlockEntity _ent = world.getBlockEntity(new BlockPos(x, y, z));
if (_ent != null) {
final int _slotid = 0;
final int _amount = 1;
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable) {
ItemStack _stk = capability.getStackInSlot(_slotid).copy();
_stk.shrink(_amount);
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _stk);
}
});
}
}
{
BlockEntity _ent = world.getBlockEntity(new BlockPos(x, y, z));
if (_ent != null) {
final int _slotid = 2;
final ItemStack _setstack = new ItemStack(Items.TRIDENT);
_setstack.setCount(1);
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable)
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
});
}
}
}
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("timer", 0);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "fuel") == 0) {
if (new Object() {
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
AtomicInteger _retval = new AtomicInteger(0);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
return _retval.get();
}
}.getAmount(world, new BlockPos(x, y, z), 1) > 0 && new Object() {
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
AtomicInteger _retval = new AtomicInteger(0);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
return _retval.get();
}
}.getAmount(world, new BlockPos(x, y, z), 0) != 0) {
if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 1)).getItem() == Blocks.COAL_BLOCK.asItem()) {
{
BlockEntity _ent = world.getBlockEntity(new BlockPos(x, y, z));
if (_ent != null) {
final int _slotid = 1;
final int _amount = 1;
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable) {
ItemStack _stk = capability.getStackInSlot(_slotid).copy();
_stk.shrink(_amount);
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _stk);
}
});
}
}
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("fuel", 200);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("maxFuel", 200);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
} else if ((new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
.ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, new BlockPos(x, y, z), 1)).getItem() == Items.BLAZE_POWDER) {
{
BlockEntity _ent = world.getBlockEntity(new BlockPos(x, y, z));
if (_ent != null) {
final int _slotid = 1;
final int _amount = 1;
_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable) {
ItemStack _stk = capability.getStackInSlot(_slotid).copy();
_stk.shrink(_amount);
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _stk);
}
});
}
}
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("fuel", 10);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("maxFuel", 10);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
} else {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("timer", 0);
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
}
}
if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "fuel") > 0) {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("fuel", ((new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "fuel")) - 1));
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
if (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "recipe") >= 0) {
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("timer", (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "timer") + 1));
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
}
if (!world.isClientSide()) {
BlockPos _bp = new BlockPos(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getTileData().putDouble("fuelRemaining", (((new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "fuel")) / (new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null)
return blockEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos(x, y, z), "maxFuel"))) * 100));
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
}
}
}
说真的
这么多if吗?都一样啊
求帮助