Skip to content

Commit dde30da

Browse files
committed
Fixed InventoryManagers getItemsChest
1 parent 4d4d9c9 commit dde30da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/peripheral/InventoryManagerPeripheral.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import net.minecraft.world.item.ArmorItem;
2020
import net.minecraft.world.item.ItemStack;
2121
import net.minecraft.world.level.block.entity.BlockEntity;
22+
import net.neoforged.neoforge.capabilities.BlockCapability;
2223
import net.neoforged.neoforge.capabilities.Capabilities;
2324
import net.neoforged.neoforge.items.IItemHandler;
2425
import net.neoforged.neoforge.items.wrapper.PlayerArmorInvWrapper;
@@ -120,8 +121,7 @@ public final List<Object> getItems() throws LuaException {
120121
public final MethodResult getItemsChest(String target) throws LuaException {
121122
Direction direction = validateSide(target);
122123

123-
BlockEntity targetEntity = owner.getLevel().getBlockEntity(owner.getPos().relative(direction));
124-
IItemHandler inventoryTo = null; //targetEntity != null ? targetEntity.getCapability(ForgeCapabilities.ITEM_HANDLER, direction).resolve().orElse(null) : null;
124+
IItemHandler inventoryTo = getLevel().getCapability(Capabilities.ItemHandler.BLOCK, owner.getPos().relative(direction), direction.getOpposite());
125125

126126
if (inventoryTo == null)
127127
return MethodResult.of(null, "INVENTORY_TO_INVALID");

0 commit comments

Comments
 (0)