diff --git a/src/main/java/com/progwml6/ironchest/IronChests.java b/src/main/java/com/progwml6/ironchest/IronChests.java index d1c8736..208e51e 100644 --- a/src/main/java/com/progwml6/ironchest/IronChests.java +++ b/src/main/java/com/progwml6/ironchest/IronChests.java @@ -12,10 +12,14 @@ import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.data.DataGenerator; import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -96,4 +100,14 @@ public class IronChests { } } + @SubscribeEvent + void missingBlocks(final RegistryEvent.MissingMappings event) { + + } + + @SubscribeEvent + void missingItems(final RegistryEvent.MissingMappings event) { + + } + } diff --git a/src/main/java/com/progwml6/ironchest/common/block/entity/ICrystalChest.java b/src/main/java/com/progwml6/ironchest/common/block/entity/ICrystalChest.java index ef22e96..c78df58 100644 --- a/src/main/java/com/progwml6/ironchest/common/block/entity/ICrystalChest.java +++ b/src/main/java/com/progwml6/ironchest/common/block/entity/ICrystalChest.java @@ -10,6 +10,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; +import javax.annotation.Nullable; + public interface ICrystalChest { default NonNullList buildItemStackDataList() { @@ -46,6 +48,7 @@ public interface ICrystalChest { NonNullList getTopItems(); + @Nullable Level getChestLevel(); BlockPos getChestWorldPosition(); @@ -57,15 +60,15 @@ public interface ICrystalChest { return; } - NonNullList tempCopy = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + NonNullList tempCopy = NonNullList.withSize(IronChestsTypes.CRYSTAL.size, ItemStack.EMPTY); boolean hasStuff = false; int compressedIdx = 0; mainLoop: - for (int i = 0; i < this.getContainerSize(); i++) { - ItemStack itemStack = this.getItems().get(i); + for (int i = 0; i < IronChestsTypes.CRYSTAL.size; i++) { + ItemStack itemStack = this.getCurrentItems().get(i); if (!itemStack.isEmpty()) { for (int j = 0; j < compressedIdx; j++) { @@ -143,11 +146,9 @@ public interface ICrystalChest { this.sendTopStacksPacket(); } - NonNullList getItems(); + NonNullList getCurrentItems(); void setHadStuff(boolean hadStuff); boolean getHadStuff(); - - int getContainerSize(); } diff --git a/src/main/java/com/progwml6/ironchest/common/block/regular/entity/CrystalChestBlockEntity.java b/src/main/java/com/progwml6/ironchest/common/block/regular/entity/CrystalChestBlockEntity.java index 17b6482..6ce9a97 100644 --- a/src/main/java/com/progwml6/ironchest/common/block/regular/entity/CrystalChestBlockEntity.java +++ b/src/main/java/com/progwml6/ironchest/common/block/regular/entity/CrystalChestBlockEntity.java @@ -83,4 +83,9 @@ public class CrystalChestBlockEntity extends AbstractIronChestBlockEntity implem public boolean getHadStuff() { return this.hadStuff; } + + @Override + public NonNullList getCurrentItems() { + return this.getItems(); + } } diff --git a/src/main/java/com/progwml6/ironchest/common/block/trapped/entity/TrappedCrystalChestBlockEntity.java b/src/main/java/com/progwml6/ironchest/common/block/trapped/entity/TrappedCrystalChestBlockEntity.java index c8dd47e..6417559 100644 --- a/src/main/java/com/progwml6/ironchest/common/block/trapped/entity/TrappedCrystalChestBlockEntity.java +++ b/src/main/java/com/progwml6/ironchest/common/block/trapped/entity/TrappedCrystalChestBlockEntity.java @@ -75,6 +75,11 @@ public class TrappedCrystalChestBlockEntity extends AbstractTrappedIronChestBloc this.topStacks = topStacks; } + @Override + public NonNullList getCurrentItems() { + return this.getItems(); + } + @Override public void setHadStuff(boolean hadStuff) { this.hadStuff = hadStuff; diff --git a/src/main/java/com/progwml6/ironchest/common/item/ChestUpgradeItem.java b/src/main/java/com/progwml6/ironchest/common/item/ChestUpgradeItem.java index aa65105..48e73f4 100644 --- a/src/main/java/com/progwml6/ironchest/common/item/ChestUpgradeItem.java +++ b/src/main/java/com/progwml6/ironchest/common/item/ChestUpgradeItem.java @@ -48,8 +48,8 @@ public class ChestUpgradeItem extends Item { } if (this.type.canUpgrade(IronChestsTypes.WOOD)) { - if (!(world.getBlockState(blockPos).getBlock() instanceof ChestBlock)) { - return InteractionResult.PASS; + if (world.getBlockState(blockPos).getBlock() instanceof ChestBlock) { + passed = true; } } else { for (Block block : IronChestsTypes.get(this.type.source)) { @@ -130,9 +130,9 @@ public class ChestUpgradeItem extends Item { boolean trapped = tileEntity instanceof TrappedChestBlockEntity; if(trapped) { - iBlockState = IronChestsTypes.get(this.type.source).get(1).defaultBlockState(); + iBlockState = IronChestsTypes.get(this.type.target).get(1).defaultBlockState(); } else { - iBlockState = IronChestsTypes.get(this.type.source).get(0).defaultBlockState(); + iBlockState = IronChestsTypes.get(this.type.target).get(0).defaultBlockState(); } iBlockState = iBlockState.setValue(AbstractIronChestBlock.FACING, chestFacing);