diff --git a/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityActivator.java b/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityActivator.java index cd9e537e..2dc030eb 100644 --- a/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityActivator.java +++ b/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityActivator.java @@ -3,6 +3,9 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.player.Inventory; @@ -52,6 +55,17 @@ public ArrayList getOptions() return options; } + @org.jetbrains.annotations.Nullable + @Override + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } + + @Override + public CompoundTag getUpdateTag() { + return saveWithoutMetadata(); + } + @Override public void load(@NotNull CompoundTag compoundTag) { @@ -82,6 +96,7 @@ public void receivePacket(final int id, final byte[] data, @org.jetbrains.annota if (optionId >= 0 && optionId < options.size()) { options.get(optionId).changeOption(leftClick); + setChanged(); } } } diff --git a/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityCargo.java b/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityCargo.java index a9492b1c..37ae94d3 100644 --- a/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityCargo.java +++ b/src/main/java/vswe/stevescarts/blocks/tileentities/TileEntityCargo.java @@ -149,6 +149,7 @@ else if (this.target[id] < 0) { receiveClickData(packetid, id, dif); } + setChanged(); } } @@ -423,9 +424,9 @@ public TransferManager getCurrentTransferForSlots() BlockState state = this.getBlockState(); if (!(state.getBlock() instanceof BlockCargoManager)) { - return new InvWrapper(this); + return new ItemStackHandler(0); } - return new ItemStackHandler(0); + return new InvWrapper(this); } @Override diff --git a/src/main/java/vswe/stevescarts/modules/addons/ModuleCrafter.java b/src/main/java/vswe/stevescarts/modules/addons/ModuleCrafter.java index 224e240b..d6ce580f 100644 --- a/src/main/java/vswe/stevescarts/modules/addons/ModuleCrafter.java +++ b/src/main/java/vswe/stevescarts/modules/addons/ModuleCrafter.java @@ -91,7 +91,7 @@ public void update() } } } - if (valid) + if (valid && getValidSlot() != null) { getCart().addItemToChest(result, getValidSlot(), null); if (result.getCount() > 0) diff --git a/src/main/java/vswe/stevescarts/modules/addons/ModuleRecipe.java b/src/main/java/vswe/stevescarts/modules/addons/ModuleRecipe.java index 34bd4f4a..f098e5ee 100644 --- a/src/main/java/vswe/stevescarts/modules/addons/ModuleRecipe.java +++ b/src/main/java/vswe/stevescarts/modules/addons/ModuleRecipe.java @@ -381,24 +381,19 @@ protected void prepareLists() allTheSlots.clear(); outputSlots.clear(); final Class validSlot = getValidSlot(); - for (final ModuleBase module2 : getCart().getModules()) - { - if (module2.getSlots() != null) - { - for (final SlotStevesCarts slot2 : module2.getSlots()) - { - if (validSlot.isInstance(slot2)) - { - outputSlots.add(slot2); - allTheSlots.add(slot2); - } - else - { - if (!(slot2 instanceof SlotChest)) - { - continue; + if (validSlot != null) { + for (final ModuleBase module2 : getCart().getModules()) { + if (module2.getSlots() != null) { + for (final SlotStevesCarts slot2 : module2.getSlots()) { + if (validSlot.isInstance(slot2)) { + outputSlots.add(slot2); + allTheSlots.add(slot2); + } else { + if (!(slot2 instanceof SlotChest)) { + continue; + } + allTheSlots.add(slot2); } - allTheSlots.add(slot2); } } } diff --git a/src/main/java/vswe/stevescarts/modules/addons/ModuleSmelter.java b/src/main/java/vswe/stevescarts/modules/addons/ModuleSmelter.java index 9ab828a9..ae5f7551 100644 --- a/src/main/java/vswe/stevescarts/modules/addons/ModuleSmelter.java +++ b/src/main/java/vswe/stevescarts/modules/addons/ModuleSmelter.java @@ -58,7 +58,7 @@ public void update() { result = result.copy(); } - if (!result.isEmpty() && getCart().getModules() != null) + if (!result.isEmpty() && getCart().getModules() != null && getValidSlot() != null) { prepareLists(); if (canCraftMoreOfResult(result))