Skip to content

Commit

Permalink
Bunch of little fixes
Browse files Browse the repository at this point in the history
 - Fixed the module toggler.
 - Fixed smelter crash.
 - Fixed broken inventory capability on Cargo Manager.
  • Loading branch information
brandon3055 committed Apr 11, 2024
1 parent ac37596 commit f3ee10c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,6 +55,17 @@ public ArrayList<ActivatorOption> getOptions()
return options;
}

@org.jetbrains.annotations.Nullable
@Override
public Packet<ClientGamePacketListener> getUpdatePacket() {
return ClientboundBlockEntityDataPacket.create(this);
}

@Override
public CompoundTag getUpdateTag() {
return saveWithoutMetadata();
}

@Override
public void load(@NotNull CompoundTag compoundTag)
{
Expand Down Expand Up @@ -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();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ else if (this.target[id] < 0)
{
receiveClickData(packetid, id, dif);
}
setChanged();
}
}

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void update()
}
}
}
if (valid)
if (valid && getValidSlot() != null)
{
getCart().addItemToChest(result, getValidSlot(), null);
if (result.getCount() > 0)
Expand Down
29 changes: 12 additions & 17 deletions src/main/java/vswe/stevescarts/modules/addons/ModuleRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit f3ee10c

Please sign in to comment.