Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
Buuz135 2022-01-26 15:42:08 +01:00
commit 1b34ea54b3
4 changed files with 6 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package com.buuz135.functionalstorage.block;
import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.FunctionalStorage;
import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile;
import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile;
import com.buuz135.functionalstorage.block.tile.DrawerControllerTile; import com.buuz135.functionalstorage.block.tile.DrawerControllerTile;
import com.buuz135.functionalstorage.block.tile.DrawerTile; import com.buuz135.functionalstorage.block.tile.DrawerTile;
import com.buuz135.functionalstorage.item.LinkingToolItem; import com.buuz135.functionalstorage.item.LinkingToolItem;
@ -169,8 +170,8 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
NonNullList<ItemStack> stacks = NonNullList.create(); NonNullList<ItemStack> stacks = NonNullList.create();
ItemStack stack = new ItemStack(this); ItemStack stack = new ItemStack(this);
BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
if (drawerTile instanceof DrawerTile) { if (drawerTile instanceof ControllableDrawerTile) {
if (!((DrawerTile) drawerTile).isEverythingEmpty()) { if (!((ControllableDrawerTile<?>) drawerTile).isEverythingEmpty()) {
stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata());
} }
} }
@ -188,9 +189,9 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); super.setPlacedBy(level, pos, p_49849_, p_49850_, stack);
if (stack.hasTag()) { if (stack.hasTag()) {
BlockEntity entity = level.getBlockEntity(pos); BlockEntity entity = level.getBlockEntity(pos);
if (entity instanceof DrawerTile && stack.getTag().contains("Tile")) { if (entity instanceof ControllableDrawerTile && stack.getTag().contains("Tile")) {
entity.load(stack.getTag().getCompound("Tile")); entity.load(stack.getTag().getCompound("Tile"));
((DrawerTile) entity).markForUpdate(); ((ControllableDrawerTile<?>) entity).markForUpdate();
} }
} }
} }

View File

@ -129,7 +129,7 @@ public abstract class CompactingInventoryHandler implements IItemHandler, INBTSe
@Override @Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack) { public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
return isSetup() && slot < 3 && stack.isEmpty(); return isSetup() && slot < 3 && !stack.isEmpty();
} }
private boolean isValid(int slot, @Nonnull ItemStack stack){ private boolean isValid(int slot, @Nonnull ItemStack stack){

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB