Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

Commit ae03c38

Browse files
committed
feat: implement ForgeCapabilities 2
1 parent a9e19a7 commit ae03c38

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

src/main/java/compasses/expandedstorage/api/EsChestType.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import java.util.Locale;
77

88
public enum EsChestType implements StringRepresentable {
9-
TOP(-1),
10-
BOTTOM(-1),
119
FRONT(0),
12-
BACK(2),
13-
LEFT(1),
10+
BACK(1),
11+
LEFT(2),
1412
RIGHT(3),
13+
TOP(4),
14+
BOTTOM(5),
1515
SINGLE(-1);
1616

1717
private final String name;

src/main/java/compasses/expandedstorage/impl/block/entity/OldChestBlockEntity.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import net.minecraft.resources.ResourceLocation;
1515
import net.minecraft.world.WorldlyContainer;
1616
import net.minecraft.world.item.ItemStack;
17+
import net.minecraft.world.level.block.DoubleBlockCombiner;
1718
import net.minecraft.world.level.block.entity.BlockEntity;
1819
import net.minecraft.world.level.block.entity.BlockEntityType;
1920
import net.minecraft.world.level.block.state.BlockState;
@@ -48,7 +49,19 @@ public WorldlyContainer getCachedDoubleInventory() {
4849
}
4950

5051
public void setCachedDoubleInventory(OldChestBlockEntity other) {
51-
this.cachedDoubleInventory = VariableSidedInventory.of(this.getInventory(), other.getInventory());
52+
BlockState state = this.getBlockState();
53+
if (!(state.getBlock() instanceof AbstractChestBlock)) {
54+
this.cachedDoubleInventory = VariableSidedInventory.of(this.getInventory(), other.getInventory());
55+
return;
56+
}
57+
58+
EsChestType type = state.getValue(AbstractChestBlock.CURSED_CHEST_TYPE);
59+
60+
if (AbstractChestBlock.getBlockType(type) == DoubleBlockCombiner.BlockType.FIRST) {
61+
this.cachedDoubleInventory = VariableSidedInventory.of(this.getInventory(), other.getInventory());
62+
} else {
63+
this.cachedDoubleInventory = VariableSidedInventory.of(other.getInventory(), this.getInventory());
64+
}
5265
}
5366

5467
@Override

0 commit comments

Comments
 (0)