From 21310672a8ecd63b62951990a508361e3827ac8c Mon Sep 17 00:00:00 2001 From: alexbegt Date: Sat, 15 Jun 2019 21:18:15 -0400 Subject: [PATCH] Update Iron Chests to 1.14.2! --- gradle.properties | 12 +- .../com/progwml6/ironchest/IronChest.java | 12 +- .../ironchest/client/ClientProxy.java | 8 +- .../ironchest/client/gui/GUIChest.java | 137 ----- .../client/inventory/ChestScreen.java | 72 +++ .../IronChestItemStackTileEntityRenderer.java | 73 +++ .../renderer/IronChestTileEntityRenderer.java | 216 +++++++ .../TileEntityIronChestItemRenderer.java | 73 --- .../renderer/TileEntityIronChestRenderer.java | 224 -------- .../common/ai/CatsSitOnChestsHandler.java | 48 ++ ...t.java => IronChestCatSitOnBlockGoal.java} | 26 +- .../common/ai/OcelotsSitOnChestsHandler.java | 47 -- .../ironchest/common/blocks/BlockChest.java | 293 ---------- .../common/blocks/BlockDirtChest.java | 45 -- .../common/blocks/BlockObsidianChest.java | 30 - .../common/blocks/BlockSilverChest.java | 30 - .../ironchest/common/blocks/ChestBlock.java | 282 ++++++++++ .../{IronChestType.java => ChestType.java} | 111 ++-- ...ckIronChest.java => CopperChestBlock.java} | 14 +- ...kGoldChest.java => CrystalChestBlock.java} | 15 +- .../common/blocks/DiamondChestBlock.java | 31 ++ ...kCrystalChest.java => DirtChestBlock.java} | 15 +- ...kDiamondChest.java => GoldChestBlock.java} | 16 +- ...ckCopperChest.java => IronChestBlock.java} | 15 +- .../common/blocks/ObsidianChestBlock.java | 31 ++ .../common/blocks/SilverChestBlock.java | 31 ++ .../common/core/IronChestBlocks.java | 72 +-- ...tiveTabs.java => IronChestItemGroups.java} | 6 +- .../ironchest/common/core/IronChestItems.java | 22 +- .../common/gui/ContainerIronChest.java | 133 ----- .../ironchest/common/gui/GuiHandler.java | 26 - .../common/inventory/ChestContainer.java | 212 +++++++ .../common/inventory/ChestContainerType.java | 82 +++ .../DirtChestSlot.java} | 16 +- ...hestChanger.java => ChestChangerItem.java} | 79 ++- .../common/items/ChestChangerType.java | 26 +- .../items/{ItemChest.java => ChestItem.java} | 6 +- .../{ItemTooltip.java => TooltipItem.java} | 10 +- .../common/network/PacketHandler.java | 6 - .../packets/PacketTopStackSyncChest.java | 6 +- .../tileentity/ChestTileEntityType.java | 74 +++ ...dChest.java => CopperChestTileEntity.java} | 16 +- ...Chest.java => CrystalChestTileEntity.java} | 44 +- ...Chest.java => DiamondChestTileEntity.java} | 16 +- .../tileentity/DirtChestTileEntity.java | 84 +++ ...perChest.java => GoldChestTileEntity.java} | 16 +- .../tileentity/IronChestEntityType.java | 110 ---- ...ronChest.java => IronChestTileEntity.java} | 526 ++++++++---------- .../tileentity/ObsidianChestTileEntity.java | 31 ++ ...dChest.java => SilverChestTileEntity.java} | 18 +- .../tileentity/TileEntityDirtChest.java | 82 --- .../tileentity/TileEntitySilverChest.java | 29 - .../ironchest/common/util/ContainerNames.java | 32 ++ .../textures/gui/copper_container.png | Bin 3677 -> 1513 bytes .../textures/gui/diamond_container.png | Bin 3826 -> 1743 bytes .../ironchest/textures/gui/gold_container.png | Bin 4242 -> 1746 bytes .../ironchest/textures/gui/iron_container.png | Bin 3724 -> 1566 bytes .../textures/gui/silver_container.png | Bin 3818 -> 1693 bytes .../loot_tables/blocks/copper_chest.json | 26 + .../loot_tables/blocks/crystal_chest.json | 26 + .../loot_tables/blocks/diamond_chest.json | 26 + .../loot_tables/blocks/dirt_chest.json | 30 + .../loot_tables/blocks/gold_chest.json | 26 + .../loot_tables/blocks/iron_chest.json | 26 + .../loot_tables/blocks/obsidian_chest.json | 26 + .../loot_tables/blocks/silver_chest.json | 26 + .../data/ironchest/recipes/_constants.json | 57 -- .../recipes/chests/copper_iron_chest.json | 63 ++- .../recipes/chests/copper_silver_chest.json | 2 +- .../recipes/chests/diamond_crystal_chest.json | 61 +- .../chests/diamond_obsidian_chest.json | 2 +- .../recipes/chests/gold_diamond_chest.json | 63 ++- .../recipes/chests/iron_gold_chest.json | 2 +- .../recipes/chests/iron_silver_chest.json | 63 ++- .../recipes/chests/silver_diamond_chest.json | 63 ++- .../recipes/chests/silver_gold_chest.json | 63 ++- .../recipes/chests/vanilla_copper_chest.json | 4 +- .../recipes/chests/vanilla_dirt_chest.json | 21 +- .../recipes/chests/vanilla_iron_chest.json | 4 +- .../upgrades/copper_iron_chest_upgrade.json | 63 ++- .../upgrades/copper_silver_chest_upgrade.json | 4 +- .../diamond_crystal_chest_upgrade.json | 63 ++- .../diamond_obsidian_chest_upgrade.json | 61 +- .../upgrades/gold_diamond_chest_upgrade.json | 63 ++- .../upgrades/iron_gold_chest_upgrade.json | 4 +- .../upgrades/silver_gold_chest_upgrade.json | 63 ++- .../upgrades/wood_copper_chest_upgrade.json | 4 +- .../upgrades/wood_iron_chest_upgrade.json | 4 +- 88 files changed, 2699 insertions(+), 1997 deletions(-) delete mode 100644 src/main/java/com/progwml6/ironchest/client/gui/GUIChest.java create mode 100644 src/main/java/com/progwml6/ironchest/client/inventory/ChestScreen.java create mode 100644 src/main/java/com/progwml6/ironchest/client/renderer/IronChestItemStackTileEntityRenderer.java create mode 100644 src/main/java/com/progwml6/ironchest/client/renderer/IronChestTileEntityRenderer.java delete mode 100644 src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestItemRenderer.java delete mode 100644 src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestRenderer.java create mode 100644 src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java rename src/main/java/com/progwml6/ironchest/common/ai/{IronChestAIOcelotSit.java => IronChestCatSitOnBlockGoal.java} (57%) delete mode 100644 src/main/java/com/progwml6/ironchest/common/ai/OcelotsSitOnChestsHandler.java delete mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/BlockChest.java delete mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/BlockDirtChest.java delete mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/BlockObsidianChest.java delete mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/BlockSilverChest.java create mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/ChestBlock.java rename src/main/java/com/progwml6/ironchest/common/blocks/{IronChestType.java => ChestType.java} (50%) rename src/main/java/com/progwml6/ironchest/common/blocks/{BlockIronChest.java => CopperChestBlock.java} (63%) rename src/main/java/com/progwml6/ironchest/common/blocks/{BlockGoldChest.java => CrystalChestBlock.java} (63%) create mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/DiamondChestBlock.java rename src/main/java/com/progwml6/ironchest/common/blocks/{BlockCrystalChest.java => DirtChestBlock.java} (61%) rename src/main/java/com/progwml6/ironchest/common/blocks/{BlockDiamondChest.java => GoldChestBlock.java} (62%) rename src/main/java/com/progwml6/ironchest/common/blocks/{BlockCopperChest.java => IronChestBlock.java} (62%) create mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/ObsidianChestBlock.java create mode 100644 src/main/java/com/progwml6/ironchest/common/blocks/SilverChestBlock.java rename src/main/java/com/progwml6/ironchest/common/core/{IronChestCreativeTabs.java => IronChestItemGroups.java} (91%) delete mode 100644 src/main/java/com/progwml6/ironchest/common/gui/ContainerIronChest.java delete mode 100644 src/main/java/com/progwml6/ironchest/common/gui/GuiHandler.java create mode 100644 src/main/java/com/progwml6/ironchest/common/inventory/ChestContainer.java create mode 100644 src/main/java/com/progwml6/ironchest/common/inventory/ChestContainerType.java rename src/main/java/com/progwml6/ironchest/common/{gui/slot/ValidatingChestSlot.java => inventory/DirtChestSlot.java} (63%) rename src/main/java/com/progwml6/ironchest/common/items/{ItemChestChanger.java => ChestChangerItem.java} (58%) rename src/main/java/com/progwml6/ironchest/common/items/{ItemChest.java => ChestItem.java} (83%) rename src/main/java/com/progwml6/ironchest/common/items/{ItemTooltip.java => TooltipItem.java} (90%) create mode 100644 src/main/java/com/progwml6/ironchest/common/tileentity/ChestTileEntityType.java rename src/main/java/com/progwml6/ironchest/common/tileentity/{TileEntityDiamondChest.java => CopperChestTileEntity.java} (52%) rename src/main/java/com/progwml6/ironchest/common/tileentity/{TileEntityCrystalChest.java => CrystalChestTileEntity.java} (83%) rename src/main/java/com/progwml6/ironchest/common/tileentity/{TileEntityObsidianChest.java => DiamondChestTileEntity.java} (52%) create mode 100644 src/main/java/com/progwml6/ironchest/common/tileentity/DirtChestTileEntity.java rename src/main/java/com/progwml6/ironchest/common/tileentity/{TileEntityCopperChest.java => GoldChestTileEntity.java} (53%) delete mode 100644 src/main/java/com/progwml6/ironchest/common/tileentity/IronChestEntityType.java rename src/main/java/com/progwml6/ironchest/common/tileentity/{TileEntityIronChest.java => IronChestTileEntity.java} (52%) create mode 100644 src/main/java/com/progwml6/ironchest/common/tileentity/ObsidianChestTileEntity.java rename src/main/java/com/progwml6/ironchest/common/tileentity/{TileEntityGoldChest.java => SilverChestTileEntity.java} (52%) delete mode 100644 src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDirtChest.java delete mode 100644 src/main/java/com/progwml6/ironchest/common/tileentity/TileEntitySilverChest.java create mode 100644 src/main/java/com/progwml6/ironchest/common/util/ContainerNames.java create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/copper_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/crystal_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/diamond_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/dirt_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/gold_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/iron_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/obsidian_chest.json create mode 100644 src/main/resources/data/ironchest/loot_tables/blocks/silver_chest.json delete mode 100644 src/main/resources/data/ironchest/recipes/_constants.json diff --git a/gradle.properties b/gradle.properties index 842bb16..e884456 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Mod Version Information -mod_version=8.0 +mod_version=9.0 # Minecraft Version Information -minecraft_version=1.13.2 -minecraft_version_toml=13 +minecraft_version=1.14.2 +minecraft_version_toml=14 # Forge Version Information -forge_version=25.0.34 -forge_version_toml=25 +forge_version=26.0.16 +forge_version_toml=26 # Mappings Information -mappings_version=20190215-1.13.1 +mappings_version=20190609-1.14.2 diff --git a/src/main/java/com/progwml6/ironchest/IronChest.java b/src/main/java/com/progwml6/ironchest/IronChest.java index 1d97c08..60056b3 100644 --- a/src/main/java/com/progwml6/ironchest/IronChest.java +++ b/src/main/java/com/progwml6/ironchest/IronChest.java @@ -12,13 +12,12 @@ package com.progwml6.ironchest; import com.progwml6.ironchest.client.ClientProxy; import com.progwml6.ironchest.common.ServerProxy; -import com.progwml6.ironchest.common.ai.OcelotsSitOnChestsHandler; +import com.progwml6.ironchest.common.ai.CatsSitOnChestsHandler; +import com.progwml6.ironchest.common.inventory.ChestContainerType; import com.progwml6.ironchest.common.network.PacketHandler; -import com.progwml6.ironchest.common.gui.GuiHandler; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.ExtensionPoint; -import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -36,14 +35,15 @@ public class IronChest { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preInit); - MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler()); - ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, () -> GuiHandler::openGui); + MinecraftForge.EVENT_BUS.register(new CatsSitOnChestsHandler()); } private void preInit(final FMLCommonSetupEvent event) { proxy.preInit(); + DistExecutor.runWhenOn(Dist.CLIENT, () -> ChestContainerType::registerScreenFactories); + PacketHandler.register(); } } diff --git a/src/main/java/com/progwml6/ironchest/client/ClientProxy.java b/src/main/java/com/progwml6/ironchest/client/ClientProxy.java index 10775f4..7114bf0 100644 --- a/src/main/java/com/progwml6/ironchest/client/ClientProxy.java +++ b/src/main/java/com/progwml6/ironchest/client/ClientProxy.java @@ -10,9 +10,9 @@ ******************************************************************************/ package com.progwml6.ironchest.client; -import com.progwml6.ironchest.client.renderer.TileEntityIronChestRenderer; +import com.progwml6.ironchest.client.renderer.IronChestTileEntityRenderer; import com.progwml6.ironchest.common.ServerProxy; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import net.minecraft.client.Minecraft; import net.minecraft.world.World; import net.minecraftforge.fml.client.registry.ClientRegistry; @@ -30,11 +30,11 @@ public class ClientProxy extends ServerProxy { super.preInit(); - for (IronChestType type : IronChestType.values()) + for (ChestType type : ChestType.values()) { if (type.clazz != null) { - ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer()); + ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new IronChestTileEntityRenderer()); } } } diff --git a/src/main/java/com/progwml6/ironchest/client/gui/GUIChest.java b/src/main/java/com/progwml6/ironchest/client/gui/GUIChest.java deleted file mode 100644 index 3d5392a..0000000 --- a/src/main/java/com/progwml6/ironchest/client/gui/GUIChest.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.client.gui; - -import com.progwml6.ironchest.common.blocks.IronChestType; -import com.progwml6.ironchest.common.gui.ContainerIronChest; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -@OnlyIn(Dist.CLIENT) -public class GUIChest extends GuiContainer -{ - public enum ResourceList - { - IRON(new ResourceLocation("ironchest", "textures/gui/iron_container.png")), - COPPER(new ResourceLocation("ironchest", "textures/gui/copper_container.png")), - SILVER(new ResourceLocation("ironchest", "textures/gui/silver_container.png")), - GOLD(new ResourceLocation("ironchest", "textures/gui/gold_container.png")), - DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamond_container.png")), - DIRT(new ResourceLocation("ironchest", "textures/gui/dirt_container.png")); - - public final ResourceLocation location; - - ResourceList(ResourceLocation loc) - { - this.location = loc; - } - } - - public enum GUI - { - IRON(184, 202, ResourceList.IRON, IronChestType.IRON, new ResourceLocation("ironchest:iron")), - GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD, new ResourceLocation("ironchest:gold")), - DIAMOND(238, 256, ResourceList.DIAMOND, IronChestType.DIAMOND, new ResourceLocation("ironchest:diamond")), - COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER, new ResourceLocation("ironchest:copper")), - SILVER(184, 238, ResourceList.SILVER, IronChestType.SILVER, new ResourceLocation("ironchest:silver")), - CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL, new ResourceLocation("ironchest:diamond")), - OBSIDIAN(238, 256, ResourceList.DIAMOND, IronChestType.OBSIDIAN, new ResourceLocation("ironchest:obsidian")), - DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000, new ResourceLocation("ironchest:dirt")); - - private int xSize; - - private int ySize; - - private ResourceList guiResourceList; - - private IronChestType mainType; - - private ResourceLocation guiId; - - GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType, ResourceLocation guiId) - { - this.xSize = xSize; - this.ySize = ySize; - this.guiResourceList = guiResourceList; - this.mainType = mainType; - this.guiId = guiId; - } - - protected Container makeContainer(IInventory playerInventory, IInventory chestInventory, EntityPlayer player) - { - return new ContainerIronChest(playerInventory, chestInventory, this.mainType, player, this.xSize, this.ySize); - } - - public ResourceLocation getGuiId() - { - return this.guiId; - } - } - - private GUI type; - - private final IInventory upperChestInventory; - - private final IInventory lowerChestInventory; - - public GUIChest(GUI type, IInventory playerInventory, IInventory chestInventory) - { - super(type.makeContainer(playerInventory, chestInventory, Minecraft.getInstance().player)); - this.type = type; - this.xSize = type.xSize; - this.ySize = type.ySize; - this.upperChestInventory = playerInventory; - this.lowerChestInventory = chestInventory; - this.allowUserInput = false; - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void render(int mouseX, int mouseY, float partialTicks) - { - this.drawDefaultBackground(); - super.render(mouseX, mouseY, partialTicks); - this.renderHoveredToolTip(mouseX, mouseY); - } - - /* - @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) - { - this.fontRenderer.drawString(this.lowerChestInventory.getDisplayName().getString(), 8.0F, 6.0F, 4210752); - this.fontRenderer.drawString(this.upperChestInventory.getDisplayName().getString(), 8.0F, this.ySize - 96 + 2, 4210752); - }*/ - - /** - * Draws the background layer of this container (behind the items). - */ - @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) - { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.mc.getTextureManager().bindTexture(this.type.guiResourceList.location); - - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/com/progwml6/ironchest/client/inventory/ChestScreen.java b/src/main/java/com/progwml6/ironchest/client/inventory/ChestScreen.java new file mode 100644 index 0000000..5b3f1cc --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/client/inventory/ChestScreen.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.client.inventory; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.progwml6.ironchest.common.blocks.ChestType; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.client.gui.IHasContainer; +import net.minecraft.client.gui.screen.inventory.ContainerScreen; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class ChestScreen extends ContainerScreen implements IHasContainer +{ + private ChestType chestType; + + private int textureXSize; + + private int textureYSize; + + public ChestScreen(ChestContainer container, PlayerInventory playerInventory, ITextComponent title) + { + super(container, playerInventory, title); + + this.chestType = container.getChestType(); + this.xSize = container.getChestType().xSize; + this.ySize = container.getChestType().ySize; + this.textureXSize = container.getChestType().textureXSize; + this.textureYSize = container.getChestType().textureYSize; + + this.passEvents = false; + } + + @Override + public void render(int mouseX, int mouseY, float partialTicks) + { + this.renderBackground(); + super.render(mouseX, mouseY, partialTicks); + this.renderHoveredToolTip(mouseX, mouseY); + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.font.drawString(this.title.getFormattedText(), 8.0F, 6.0F, 4210752); + this.font.drawString(this.playerInventory.getDisplayName().getFormattedText(), 8.0F, (float) (this.ySize - 96 + 2), 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + + this.minecraft.getTextureManager().bindTexture(this.chestType.guiTexture); + + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + + this.blit(x, y, 0, 0, this.xSize, this.ySize, textureXSize, textureYSize); + } +} diff --git a/src/main/java/com/progwml6/ironchest/client/renderer/IronChestItemStackTileEntityRenderer.java b/src/main/java/com/progwml6/ironchest/client/renderer/IronChestItemStackTileEntityRenderer.java new file mode 100644 index 0000000..2ad68a3 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/client/renderer/IronChestItemStackTileEntityRenderer.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.client.renderer; + +import com.progwml6.ironchest.common.blocks.ChestBlock; +import com.progwml6.ironchest.common.blocks.ChestType; +import com.progwml6.ironchest.common.tileentity.CopperChestTileEntity; +import com.progwml6.ironchest.common.tileentity.CrystalChestTileEntity; +import com.progwml6.ironchest.common.tileentity.DiamondChestTileEntity; +import com.progwml6.ironchest.common.tileentity.DirtChestTileEntity; +import com.progwml6.ironchest.common.tileentity.GoldChestTileEntity; +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; +import com.progwml6.ironchest.common.tileentity.ObsidianChestTileEntity; +import com.progwml6.ironchest.common.tileentity.SilverChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class IronChestItemStackTileEntityRenderer extends ItemStackTileEntityRenderer +{ + private static final IronChestTileEntity IRON_CHEST = new IronChestTileEntity(); + + private static final GoldChestTileEntity GOLD_CHEST = new GoldChestTileEntity(); + + private static final DiamondChestTileEntity DIAMOND_CHEST = new DiamondChestTileEntity(); + + private static final CopperChestTileEntity COPPER_CHEST = new CopperChestTileEntity(); + + private static final SilverChestTileEntity SILVER_CHEST = new SilverChestTileEntity(); + + private static final CrystalChestTileEntity CRYSTAL_CHEST = new CrystalChestTileEntity(); + + private static final ObsidianChestTileEntity OBSIDIAN_CHEST = new ObsidianChestTileEntity(); + + private static final DirtChestTileEntity DIRT_CHEST = new DirtChestTileEntity(); + + private static final IronChestTileEntity[] CHESTS = { IRON_CHEST, GOLD_CHEST, DIAMOND_CHEST, COPPER_CHEST, SILVER_CHEST, CRYSTAL_CHEST, OBSIDIAN_CHEST, DIRT_CHEST }; + + public static IronChestItemStackTileEntityRenderer instance = new IronChestItemStackTileEntityRenderer(); + + @Override + public void renderByItem(ItemStack itemStackIn) + { + Item item = itemStackIn.getItem(); + + if (Block.getBlockFromItem(item) instanceof ChestBlock) + { + ChestType typeOut = ChestBlock.getTypeFromItem(item); + if (typeOut == null) + { + TileEntityRendererDispatcher.instance.renderAsItem(IRON_CHEST); + } + else + { + TileEntityRendererDispatcher.instance.renderAsItem(CHESTS[typeOut.ordinal()]); + } + } + else + { + super.renderByItem(itemStackIn); + } + } +} diff --git a/src/main/java/com/progwml6/ironchest/client/renderer/IronChestTileEntityRenderer.java b/src/main/java/com/progwml6/ironchest/client/renderer/IronChestTileEntityRenderer.java new file mode 100644 index 0000000..02c3300 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/client/renderer/IronChestTileEntityRenderer.java @@ -0,0 +1,216 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.client.renderer; + +import com.google.common.primitives.SignedBytes; +import com.mojang.blaze3d.platform.GlStateManager; +import com.progwml6.ironchest.common.blocks.ChestBlock; +import com.progwml6.ironchest.common.blocks.ChestType; +import com.progwml6.ironchest.common.tileentity.CrystalChestTileEntity; +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.model.ChestModel; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.IChestLid; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.Random; + +@OnlyIn(Dist.CLIENT) +public class IronChestTileEntityRenderer extends TileEntityRenderer +{ + private final ChestModel chestModel = new ChestModel(); + + private static ItemEntity customItem; + + private Random random = new Random(); + + private ItemRenderer itemRenderer; + + private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F }, { 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F } }; + + @Override + public void render(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) + { + GlStateManager.enableDepthTest(); + GlStateManager.depthFunc(515); + GlStateManager.depthMask(true); + + IronChestTileEntity tileEntity = (IronChestTileEntity) tileEntityIn; + + BlockState blockstate = tileEntity.hasWorld() ? tileEntity.getBlockState() : (BlockState) tileEntity.getBlockToUse().getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + ChestType chestType = ChestType.IRON; + ChestType actualType = ChestBlock.getTypeFromBlock(blockstate.getBlock()); + + if (actualType != null) + { + chestType = actualType; + } + + if (destroyStage >= 0) + { + this.bindTexture(DESTROY_STAGES[destroyStage]); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scalef(4.0F, 4.0F, 1.0F); + GlStateManager.translatef(0.0625F, 0.0625F, 0.0625F); + GlStateManager.matrixMode(5888); + } + else + { + this.bindTexture(new ResourceLocation("ironchest", "textures/model/" + chestType.modelTexture)); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + GlStateManager.pushMatrix(); + + if (chestType == ChestType.CRYSTAL) + { + GlStateManager.disableCull(); + } + + GlStateManager.enableRescaleNormal(); + GlStateManager.translatef((float) x, (float) y + 1.0F, (float) z + 1.0F); + GlStateManager.scalef(1.0F, -1.0F, -1.0F); + + float f = blockstate.get(ChestBlock.FACING).getHorizontalAngle(); + if ((double) Math.abs(f) > 1.0E-5D) + { + GlStateManager.translatef(0.5F, 0.5F, 0.5F); + GlStateManager.rotatef(f, 0.0F, 1.0F, 0.0F); + GlStateManager.translatef(-0.5F, -0.5F, -0.5F); + } + + if (chestType.isTransparent()) + { + GlStateManager.scalef(1F, 0.99F, 1F); + } + + this.rotateChestLid(tileEntityIn, partialTicks, this.chestModel); + this.chestModel.renderAll(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + + if (chestType == ChestType.CRYSTAL) + { + GlStateManager.enableCull(); + } + + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + if (destroyStage >= 0) + { + GlStateManager.matrixMode(5890); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + } + + if (this.rendererDispatcher.renderInfo != null) + { + if (chestType.isTransparent() && tileEntity.getDistanceSq(this.rendererDispatcher.renderInfo.func_216785_c().x, this.rendererDispatcher.renderInfo.func_216785_c().y, this.rendererDispatcher.renderInfo.func_216785_c().z) < 128d) + { + this.random.setSeed(254L); + float shiftX; + float shiftY; + float shiftZ; + int shift = 0; + float blockScale = 0.70F; + float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTicks; + + if (((CrystalChestTileEntity) tileEntity).getTopItems().get(1).isEmpty()) + { + shift = 8; + blockScale = 0.85F; + } + + GlStateManager.pushMatrix(); + GlStateManager.translatef((float) x, (float) y, (float) z); + + if (customItem == null) + { + customItem = new ItemEntity(EntityType.ITEM, this.getWorld()); + } + + for (ItemStack item : ((CrystalChestTileEntity) tileEntity).getTopItems()) + { + if (shift > shifts.length || shift > 8) + { + break; + } + + if (item.isEmpty()) + { + shift++; + continue; + } + + shiftX = shifts[shift][0]; + shiftY = shifts[shift][1]; + shiftZ = shifts[shift][2]; + shift++; + + GlStateManager.pushMatrix(); + GlStateManager.translatef(shiftX, shiftY, shiftZ); + GlStateManager.rotatef(timeD, 0F, 1F, 0F); + GlStateManager.scalef(blockScale, blockScale, blockScale); + + customItem.setItem(item); + + if (this.itemRenderer == null) + { + this.itemRenderer = new ItemRenderer(Minecraft.getInstance().getRenderManager(), Minecraft.getInstance().getItemRenderer()) + { + @Override + public int getModelCount(ItemStack stack) + { + return SignedBytes.saturatedCast(Math.min(stack.getCount() / 32, 15) + 1); + } + + @Override + public boolean shouldBob() + { + return false; + } + + @Override + public boolean shouldSpreadItems() + { + return true; + } + }; + } + + this.itemRenderer.doRender(customItem, 0D, 0D, 0D, 0F, partialTicks); + + GlStateManager.popMatrix(); + } + + GlStateManager.popMatrix(); + } + } + } + + private void rotateChestLid(T tileEntity, float partialTicks, ChestModel chestModel) + { + float f = ((IChestLid) tileEntity).getLidAngle(partialTicks); + f = 1.0F - f; + f = 1.0F - f * f * f; + chestModel.getLid().rotateAngleX = -(f * ((float) Math.PI / 2F)); + } +} diff --git a/src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestItemRenderer.java b/src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestItemRenderer.java deleted file mode 100644 index e740fb7..0000000 --- a/src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestItemRenderer.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.client.renderer; - -import com.progwml6.ironchest.common.blocks.BlockChest; -import com.progwml6.ironchest.common.blocks.IronChestType; -import com.progwml6.ironchest.common.tileentity.TileEntityCopperChest; -import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest; -import com.progwml6.ironchest.common.tileentity.TileEntityDiamondChest; -import com.progwml6.ironchest.common.tileentity.TileEntityDirtChest; -import com.progwml6.ironchest.common.tileentity.TileEntityGoldChest; -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; -import com.progwml6.ironchest.common.tileentity.TileEntityObsidianChest; -import com.progwml6.ironchest.common.tileentity.TileEntitySilverChest; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class TileEntityIronChestItemRenderer extends TileEntityItemStackRenderer -{ - private static final TileEntityIronChest IRON_CHEST = new TileEntityIronChest(); - - private static final TileEntityGoldChest GOLD_CHEST = new TileEntityGoldChest(); - - private static final TileEntityDiamondChest DIAMOND_CHEST = new TileEntityDiamondChest(); - - private static final TileEntityCopperChest COPPER_CHEST = new TileEntityCopperChest(); - - private static final TileEntitySilverChest SILVER_CHEST = new TileEntitySilverChest(); - - private static final TileEntityCrystalChest CRYSTAL_CHEST = new TileEntityCrystalChest(); - - private static final TileEntityObsidianChest OBSIDIAN_CHEST = new TileEntityObsidianChest(); - - private static final TileEntityDirtChest DIRT_CHEST = new TileEntityDirtChest(); - - private static final TileEntityIronChest[] CHESTS = { IRON_CHEST, GOLD_CHEST, DIAMOND_CHEST, COPPER_CHEST, SILVER_CHEST, CRYSTAL_CHEST, OBSIDIAN_CHEST, DIRT_CHEST }; - - public static TileEntityIronChestItemRenderer instance = new TileEntityIronChestItemRenderer(); - - @Override - public void renderByItem(ItemStack itemStackIn) - { - Item item = itemStackIn.getItem(); - - if (Block.getBlockFromItem(item) instanceof BlockChest) - { - IronChestType typeOut = BlockChest.getTypeFromItem(item); - if (typeOut == null) - { - TileEntityRendererDispatcher.instance.renderAsItem(IRON_CHEST); - } - else - { - TileEntityRendererDispatcher.instance.renderAsItem(CHESTS[typeOut.ordinal()]); - } - } - else - { - super.renderByItem(itemStackIn); - } - } -} diff --git a/src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestRenderer.java b/src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestRenderer.java deleted file mode 100644 index 3161055..0000000 --- a/src/main/java/com/progwml6/ironchest/client/renderer/TileEntityIronChestRenderer.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.client.renderer; - -import com.google.common.primitives.SignedBytes; -import com.progwml6.ironchest.common.blocks.BlockChest; -import com.progwml6.ironchest.common.blocks.IronChestType; -import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest; -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderEntityItem; -import net.minecraft.client.renderer.entity.model.ModelChest; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.IChestLid; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import java.util.Random; - -public class TileEntityIronChestRenderer extends TileEntityRenderer -{ - private Random random; - - private RenderEntityItem itemRenderer; - - private ModelChest model; - - //@formatter:off - private static float[][] shifts = { - { 0.3F, 0.45F, 0.3F }, - { 0.7F, 0.45F, 0.3F }, - { 0.3F, 0.45F, 0.7F }, - { 0.7F, 0.45F, 0.7F }, - { 0.3F, 0.1F, 0.3F }, - { 0.7F, 0.1F, 0.3F }, - { 0.3F, 0.1F, 0.7F }, - { 0.7F, 0.1F, 0.7F }, - { 0.5F, 0.32F, 0.5F } }; - //@formatter:on - - private static EntityItem customitem = new EntityItem(null); - - public TileEntityIronChestRenderer() - { - this.model = new ModelChest(); - this.random = new Random(); - } - - @Override - public void render(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) - { - GlStateManager.enableDepthTest(); - GlStateManager.depthFunc(515); - GlStateManager.depthMask(true); - - TileEntityIronChest tileEntity = (TileEntityIronChest) tileEntityIn; - - IBlockState iBlockState = tileEntity.hasWorld() ? tileEntity.getBlockState() : (IBlockState) tileEntity.getBlockToUse().getDefaultState().with(BlockChest.FACING, EnumFacing.NORTH); - IronChestType chestType = IronChestType.IRON; - IronChestType typeNew = BlockChest.getTypeFromBlock(iBlockState.getBlock()); - - if (typeNew != null) - { - chestType = typeNew; - } - - if (destroyStage >= 0) - { - this.bindTexture(DESTROY_STAGES[destroyStage]); - GlStateManager.matrixMode(5890); - GlStateManager.pushMatrix(); - GlStateManager.scalef(4F, 4F, 1F); - GlStateManager.translatef(0.0625F, 0.0625F, 0.0625F); - GlStateManager.matrixMode(5888); - } - else - { - this.bindTexture(chestType.modelTexture); - } - - GlStateManager.pushMatrix(); - - if (chestType == IronChestType.CRYSTAL) - { - GlStateManager.disableCull(); - } - - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.translatef((float) x, (float) y + 1.0F, (float) z + 1.0F); - GlStateManager.scalef(1.0F, -1.0F, -1.0F); - - float f = iBlockState.get(BlockChest.FACING).getHorizontalAngle(); - - if (Math.abs(f) > 1.0E-5D) - { - GlStateManager.translatef(0.5F, 0.5F, 0.5F); - GlStateManager.rotatef(f, 0.0F, 1.0F, 0.0F); - GlStateManager.translatef(-0.5F, -0.5F, -0.5F); - } - - if (chestType.isTransparent()) - { - GlStateManager.scalef(1F, 0.99F, 1F); - } - - this.rotateChestLid(tileEntityIn, partialTicks, model); - model.renderAll(); - - if (chestType == IronChestType.CRYSTAL) - { - GlStateManager.enableCull(); - } - - GlStateManager.popMatrix(); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - - if (destroyStage >= 0) - { - GlStateManager.matrixMode(5890); - GlStateManager.popMatrix(); - GlStateManager.matrixMode(5888); - } - - if (chestType.isTransparent() && tileEntity.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d) - { - this.random.setSeed(254L); - - float shiftX; - float shiftY; - float shiftZ; - int shift = 0; - float blockScale = 0.70F; - float timeD = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTicks; - - if (((TileEntityCrystalChest) tileEntity).getTopItems().get(1).isEmpty()) - { - shift = 8; - blockScale = 0.85F; - } - - GlStateManager.pushMatrix(); - GlStateManager.translatef((float) x, (float) y, (float) z); - - customitem.setWorld(this.getWorld()); - customitem.hoverStart = 0F; - - for (ItemStack item : ((TileEntityCrystalChest) tileEntity).getTopItems()) - { - if (shift > shifts.length || shift > 8) - { - break; - } - - if (item.isEmpty()) - { - shift++; - continue; - } - - shiftX = shifts[shift][0]; - shiftY = shifts[shift][1]; - shiftZ = shifts[shift][2]; - shift++; - - GlStateManager.pushMatrix(); - GlStateManager.translatef(shiftX, shiftY, shiftZ); - GlStateManager.rotatef(timeD, 0F, 1F, 0F); - GlStateManager.scalef(blockScale, blockScale, blockScale); - - customitem.setItem(item); - - if (this.itemRenderer == null) - { - this.itemRenderer = new RenderEntityItem(Minecraft.getInstance().getRenderManager(), Minecraft.getInstance().getItemRenderer()) - { - @Override - public int getModelCount(ItemStack stack) - { - return SignedBytes.saturatedCast(Math.min(stack.getCount() / 32, 15) + 1); - } - - @Override - public boolean shouldBob() - { - return false; - } - - @Override - public boolean shouldSpreadItems() - { - return true; - } - }; - } - - this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTicks); - - GlStateManager.popMatrix(); - } - - GlStateManager.popMatrix(); - } - } - - private void rotateChestLid(T tileEntityIn, float lidAngleIn, ModelChest modelIn) - { - float f = ((IChestLid) tileEntityIn).getLidAngle(lidAngleIn); - f = 1.0F - f; - f = 1.0F - f * f * f; - modelIn.getLid().rotateAngleX = -(f * ((float) Math.PI / 2F)); - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java b/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java new file mode 100644 index 0000000..c340205 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.ai; + +import net.minecraft.entity.ai.goal.CatSitOnBlockGoal; +import net.minecraft.entity.ai.goal.PrioritizedGoal; +import net.minecraft.entity.passive.CatEntity; +import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +import java.util.HashSet; + +public class CatsSitOnChestsHandler +{ + @SubscribeEvent + public void changeSittingTaskForOcelots(final LivingEvent.LivingUpdateEvent evt) + { + /* + if (evt.getEntityLiving().ticksExisted < 5 && evt.getEntityLiving() instanceof CatEntity) + { + HashSet goals = new HashSet<>(); + + CatEntity catEntity = (CatEntity) evt.getEntityLiving(); + + for (PrioritizedGoal goal : catEntity.goalSelector.goals) + { + if (goal.func_220772_j().getClass() == CatSitOnBlockGoal.class) + { + goals.add(goal); + } + } + + for (PrioritizedGoal goal : goals) + { + catEntity.goalSelector.removeGoal(goal.func_220772_j()); + catEntity.goalSelector.addGoal(goal.getPriority(), new IronChestCatSitOnBlockGoal1(catEntity, 0.4F)); + } + }*/ + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/ai/IronChestAIOcelotSit.java b/src/main/java/com/progwml6/ironchest/common/ai/IronChestCatSitOnBlockGoal.java similarity index 57% rename from src/main/java/com/progwml6/ironchest/common/ai/IronChestAIOcelotSit.java rename to src/main/java/com/progwml6/ironchest/common/ai/IronChestCatSitOnBlockGoal.java index 17abc3e..7b5a99c 100644 --- a/src/main/java/com/progwml6/ironchest/common/ai/IronChestAIOcelotSit.java +++ b/src/main/java/com/progwml6/ironchest/common/ai/IronChestCatSitOnBlockGoal.java @@ -10,27 +10,27 @@ ******************************************************************************/ package com.progwml6.ironchest.common.ai; -import com.progwml6.ironchest.common.blocks.BlockChest; -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; +import com.progwml6.ironchest.common.blocks.ChestBlock; +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.ai.EntityAIOcelotSit; -import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.block.BlockState; +import net.minecraft.entity.ai.goal.CatSitOnBlockGoal; +import net.minecraft.entity.passive.CatEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IWorldReaderBase; +import net.minecraft.world.IWorldReader; -public class IronChestAIOcelotSit extends EntityAIOcelotSit +public class IronChestCatSitOnBlockGoal extends CatSitOnBlockGoal { - public IronChestAIOcelotSit(EntityOcelot ocelotIn, float speedIn) + public IronChestCatSitOnBlockGoal(CatEntity catEntity, float speedIn) { - super(ocelotIn, speedIn); + super(catEntity, speedIn); } /** * Return true to set given position as destination */ @Override - protected boolean shouldMoveTo(IWorldReaderBase worldIn, BlockPos pos) + protected boolean shouldMoveTo(IWorldReader worldIn, BlockPos pos) { if (!worldIn.isAirBlock(pos.up())) { @@ -38,12 +38,12 @@ public class IronChestAIOcelotSit extends EntityAIOcelotSit } else { - IBlockState iBlockState = worldIn.getBlockState(pos); + BlockState iBlockState = worldIn.getBlockState(pos); Block block = iBlockState.getBlock(); - if (block instanceof BlockChest) + if (block instanceof ChestBlock) { - return TileEntityIronChest.getPlayersUsing(worldIn, pos) < 1; + return IronChestTileEntity.getPlayersUsing(worldIn, pos) < 1; } return super.shouldMoveTo(worldIn, pos); diff --git a/src/main/java/com/progwml6/ironchest/common/ai/OcelotsSitOnChestsHandler.java b/src/main/java/com/progwml6/ironchest/common/ai/OcelotsSitOnChestsHandler.java deleted file mode 100644 index cd0e018..0000000 --- a/src/main/java/com/progwml6/ironchest/common/ai/OcelotsSitOnChestsHandler.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.ai; - -import net.minecraft.entity.ai.EntityAIOcelotSit; -import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry; -import net.minecraft.entity.passive.EntityOcelot; -import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; - -import java.util.HashSet; - -public class OcelotsSitOnChestsHandler -{ - @SubscribeEvent - public void changeSittingTaskForOcelots(final LivingUpdateEvent evt) - { - if (evt.getEntityLiving().ticksExisted < 5 && evt.getEntityLiving() instanceof EntityOcelot) - { - HashSet hashset = new HashSet(); - - EntityOcelot ocelot = (EntityOcelot) evt.getEntityLiving(); - - for (EntityAITaskEntry task : ocelot.tasks.taskEntries) - { - if (task.action.getClass() == EntityAIOcelotSit.class) - { - hashset.add(task); - } - } - - for (EntityAITaskEntry task : hashset) - { - ocelot.tasks.removeTask(task.action); - ocelot.tasks.addTask(task.priority, new IronChestAIOcelotSit(ocelot, 0.4F)); - } - } - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/BlockChest.java deleted file mode 100644 index 5b09f8f..0000000 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockChest.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.blocks; - -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; -import net.minecraft.block.Block; -import net.minecraft.block.BlockHorizontal; -import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Enchantments; -import net.minecraft.init.Items; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.pathfinding.PathType; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.stats.StatList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.INameable; -import net.minecraft.util.Mirror; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.ILockableContainer; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fml.network.NetworkHooks; - -import javax.annotation.Nullable; - -public abstract class BlockChest extends Block -{ - public static final DirectionProperty FACING = BlockHorizontal.HORIZONTAL_FACING; - - protected static final VoxelShape IRON_CHEST_SHAPE = Block.makeCuboidShape(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); - - private final IronChestType type; - - public BlockChest(Properties propertiesIn, IronChestType typeIn) - { - super(propertiesIn); - - this.type = typeIn; - - this.setDefaultState((IBlockState) ((IBlockState) this.stateContainer.getBaseState()).with(FACING, EnumFacing.NORTH)); - - this.setRegistryName(new ResourceLocation(type.itemName)); - } - - @Override - public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) - { - return IRON_CHEST_SHAPE; - } - - @Override - public boolean isSolid(IBlockState state) - { - return false; - } - - @Override - public boolean isFullCube(IBlockState state) - { - return false; - } - - @Override - @OnlyIn(Dist.CLIENT) - public boolean hasCustomBreakingProgress(IBlockState state) - { - return true; - } - - @Override - public EnumBlockRenderType getRenderType(IBlockState state) - { - return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; - } - - @Override - public IBlockState getStateForPlacement(BlockItemUseContext context) - { - EnumFacing enumfacing = context.getPlacementHorizontalFacing().getOpposite(); - - return this.getDefaultState().with(FACING, enumfacing); - } - - @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) - { - TileEntity tileentity = worldIn.getTileEntity(pos); - - if (tileentity != null && tileentity instanceof TileEntityIronChest) - { - TileEntityIronChest teic = (TileEntityIronChest) tileentity; - - teic.wasPlaced(placer, stack); - - if (stack.hasDisplayName()) - { - teic.setCustomName(stack.getDisplayName()); - } - } - } - - public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) - { - if (worldIn.isRemote) - { - return true; - } - else - { - ILockableContainer ilockablecontainer = this.getContainer(state, worldIn, pos); - - if (ilockablecontainer != null) - { - if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) - { - EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player; - - NetworkHooks.openGui(entityPlayerMP, ilockablecontainer, buf -> buf.writeBlockPos(pos)); - } - - player.addStat(StatList.OPEN_CHEST); - } - - return true; - } - } - - @SuppressWarnings("deprecation") - @Override - public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving) - { - if (state.getBlock() != newState.getBlock()) - { - TileEntityIronChest tileentity = (TileEntityIronChest) worldIn.getTileEntity(pos); - - if (tileentity != null) - { - tileentity.removeAdornments(); - - InventoryHelper.dropInventoryItems(worldIn, pos, tileentity); - worldIn.updateComparatorOutputLevel(pos, this); - } - - super.onReplaced(state, worldIn, pos, newState, isMoving); - } - } - - @SuppressWarnings("deprecation") - @Override - public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) - { - super.eventReceived(state, worldIn, pos, id, param); - TileEntity tileentity = worldIn.getTileEntity(pos); - return tileentity == null ? false : tileentity.receiveClientEvent(id, param); - } - - @Override - public boolean hasTileEntity(IBlockState state) - { - return true; - } - - @Nullable - public ILockableContainer getContainer(IBlockState state, World worldIn, BlockPos pos) - { - TileEntity tileentity = worldIn.getTileEntity(pos); - - if (!(tileentity instanceof TileEntityIronChest)) - { - return null; - } - else - { - return (ILockableContainer) tileentity; - } - } - - @SuppressWarnings("deprecation") - @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) - { - if (te instanceof INameable && ((INameable) te).hasCustomName()) - { - player.addStat(StatList.BLOCK_MINED.get(this)); - player.addExhaustion(0.005F); - - if (worldIn.isRemote) - { - return; - } - - int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack); - Item item = this.getItemDropped(state, worldIn, pos, i).asItem(); - - if (item == Items.AIR) - { - return; - } - - ItemStack itemstack = new ItemStack(item, this.quantityDropped(state, worldIn.rand)); - itemstack.setDisplayName(((INameable) te).getCustomName()); - spawnAsEntity(worldIn, pos, itemstack); - } - else - { - super.harvestBlock(worldIn, player, pos, state, (TileEntity) null, stack); - } - } - - @Override - public boolean hasComparatorInputOverride(IBlockState state) - { - return true; - } - - @Override - public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) - { - return Container.calcRedstoneFromInventory(this.getContainer(blockState, worldIn, pos)); - } - - @Override - public IBlockState rotate(IBlockState state, Rotation rot) - { - return (IBlockState) state.with(FACING, rot.rotate((EnumFacing) state.get(FACING))); - } - - @Override - public IBlockState mirror(IBlockState state, Mirror mirrorIn) - { - return state.rotate(mirrorIn.toRotation((EnumFacing) state.get(FACING))); - } - - @Override - protected void fillStateContainer(StateContainer.Builder builder) - { - builder.add(FACING); - } - - @Override - public BlockFaceShape getBlockFaceShape(IBlockReader worldIn, IBlockState state, BlockPos pos, EnumFacing face) - { - return BlockFaceShape.UNDEFINED; - } - - @Override - public boolean allowsMovement(IBlockState state, IBlockReader worldIn, BlockPos pos, PathType type) - { - return false; - } - - public static IronChestType getTypeFromItem(Item itemIn) - { - return getTypeFromBlock(Block.getBlockFromItem(itemIn)); - } - - public static IronChestType getTypeFromBlock(Block blockIn) - { - return blockIn instanceof BlockChest ? ((BlockChest) blockIn).getType() : null; - } - - public IronChestType getType() - { - return this.type; - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockDirtChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/BlockDirtChest.java deleted file mode 100644 index ef8625c..0000000 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockDirtChest.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.blocks; - -import com.progwml6.ironchest.common.tileentity.TileEntityDirtChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; - -public class BlockDirtChest extends BlockChest -{ - public BlockDirtChest(Properties properties) - { - super(properties, IronChestType.DIRTCHEST9000); - } - - @SuppressWarnings("deprecation") - @Override - public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) - { - ItemStack stack = getItem(world, pos, state); - - stack.setTagInfo("dirtchest", new NBTTagByte((byte) 1)); - - drops.add(stack); - } - - @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) - { - return new TileEntityDirtChest(); - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockObsidianChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/BlockObsidianChest.java deleted file mode 100644 index 7548370..0000000 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockObsidianChest.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.blocks; - -import com.progwml6.ironchest.common.tileentity.TileEntityObsidianChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockReader; - -public class BlockObsidianChest extends BlockChest -{ - public BlockObsidianChest(Properties properties) - { - super(properties, IronChestType.OBSIDIAN); - } - - @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) - { - return new TileEntityObsidianChest(); - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockSilverChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/BlockSilverChest.java deleted file mode 100644 index ebe9f7c..0000000 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockSilverChest.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.blocks; - -import com.progwml6.ironchest.common.tileentity.TileEntitySilverChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockReader; - -public class BlockSilverChest extends BlockChest -{ - public BlockSilverChest(Properties properties) - { - super(properties, IronChestType.SILVER); - } - - @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) - { - return new TileEntitySilverChest(); - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/ChestBlock.java b/src/main/java/com/progwml6/ironchest/common/blocks/ChestBlock.java new file mode 100644 index 0000000..7048607 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/blocks/ChestBlock.java @@ -0,0 +1,282 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.blocks; + +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.block.HorizontalBlock; +import net.minecraft.block.IWaterLoggable; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.passive.CatEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluids; +import net.minecraft.fluid.IFluidState; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.pathfinding.PathType; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.DirectionProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.stats.Stat; +import net.minecraft.stats.Stats; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.Mirror; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Rotation; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import javax.annotation.Nullable; +import java.util.List; + +public class ChestBlock extends Block implements IWaterLoggable +{ + public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; + + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + + protected static final VoxelShape IRON_CHEST_SHAPE = Block.makeCuboidShape(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); + + private final ChestType type; + + public ChestBlock(Properties properties, ChestType type) + { + super(properties); + + this.type = type; + + this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH).with(WATERLOGGED, Boolean.valueOf(false))); + this.setRegistryName(new ResourceLocation(type.itemName)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public boolean hasCustomBreakingProgress(BlockState state) + { + return true; + } + + @Override + public BlockRenderType getRenderType(BlockState state) + { + return BlockRenderType.ENTITYBLOCK_ANIMATED; + } + + @Override + public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) + { + if (stateIn.get(WATERLOGGED)) + { + worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn)); + } + + return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader iBlockReader, BlockPos pos, ISelectionContext selectionContext) + { + return IRON_CHEST_SHAPE; + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) + { + Direction direction = context.getPlacementHorizontalFacing().getOpposite(); + IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); + + return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + } + + @Override + public IFluidState getFluidState(BlockState state) + { + return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); + } + + @Override + public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof IronChestTileEntity) + { + ((IronChestTileEntity) tileentity).wasPlaced(placer, stack); + + if (stack.hasDisplayName()) + { + ((IronChestTileEntity) tileentity).setCustomName(stack.getDisplayName()); + } + } + } + + @Override + public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) + { + if (state.getBlock() != newState.getBlock()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof IronChestTileEntity) + { + ((IronChestTileEntity) tileentity).removeAdornments(); + InventoryHelper.dropInventoryItems(worldIn, pos, (IronChestTileEntity) tileentity); + worldIn.updateComparatorOutputLevel(pos, this); + } + + super.onReplaced(state, worldIn, pos, newState, isMoving); + } + } + + @Override + public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) + { + if (worldIn.isRemote) + { + return true; + } + else + { + INamedContainerProvider inamedcontainerprovider = this.getContainer(state, worldIn, pos); + if (inamedcontainerprovider != null) + { + player.openContainer(inamedcontainerprovider); + player.addStat(this.getOpenStat()); + } + + return true; + } + } + + protected Stat getOpenStat() + { + return Stats.CUSTOM.get(Stats.OPEN_CHEST); + } + + @Override + @Nullable + public INamedContainerProvider getContainer(BlockState state, World world, BlockPos pos) + { + TileEntity tileentity = world.getTileEntity(pos); + return tileentity instanceof INamedContainerProvider ? (INamedContainerProvider) tileentity : null; + } + + @Override + public boolean hasTileEntity(BlockState state) + { + return true; + } + + @Override + public boolean eventReceived(BlockState state, World worldIn, BlockPos pos, int id, int param) + { + super.eventReceived(state, worldIn, pos, id, param); + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity == null ? false : tileentity.receiveClientEvent(id, param); + } + + private static boolean isBlocked(IWorld iWorld, BlockPos blockPos) + { + return isBelowSolidBlock(iWorld, blockPos) || isCatSittingOn(iWorld, blockPos); + } + + private static boolean isBelowSolidBlock(IBlockReader iBlockReader, BlockPos worldIn) + { + BlockPos blockpos = worldIn.up(); + return iBlockReader.getBlockState(blockpos).isNormalCube(iBlockReader, blockpos); + } + + private static boolean isCatSittingOn(IWorld iWorld, BlockPos blockPos) + { + List list = iWorld.getEntitiesWithinAABB(CatEntity.class, new AxisAlignedBB((double) blockPos.getX(), (double) (blockPos.getY() + 1), (double) blockPos.getZ(), (double) (blockPos.getX() + 1), (double) (blockPos.getY() + 2), (double) (blockPos.getZ() + 1))); + if (!list.isEmpty()) + { + for (CatEntity catentity : list) + { + if (catentity.isSitting()) + { + return true; + } + } + } + + return false; + } + + @Override + public boolean hasComparatorInputOverride(BlockState state) + { + return true; + } + + @Override + public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) + { + return Container.calcRedstoneFromInventory((IInventory) worldIn.getTileEntity(pos)); + } + + @Override + public BlockState rotate(BlockState state, Rotation rot) + { + return state.with(FACING, rot.rotate(state.get(FACING))); + } + + @Override + public BlockState mirror(BlockState state, Mirror mirrorIn) + { + return state.rotate(mirrorIn.toRotation(state.get(FACING))); + } + + @Override + protected void fillStateContainer(StateContainer.Builder builder) + { + builder.add(FACING, WATERLOGGED); + } + + @Override + public boolean allowsMovement(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) + { + return false; + } + + public static ChestType getTypeFromItem(Item itemIn) + { + return getTypeFromBlock(Block.getBlockFromItem(itemIn)); + } + + public static ChestType getTypeFromBlock(Block blockIn) + { + return blockIn instanceof ChestBlock ? ((ChestBlock) blockIn).getType() : null; + } + + public ChestType getType() + { + return this.type; + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/IronChestType.java b/src/main/java/com/progwml6/ironchest/common/blocks/ChestType.java similarity index 50% rename from src/main/java/com/progwml6/ironchest/common/blocks/IronChestType.java rename to src/main/java/com/progwml6/ironchest/common/blocks/ChestType.java index 9e95001..7bf1ead 100644 --- a/src/main/java/com/progwml6/ironchest/common/blocks/IronChestType.java +++ b/src/main/java/com/progwml6/ironchest/common/blocks/ChestType.java @@ -11,39 +11,33 @@ package com.progwml6.ironchest.common.blocks; import com.progwml6.ironchest.common.core.IronChestBlocks; -import com.progwml6.ironchest.common.gui.slot.ValidatingChestSlot; +import com.progwml6.ironchest.common.tileentity.CopperChestTileEntity; +import com.progwml6.ironchest.common.tileentity.CrystalChestTileEntity; +import com.progwml6.ironchest.common.tileentity.DiamondChestTileEntity; +import com.progwml6.ironchest.common.tileentity.DirtChestTileEntity; +import com.progwml6.ironchest.common.tileentity.GoldChestTileEntity; +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; +import com.progwml6.ironchest.common.tileentity.ObsidianChestTileEntity; +import com.progwml6.ironchest.common.tileentity.SilverChestTileEntity; import com.progwml6.ironchest.common.util.BlockNames; -import com.progwml6.ironchest.common.tileentity.TileEntityCopperChest; -import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest; -import com.progwml6.ironchest.common.tileentity.TileEntityDiamondChest; -import com.progwml6.ironchest.common.tileentity.TileEntityDirtChest; -import com.progwml6.ironchest.common.tileentity.TileEntityGoldChest; -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; -import com.progwml6.ironchest.common.tileentity.TileEntityObsidianChest; -import com.progwml6.ironchest.common.tileentity.TileEntitySilverChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; -public enum IronChestType implements IStringSerializable +public enum ChestType implements IStringSerializable { - //@formatter:off - IRON(54, 9, true, "iron_chest.png", TileEntityIronChest.class, 184, 202, BlockNames.IRON_CHEST), - GOLD(81, 9, true, "gold_chest.png", TileEntityGoldChest.class, 184, 256, BlockNames.GOLD_CHEST), - DIAMOND(108, 12, true, "diamond_chest.png", TileEntityDiamondChest.class, 184, 256, BlockNames.DIAMOND_CHEST), - COPPER(45, 9, false, "copper_chest.png", TileEntityCopperChest.class, 184, 184, BlockNames.COPPER_CHEST), - SILVER(72, 9, false, "silver_chest.png", TileEntitySilverChest.class, 184, 238, BlockNames.SILVER_CHEST), - CRYSTAL(108, 12, true, "crystal_chest.png", TileEntityCrystalChest.class, 238, 256, BlockNames.CRYSTAL_CHEST), - OBSIDIAN(108, 12, false, "obsidian_chest.png", TileEntityObsidianChest.class, 238, 256, BlockNames.OBSIDIAN_CHEST), - DIRTCHEST9000(1, 1, false, "dirt_chest.png", TileEntityDirtChest.class, 184, 184, BlockNames.DIRT_CHEST), - WOOD(0, 0, false, "", null, 0, 0, null); - //@formatter:on + IRON(54, 9, "iron_chest.png", IronChestTileEntity.class, BlockNames.IRON_CHEST, 184, 222, new ResourceLocation("ironchest", "textures/gui/iron_container.png"), 256, 256), + GOLD(81, 9, "gold_chest.png", GoldChestTileEntity.class, BlockNames.GOLD_CHEST, 184, 276, new ResourceLocation("ironchest", "textures/gui/gold_container.png"), 256, 276), + DIAMOND(108, 12, "diamond_chest.png", DiamondChestTileEntity.class, BlockNames.DIAMOND_CHEST, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276), + COPPER(45, 9, "copper_chest.png", CopperChestTileEntity.class, BlockNames.COPPER_CHEST, 184, 204, new ResourceLocation("ironchest", "textures/gui/copper_container.png"), 256, 256), + SILVER(72, 9, "silver_chest.png", SilverChestTileEntity.class, BlockNames.SILVER_CHEST, 184, 258, new ResourceLocation("ironchest", "textures/gui/silver_container.png"), 256, 276), + CRYSTAL(108, 12, "crystal_chest.png", CrystalChestTileEntity.class, BlockNames.CRYSTAL_CHEST, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276), + OBSIDIAN(108, 12, "obsidian_chest.png", ObsidianChestTileEntity.class, BlockNames.OBSIDIAN_CHEST, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276), + DIRTCHEST9000(1, 1, "dirt_chest.png", DirtChestTileEntity.class, BlockNames.DIRT_CHEST, 184, 184, new ResourceLocation("ironchest", "textures/gui/dirt_container.png"), 256, 256), + WOOD(0, 0, "", null, null, 0, 0, null, 0, 0); + + public static final ChestType VALUES[] = values(); public final String name; @@ -51,30 +45,35 @@ public enum IronChestType implements IStringSerializable public final int rowLength; - public final boolean tieredChest; - - public final ResourceLocation modelTexture; + public final String modelTexture; public final Class clazz; + public final String itemName; + public final int xSize; public final int ySize; - public final String itemName; + public final ResourceLocation guiTexture; - IronChestType(int size, int rowLength, boolean tieredChest, String modelTexture, Class clazz, int xSize, int ySize, - String itemName) + public final int textureXSize; + + public final int textureYSize; + + ChestType(int size, int rowLength, String modelTexture, Class clazz, String itemName, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) { this.name = this.name().toLowerCase(); this.size = size; this.rowLength = rowLength; - this.tieredChest = tieredChest; - this.modelTexture = new ResourceLocation("ironchest", "textures/model/" + modelTexture); + this.modelTexture = modelTexture; this.clazz = clazz; + this.itemName = itemName; this.xSize = xSize; this.ySize = ySize; - this.itemName = itemName; + this.guiTexture = guiTexture; + this.textureXSize = textureXSize; + this.textureYSize = textureYSize; } @Override @@ -93,25 +92,7 @@ public enum IronChestType implements IStringSerializable return this == CRYSTAL; } - public Slot makeSlot(IInventory chestInventory, int index, int x, int y) - { - return new ValidatingChestSlot(chestInventory, index, x, y, this); - } - - @SuppressWarnings("deprecation") - private static final Item DIRT_ITEM = Item.getItemFromBlock(Blocks.DIRT); - - public boolean acceptsStack(ItemStack itemstack) - { - if (this == DIRTCHEST9000) - { - return itemstack.isEmpty() || itemstack.getItem() == DIRT_ITEM; - } - - return true; - } - - public static IronChestType get(ResourceLocation resourceLocation) + public static ChestType get(ResourceLocation resourceLocation) { switch (resourceLocation.toString()) { @@ -136,7 +117,7 @@ public enum IronChestType implements IStringSerializable } } - public static IBlockState get(IronChestType type) + public static BlockState get(ChestType type) { switch (type) { @@ -161,26 +142,26 @@ public enum IronChestType implements IStringSerializable } } - public TileEntityIronChest makeEntity() + public IronChestTileEntity makeEntity() { switch (this) { case IRON: - return new TileEntityIronChest(); + return new IronChestTileEntity(); case GOLD: - return new TileEntityGoldChest(); + return new GoldChestTileEntity(); case DIAMOND: - return new TileEntityDiamondChest(); + return new DiamondChestTileEntity(); case COPPER: - return new TileEntityCopperChest(); + return new CopperChestTileEntity(); case SILVER: - return new TileEntitySilverChest(); + return new SilverChestTileEntity(); case CRYSTAL: - return new TileEntityCrystalChest(); + return new CrystalChestTileEntity(); case OBSIDIAN: - return new TileEntityObsidianChest(); + return new ObsidianChestTileEntity(); case DIRTCHEST9000: - return new TileEntityDirtChest(); + return new DirtChestTileEntity(); default: return null; } diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockIronChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/CopperChestBlock.java similarity index 63% rename from src/main/java/com/progwml6/ironchest/common/blocks/BlockIronChest.java rename to src/main/java/com/progwml6/ironchest/common/blocks/CopperChestBlock.java index 3b965a9..19c6b49 100644 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockIronChest.java +++ b/src/main/java/com/progwml6/ironchest/common/blocks/CopperChestBlock.java @@ -10,21 +10,21 @@ ******************************************************************************/ package com.progwml6.ironchest.common.blocks; -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; -import net.minecraft.block.state.IBlockState; +import com.progwml6.ironchest.common.tileentity.CopperChestTileEntity; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; -public class BlockIronChest extends BlockChest +public class CopperChestBlock extends ChestBlock { - public BlockIronChest(Properties properties) + public CopperChestBlock(Properties properties) { - super(properties, IronChestType.IRON); + super(properties, ChestType.COPPER); } @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) + public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityIronChest(); + return new CopperChestTileEntity(); } } diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockGoldChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/CrystalChestBlock.java similarity index 63% rename from src/main/java/com/progwml6/ironchest/common/blocks/BlockGoldChest.java rename to src/main/java/com/progwml6/ironchest/common/blocks/CrystalChestBlock.java index 20a6f1d..bf2f5ce 100644 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockGoldChest.java +++ b/src/main/java/com/progwml6/ironchest/common/blocks/CrystalChestBlock.java @@ -10,22 +10,21 @@ ******************************************************************************/ package com.progwml6.ironchest.common.blocks; -import com.progwml6.ironchest.common.tileentity.TileEntityGoldChest; -import net.minecraft.block.state.IBlockState; +import com.progwml6.ironchest.common.tileentity.CrystalChestTileEntity; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; -public class BlockGoldChest extends BlockChest +public class CrystalChestBlock extends ChestBlock { - public BlockGoldChest(Properties properties) + public CrystalChestBlock(Properties properties) { - super(properties, IronChestType.GOLD); + super(properties, ChestType.CRYSTAL); } @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) + public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityGoldChest(); + return new CrystalChestTileEntity(); } - } diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/DiamondChestBlock.java b/src/main/java/com/progwml6/ironchest/common/blocks/DiamondChestBlock.java new file mode 100644 index 0000000..73cef18 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/blocks/DiamondChestBlock.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.blocks; + +import com.progwml6.ironchest.common.tileentity.DiamondChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockReader; + +public class DiamondChestBlock extends ChestBlock +{ + public DiamondChestBlock(Block.Properties properties) + { + super(properties, ChestType.DIAMOND); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) + { + return new DiamondChestTileEntity(); + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockCrystalChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/DirtChestBlock.java similarity index 61% rename from src/main/java/com/progwml6/ironchest/common/blocks/BlockCrystalChest.java rename to src/main/java/com/progwml6/ironchest/common/blocks/DirtChestBlock.java index 3af9589..4e5d874 100644 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockCrystalChest.java +++ b/src/main/java/com/progwml6/ironchest/common/blocks/DirtChestBlock.java @@ -10,21 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.blocks; -import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest; -import net.minecraft.block.state.IBlockState; +import com.progwml6.ironchest.common.tileentity.DirtChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; -public class BlockCrystalChest extends BlockChest +public class DirtChestBlock extends ChestBlock { - public BlockCrystalChest(Properties properties) + public DirtChestBlock(Block.Properties properties) { - super(properties, IronChestType.CRYSTAL); + super(properties, ChestType.DIRTCHEST9000); } @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) + public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityCrystalChest(); + return new DirtChestTileEntity(); } } diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockDiamondChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/GoldChestBlock.java similarity index 62% rename from src/main/java/com/progwml6/ironchest/common/blocks/BlockDiamondChest.java rename to src/main/java/com/progwml6/ironchest/common/blocks/GoldChestBlock.java index 241e03c..d1544ff 100644 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockDiamondChest.java +++ b/src/main/java/com/progwml6/ironchest/common/blocks/GoldChestBlock.java @@ -10,22 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.blocks; -import com.progwml6.ironchest.common.tileentity.TileEntityDiamondChest; -import net.minecraft.block.state.IBlockState; +import com.progwml6.ironchest.common.tileentity.GoldChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; -public class BlockDiamondChest extends BlockChest +public class GoldChestBlock extends ChestBlock { - public BlockDiamondChest(Properties properties) + public GoldChestBlock(Block.Properties properties) { - super(properties, IronChestType.DIAMOND); + super(properties, ChestType.GOLD); } @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) + public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityDiamondChest(); + return new GoldChestTileEntity(); } - } diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/BlockCopperChest.java b/src/main/java/com/progwml6/ironchest/common/blocks/IronChestBlock.java similarity index 62% rename from src/main/java/com/progwml6/ironchest/common/blocks/BlockCopperChest.java rename to src/main/java/com/progwml6/ironchest/common/blocks/IronChestBlock.java index 7a46523..ef7714c 100644 --- a/src/main/java/com/progwml6/ironchest/common/blocks/BlockCopperChest.java +++ b/src/main/java/com/progwml6/ironchest/common/blocks/IronChestBlock.java @@ -10,21 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.blocks; -import com.progwml6.ironchest.common.tileentity.TileEntityCopperChest; -import net.minecraft.block.state.IBlockState; +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; -public class BlockCopperChest extends BlockChest +public class IronChestBlock extends ChestBlock { - public BlockCopperChest(Properties properties) + public IronChestBlock(Block.Properties properties) { - super(properties, IronChestType.COPPER); + super(properties, ChestType.IRON); } @Override - public TileEntity createTileEntity(IBlockState state, IBlockReader world) + public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityCopperChest(); + return new IronChestTileEntity(); } } diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/ObsidianChestBlock.java b/src/main/java/com/progwml6/ironchest/common/blocks/ObsidianChestBlock.java new file mode 100644 index 0000000..9eb64ad --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/blocks/ObsidianChestBlock.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.blocks; + +import com.progwml6.ironchest.common.tileentity.ObsidianChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockReader; + +public class ObsidianChestBlock extends ChestBlock +{ + public ObsidianChestBlock(Block.Properties properties) + { + super(properties, ChestType.OBSIDIAN); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) + { + return new ObsidianChestTileEntity(); + } +} \ No newline at end of file diff --git a/src/main/java/com/progwml6/ironchest/common/blocks/SilverChestBlock.java b/src/main/java/com/progwml6/ironchest/common/blocks/SilverChestBlock.java new file mode 100644 index 0000000..679cc79 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/blocks/SilverChestBlock.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.blocks; + +import com.progwml6.ironchest.common.tileentity.SilverChestTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockReader; + +public class SilverChestBlock extends ChestBlock +{ + public SilverChestBlock(Block.Properties properties) + { + super(properties, ChestType.SILVER); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) + { + return new SilverChestTileEntity(); + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/core/IronChestBlocks.java b/src/main/java/com/progwml6/ironchest/common/core/IronChestBlocks.java index 76f9b0d..2936d5b 100644 --- a/src/main/java/com/progwml6/ironchest/common/core/IronChestBlocks.java +++ b/src/main/java/com/progwml6/ironchest/common/core/IronChestBlocks.java @@ -10,18 +10,18 @@ ******************************************************************************/ package com.progwml6.ironchest.common.core; -import com.progwml6.ironchest.client.renderer.TileEntityIronChestItemRenderer; import com.progwml6.ironchest.IronChest; -import com.progwml6.ironchest.common.blocks.BlockChest; -import com.progwml6.ironchest.common.blocks.BlockCopperChest; -import com.progwml6.ironchest.common.blocks.BlockCrystalChest; -import com.progwml6.ironchest.common.blocks.BlockDiamondChest; -import com.progwml6.ironchest.common.blocks.BlockDirtChest; -import com.progwml6.ironchest.common.blocks.BlockGoldChest; -import com.progwml6.ironchest.common.blocks.BlockIronChest; -import com.progwml6.ironchest.common.blocks.BlockObsidianChest; -import com.progwml6.ironchest.common.blocks.BlockSilverChest; -import com.progwml6.ironchest.common.items.ItemChest; +import com.progwml6.ironchest.client.renderer.IronChestItemStackTileEntityRenderer; +import com.progwml6.ironchest.common.blocks.ChestBlock; +import com.progwml6.ironchest.common.blocks.CopperChestBlock; +import com.progwml6.ironchest.common.blocks.CrystalChestBlock; +import com.progwml6.ironchest.common.blocks.DiamondChestBlock; +import com.progwml6.ironchest.common.blocks.DirtChestBlock; +import com.progwml6.ironchest.common.blocks.GoldChestBlock; +import com.progwml6.ironchest.common.blocks.IronChestBlock; +import com.progwml6.ironchest.common.blocks.ObsidianChestBlock; +import com.progwml6.ironchest.common.blocks.SilverChestBlock; +import com.progwml6.ironchest.common.items.ChestItem; import com.progwml6.ironchest.common.util.BlockNames; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -38,49 +38,49 @@ public class IronChestBlocks public static Properties itemBuilder; @ObjectHolder(BlockNames.IRON_CHEST) - public static BlockChest ironChestBlock; + public static ChestBlock ironChestBlock; @ObjectHolder(BlockNames.IRON_CHEST) public static Item ironChestItemBlock; @ObjectHolder(BlockNames.GOLD_CHEST) - public static BlockChest goldChestBlock; + public static ChestBlock goldChestBlock; @ObjectHolder(BlockNames.GOLD_CHEST) public static Item goldChestItemBlock; @ObjectHolder(BlockNames.DIAMOND_CHEST) - public static BlockChest diamondChestBlock; + public static ChestBlock diamondChestBlock; @ObjectHolder(BlockNames.DIAMOND_CHEST) public static Item diamondChestItemBlock; @ObjectHolder(BlockNames.COPPER_CHEST) - public static BlockChest copperChestBlock; + public static ChestBlock copperChestBlock; @ObjectHolder(BlockNames.COPPER_CHEST) public static Item copperChestItemBlock; @ObjectHolder(BlockNames.SILVER_CHEST) - public static BlockChest silverChestBlock; + public static ChestBlock silverChestBlock; @ObjectHolder(BlockNames.SILVER_CHEST) public static Item silverChestItemBlock; @ObjectHolder(BlockNames.CRYSTAL_CHEST) - public static BlockChest crystalChestBlock; + public static ChestBlock crystalChestBlock; @ObjectHolder(BlockNames.CRYSTAL_CHEST) public static Item crystalChestItemBlock; @ObjectHolder(BlockNames.OBSIDIAN_CHEST) - public static BlockChest obsidianChestBlock; + public static ChestBlock obsidianChestBlock; @ObjectHolder(BlockNames.OBSIDIAN_CHEST) public static Item obsidianChestItemBlock; @ObjectHolder(BlockNames.DIRT_CHEST) - public static BlockChest dirtChestBlock; + public static ChestBlock dirtChestBlock; @ObjectHolder(BlockNames.DIRT_CHEST) public static Item dirtChestItemBlock; @@ -98,14 +98,14 @@ public class IronChestBlocks { IForgeRegistry blockRegistry = event.getRegistry(); - blockRegistry.register(new BlockIronChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); - blockRegistry.register(new BlockGoldChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); - blockRegistry.register(new BlockDiamondChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); - blockRegistry.register(new BlockCopperChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); - blockRegistry.register(new BlockSilverChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); - blockRegistry.register(new BlockCrystalChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); - blockRegistry.register(new BlockObsidianChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 10000.0F))); - blockRegistry.register(new BlockDirtChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new IronChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new GoldChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new DiamondChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new CopperChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new SilverChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new CrystalChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); + blockRegistry.register(new ObsidianChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 10000.0F))); + blockRegistry.register(new DirtChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); } @SubscribeEvent @@ -113,16 +113,16 @@ public class IronChestBlocks { IForgeRegistry itemRegistry = event.getRegistry(); - itemBuilder = (new Properties()).group(IronChestCreativeTabs.IRON_CHESTS).setTEISR(() -> TileEntityIronChestItemRenderer::new); + itemBuilder = (new Properties()).group(IronChestItemGroups.IRON_CHESTS).setTEISR(() -> IronChestItemStackTileEntityRenderer::new); - itemRegistry.register(new ItemChest(ironChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(goldChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(diamondChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(copperChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(silverChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(crystalChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(obsidianChestBlock, itemBuilder)); - itemRegistry.register(new ItemChest(dirtChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(ironChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(goldChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(diamondChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(copperChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(silverChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(crystalChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(obsidianChestBlock, itemBuilder)); + itemRegistry.register(new ChestItem(dirtChestBlock, itemBuilder)); } } } diff --git a/src/main/java/com/progwml6/ironchest/common/core/IronChestCreativeTabs.java b/src/main/java/com/progwml6/ironchest/common/core/IronChestItemGroups.java similarity index 91% rename from src/main/java/com/progwml6/ironchest/common/core/IronChestCreativeTabs.java rename to src/main/java/com/progwml6/ironchest/common/core/IronChestItemGroups.java index f515054..dc90172 100644 --- a/src/main/java/com/progwml6/ironchest/common/core/IronChestCreativeTabs.java +++ b/src/main/java/com/progwml6/ironchest/common/core/IronChestItemGroups.java @@ -15,12 +15,8 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public final class IronChestCreativeTabs +public class IronChestItemGroups { - private IronChestCreativeTabs() - { - } - public static final ItemGroup IRON_CHESTS = new ItemGroup("ironchest") { @Override diff --git a/src/main/java/com/progwml6/ironchest/common/core/IronChestItems.java b/src/main/java/com/progwml6/ironchest/common/core/IronChestItems.java index 4bb4d24..dd0f7c6 100644 --- a/src/main/java/com/progwml6/ironchest/common/core/IronChestItems.java +++ b/src/main/java/com/progwml6/ironchest/common/core/IronChestItems.java @@ -11,8 +11,8 @@ package com.progwml6.ironchest.common.core; import com.progwml6.ironchest.IronChest; +import com.progwml6.ironchest.common.items.ChestChangerItem; import com.progwml6.ironchest.common.items.ChestChangerType; -import com.progwml6.ironchest.common.items.ItemChestChanger; import com.progwml6.ironchest.common.util.ItemNames; import net.minecraft.item.Item; import net.minecraft.item.Item.Properties; @@ -66,17 +66,17 @@ public class IronChestItems { IForgeRegistry itemRegistry = event.getRegistry(); - itemProperties = (new Properties()).group(IronChestCreativeTabs.IRON_CHESTS).maxStackSize(1); + itemProperties = (new Properties()).group(IronChestItemGroups.IRON_CHESTS).maxStackSize(1); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.IRON_GOLD)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.GOLD_DIAMOND)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.COPPER_SILVER)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.SILVER_GOLD)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.COPPER_IRON)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.DIAMOND_CRYSTAL)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.WOOD_IRON)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.WOOD_COPPER)); - itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.DIAMOND_OBSIDIAN)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.IRON_GOLD)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.GOLD_DIAMOND)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.COPPER_SILVER)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.SILVER_GOLD)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.COPPER_IRON)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.DIAMOND_CRYSTAL)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.WOOD_IRON)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.WOOD_COPPER)); + itemRegistry.register(new ChestChangerItem(itemProperties, ChestChangerType.DIAMOND_OBSIDIAN)); } } } diff --git a/src/main/java/com/progwml6/ironchest/common/gui/ContainerIronChest.java b/src/main/java/com/progwml6/ironchest/common/gui/ContainerIronChest.java deleted file mode 100644 index d4fd5f9..0000000 --- a/src/main/java/com/progwml6/ironchest/common/gui/ContainerIronChest.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.gui; - -import com.progwml6.ironchest.common.blocks.IronChestType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerIronChest extends Container -{ - private IronChestType type; - - private EntityPlayer player; - - private IInventory chest; - - public ContainerIronChest(IInventory playerInventory, IInventory chestInventory, IronChestType type, EntityPlayer player, int xSize, int ySize) - { - this.chest = chestInventory; - this.player = player; - this.type = type; - chestInventory.openInventory(this.player); - this.layoutContainer(playerInventory, chestInventory, type, xSize, ySize); - } - - @Override - public boolean canInteractWith(EntityPlayer playerIn) - { - return this.chest.isUsableByPlayer(playerIn); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) - { - ItemStack itemStack = ItemStack.EMPTY; - Slot slot = this.inventorySlots.get(index); - - if (slot != null && slot.getHasStack()) - { - ItemStack itemStack1 = slot.getStack(); - itemStack = itemStack1.copy(); - - if (index < this.type.size) - { - if (!this.mergeItemStack(itemStack1, this.type.size, this.inventorySlots.size(), true)) - { - return ItemStack.EMPTY; - } - } - else if (!this.type.acceptsStack(itemStack1)) - { - return ItemStack.EMPTY; - } - else if (!this.mergeItemStack(itemStack1, 0, this.type.size, false)) - { - return ItemStack.EMPTY; - } - - if (itemStack1.isEmpty()) - { - slot.putStack(ItemStack.EMPTY); - } - else - { - slot.onSlotChanged(); - } - } - - return itemStack; - } - - protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize) - { - if (type == IronChestType.DIRTCHEST9000) - { - this.addSlot(type.makeSlot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18)); - } - else - { - for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++) - { - for (int chestCol = 0; chestCol < type.rowLength; chestCol++) - { - this.addSlot(type.makeSlot(chestInventory, chestCol + chestRow * type.rowLength, 12 + chestCol * 18, 8 + chestRow * 18)); - } - } - } - - int leftCol = (xSize - 162) / 2 + 1; - - for (int playerInvRow = 0; playerInvRow < 3; playerInvRow++) - { - for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++) - { - this.addSlot(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, ySize - (4 - playerInvRow) * 18 - 10)); - } - - } - - for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) - { - this.addSlot(new Slot(playerInventory, hotbarSlot, leftCol + hotbarSlot * 18, ySize - 24)); - } - } - - public EntityPlayer getPlayer() - { - return this.player; - } - - @Override - public void onContainerClosed(EntityPlayer playerIn) - { - super.onContainerClosed(playerIn); - this.chest.closeInventory(playerIn); - } - - public IInventory getChestInventory() - { - return this.chest; - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/gui/GuiHandler.java b/src/main/java/com/progwml6/ironchest/common/gui/GuiHandler.java deleted file mode 100644 index db2e947..0000000 --- a/src/main/java/com/progwml6/ironchest/common/gui/GuiHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.progwml6.ironchest.common.gui; - -import com.progwml6.ironchest.client.gui.GUIChest; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.inventory.IInventory; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.FMLPlayMessages; - -public class GuiHandler -{ - public static GuiScreen openGui(FMLPlayMessages.OpenContainer openContainer) - { - BlockPos pos = openContainer.getAdditionalData().readBlockPos(); - - for (GUIChest.GUI type : GUIChest.GUI.values()) - { - if (type.getGuiId().equals(openContainer.getId())) - { - return new GUIChest(type, (IInventory) Minecraft.getInstance().player.inventory, (IInventory) Minecraft.getInstance().world.getTileEntity(pos)); - } - } - - return null; - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/inventory/ChestContainer.java b/src/main/java/com/progwml6/ironchest/common/inventory/ChestContainer.java new file mode 100644 index 0000000..0f6e2dc --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/inventory/ChestContainer.java @@ -0,0 +1,212 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.inventory; + +import com.progwml6.ironchest.common.blocks.ChestType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.ContainerType; +import net.minecraft.inventory.container.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public class ChestContainer extends Container +{ + private final IInventory inventory; + + private final ChestType chestType; + + private ChestContainer(ContainerType containerType, int windowId, PlayerInventory playerInventory) + { + this(containerType, windowId, playerInventory, new Inventory(ChestType.WOOD.size), ChestType.WOOD); + } + + public static ChestContainer createIronContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.IRON_CHEST, windowId, playerInventory, new Inventory(ChestType.IRON.size), ChestType.IRON); + } + + public static ChestContainer createIronContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.IRON_CHEST, windowId, playerInventory, inventory, ChestType.IRON); + } + + public static ChestContainer createGoldContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.GOLD_CHEST, windowId, playerInventory, new Inventory(ChestType.GOLD.size), ChestType.GOLD); + } + + public static ChestContainer createGoldContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.GOLD_CHEST, windowId, playerInventory, inventory, ChestType.GOLD); + } + + public static ChestContainer createDiamondContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.DIAMOND_CHEST, windowId, playerInventory, new Inventory(ChestType.DIAMOND.size), ChestType.DIAMOND); + } + + public static ChestContainer createDiamondContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.DIAMOND_CHEST, windowId, playerInventory, inventory, ChestType.DIAMOND); + } + + public static ChestContainer createCrystalContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.CRYSTAL_CHEST, windowId, playerInventory, new Inventory(ChestType.CRYSTAL.size), ChestType.CRYSTAL); + } + + public static ChestContainer createCrystalContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.CRYSTAL_CHEST, windowId, playerInventory, inventory, ChestType.CRYSTAL); + } + + public static ChestContainer createCopperContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.COPPER_CHEST, windowId, playerInventory, new Inventory(ChestType.COPPER.size), ChestType.COPPER); + } + + public static ChestContainer createCopperContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.COPPER_CHEST, windowId, playerInventory, inventory, ChestType.COPPER); + } + + public static ChestContainer createSilverContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.SILVER_CHEST, windowId, playerInventory, new Inventory(ChestType.CRYSTAL.size), ChestType.SILVER); + } + + public static ChestContainer createSilverContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.SILVER_CHEST, windowId, playerInventory, inventory, ChestType.SILVER); + } + + public static ChestContainer createObsidianContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.OBSIDIAN_CHEST, windowId, playerInventory, new Inventory(ChestType.OBSIDIAN.size), ChestType.OBSIDIAN); + } + + public static ChestContainer createObsidianContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.OBSIDIAN_CHEST, windowId, playerInventory, inventory, ChestType.OBSIDIAN); + } + + public static ChestContainer createDirtContainer(int windowId, PlayerInventory playerInventory) + { + return new ChestContainer(ChestContainerType.DIRT_CHEST, windowId, playerInventory, new Inventory(ChestType.DIRTCHEST9000.size), ChestType.DIRTCHEST9000); + } + + public static ChestContainer createDirtContainer(int windowId, PlayerInventory playerInventory, IInventory inventory) + { + return new ChestContainer(ChestContainerType.DIRT_CHEST, windowId, playerInventory, inventory, ChestType.DIRTCHEST9000); + } + + public ChestContainer(ContainerType containerType, int windowId, PlayerInventory playerInventory, IInventory inventory, ChestType chestType) + { + super(containerType, windowId); + func_216962_a(inventory, chestType.size); + + this.inventory = inventory; + this.chestType = chestType; + + inventory.openInventory(playerInventory.player); + + if (chestType == ChestType.DIRTCHEST9000) + { + this.addSlot(new DirtChestSlot(inventory, 0, 12 + 4 * 18, 8 + 2 * 18)); + } + else + { + for (int chestRow = 0; chestRow < chestType.getRowCount(); chestRow++) + { + for (int chestCol = 0; chestCol < chestType.rowLength; chestCol++) + { + this.addSlot(new Slot(inventory, chestCol + chestRow * chestType.rowLength, 12 + chestCol * 18, 18 + chestRow * 18)); + } + } + } + + int leftCol = (chestType.xSize - 162) / 2 + 1; + + for (int playerInvRow = 0; playerInvRow < 3; playerInvRow++) + { + for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++) + { + this.addSlot(new Slot(playerInventory, playerInvCol + playerInvRow * 9 + 9, leftCol + playerInvCol * 18, chestType.ySize - (4 - playerInvRow) * 18 - 10)); + } + + } + + for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) + { + this.addSlot(new Slot(playerInventory, hotbarSlot, leftCol + hotbarSlot * 18, chestType.ySize - 24)); + } + } + + @Override + public boolean canInteractWith(PlayerEntity playerIn) + { + return this.inventory.isUsableByPlayer(playerIn); + } + + @Override + public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) + { + ItemStack itemstack = ItemStack.EMPTY; + Slot slot = this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index < this.chestType.size) + { + if (!this.mergeItemStack(itemstack1, this.chestType.size, this.inventorySlots.size(), true)) + { + return ItemStack.EMPTY; + } + } + else if (!this.mergeItemStack(itemstack1, 0, this.chestType.size, false)) + { + return ItemStack.EMPTY; + } + + if (itemstack1.isEmpty()) + { + slot.putStack(ItemStack.EMPTY); + } + else + { + slot.onSlotChanged(); + } + } + + return itemstack; + } + + @Override + public void onContainerClosed(PlayerEntity playerIn) + { + super.onContainerClosed(playerIn); + this.inventory.closeInventory(playerIn); + } + + @OnlyIn(Dist.CLIENT) + public ChestType getChestType() + { + return this.chestType; + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/inventory/ChestContainerType.java b/src/main/java/com/progwml6/ironchest/common/inventory/ChestContainerType.java new file mode 100644 index 0000000..7c4a37c --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/inventory/ChestContainerType.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.inventory; + +import com.progwml6.ironchest.IronChest; +import com.progwml6.ironchest.client.inventory.ChestScreen; +import com.progwml6.ironchest.common.util.ContainerNames; +import net.minecraft.client.gui.ScreenManager; +import net.minecraft.inventory.container.ContainerType; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.ObjectHolder; + +public class ChestContainerType +{ + @ObjectHolder(ContainerNames.IRON_CHEST) + public static ContainerType IRON_CHEST; + + @ObjectHolder(ContainerNames.GOLD_CHEST) + public static ContainerType GOLD_CHEST; + + @ObjectHolder(ContainerNames.DIAMOND_CHEST) + public static ContainerType DIAMOND_CHEST; + + @ObjectHolder(ContainerNames.CRYSTAL_CHEST) + public static ContainerType CRYSTAL_CHEST; + + @ObjectHolder(ContainerNames.COPPER_CHEST) + public static ContainerType COPPER_CHEST; + + @ObjectHolder(ContainerNames.SILVER_CHEST) + public static ContainerType SILVER_CHEST; + + @ObjectHolder(ContainerNames.OBSIDIAN_CHEST) + public static ContainerType OBSIDIAN_CHEST; + + @ObjectHolder(ContainerNames.DIRT_CHEST) + public static ContainerType DIRT_CHEST; + + @Mod.EventBusSubscriber(modid = IronChest.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) + public static class Registration + { + @SubscribeEvent + public static void onContainerTypeRegistry(final RegistryEvent.Register> e) + { + e.getRegistry().registerAll( + new ContainerType<>(ChestContainer::createIronContainer).setRegistryName(ContainerNames.IRON_CHEST), + new ContainerType<>(ChestContainer::createGoldContainer).setRegistryName(ContainerNames.GOLD_CHEST), + new ContainerType<>(ChestContainer::createDiamondContainer).setRegistryName(ContainerNames.DIAMOND_CHEST), + new ContainerType<>(ChestContainer::createCrystalContainer).setRegistryName(ContainerNames.CRYSTAL_CHEST), + new ContainerType<>(ChestContainer::createCopperContainer).setRegistryName(ContainerNames.COPPER_CHEST), + new ContainerType<>(ChestContainer::createSilverContainer).setRegistryName(ContainerNames.SILVER_CHEST), + new ContainerType<>(ChestContainer::createObsidianContainer).setRegistryName(ContainerNames.OBSIDIAN_CHEST), + new ContainerType<>(ChestContainer::createDirtContainer).setRegistryName(ContainerNames.DIRT_CHEST) + ); + } + } + + @OnlyIn(Dist.CLIENT) + public static void registerScreenFactories() + { + ScreenManager.registerFactory(IRON_CHEST, ChestScreen::new); + ScreenManager.registerFactory(GOLD_CHEST, ChestScreen::new); + ScreenManager.registerFactory(DIAMOND_CHEST, ChestScreen::new); + ScreenManager.registerFactory(CRYSTAL_CHEST, ChestScreen::new); + ScreenManager.registerFactory(COPPER_CHEST, ChestScreen::new); + ScreenManager.registerFactory(SILVER_CHEST, ChestScreen::new); + ScreenManager.registerFactory(OBSIDIAN_CHEST, ChestScreen::new); + ScreenManager.registerFactory(DIRT_CHEST, ChestScreen::new); + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/gui/slot/ValidatingChestSlot.java b/src/main/java/com/progwml6/ironchest/common/inventory/DirtChestSlot.java similarity index 63% rename from src/main/java/com/progwml6/ironchest/common/gui/slot/ValidatingChestSlot.java rename to src/main/java/com/progwml6/ironchest/common/inventory/DirtChestSlot.java index 8a6f2c0..2ce0805 100644 --- a/src/main/java/com/progwml6/ironchest/common/gui/slot/ValidatingChestSlot.java +++ b/src/main/java/com/progwml6/ironchest/common/inventory/DirtChestSlot.java @@ -8,26 +8,24 @@ * Contributors: * cpw - initial API and implementation ******************************************************************************/ -package com.progwml6.ironchest.common.gui.slot; +package com.progwml6.ironchest.common.inventory; -import com.progwml6.ironchest.common.blocks.IronChestType; +import net.minecraft.block.Blocks; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; +import net.minecraft.inventory.container.Slot; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ValidatingChestSlot extends Slot +public class DirtChestSlot extends Slot { - private IronChestType type; - - public ValidatingChestSlot(IInventory inventoryIn, int slotIndex, int xPosition, int yPosition, IronChestType type) + public DirtChestSlot(IInventory inventoryIn, int slotIndex, int xPosition, int yPosition) { super(inventoryIn, slotIndex, xPosition, yPosition); - this.type = type; } @Override public boolean isItemValid(ItemStack stack) { - return this.type.acceptsStack(stack); + return stack.isEmpty() || stack.getItem() == Item.getItemFromBlock(Blocks.DIRT); } } diff --git a/src/main/java/com/progwml6/ironchest/common/items/ItemChestChanger.java b/src/main/java/com/progwml6/ironchest/common/items/ChestChangerItem.java similarity index 58% rename from src/main/java/com/progwml6/ironchest/common/items/ItemChestChanger.java rename to src/main/java/com/progwml6/ironchest/common/items/ChestChangerItem.java index fe7cdf7..25901a7 100644 --- a/src/main/java/com/progwml6/ironchest/common/items/ItemChestChanger.java +++ b/src/main/java/com/progwml6/ironchest/common/items/ChestChangerItem.java @@ -10,28 +10,27 @@ ******************************************************************************/ package com.progwml6.ironchest.common.items; -import com.progwml6.ironchest.common.blocks.BlockChest; -import com.progwml6.ironchest.common.blocks.BlockIronChest; -import com.progwml6.ironchest.common.blocks.IronChestType; -import com.progwml6.ironchest.common.tileentity.TileEntityIronChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import com.progwml6.ironchest.common.blocks.ChestBlock; +import com.progwml6.ironchest.common.blocks.ChestType; +import com.progwml6.ironchest.common.tileentity.IronChestTileEntity; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; +import net.minecraft.tileentity.ChestTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; -public class ItemChestChanger extends ItemTooltip +public class ChestChangerItem extends TooltipItem { public final ChestChangerType type; - public ItemChestChanger(Properties properties, ChestChangerType chestChangerType) + public ChestChangerItem(Properties properties, ChestChangerType chestChangerType) { super(properties); this.type = chestChangerType; @@ -39,72 +38,72 @@ public class ItemChestChanger extends ItemTooltip } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) + public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) { - EntityPlayer entityPlayer = context.getPlayer(); + PlayerEntity entityPlayer = context.getPlayer(); BlockPos blockPos = context.getPos(); World world = context.getWorld(); ItemStack itemStack = context.getItem(); if (world.isRemote) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } - if (this.type.canUpgrade(IronChestType.WOOD)) + if (this.type.canUpgrade(ChestType.WOOD)) { - if (!(world.getBlockState(blockPos).getBlock() instanceof net.minecraft.block.BlockChest)) + if (!(world.getBlockState(blockPos).getBlock() instanceof net.minecraft.block.ChestBlock)) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } } else { - if (world.getBlockState(blockPos).getBlock().getDefaultState() != IronChestType.get(this.type.source)) + if (world.getBlockState(blockPos).getBlock().getDefaultState() != ChestType.get(this.type.source)) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } } TileEntity tileEntity = world.getTileEntity(blockPos); - TileEntityIronChest newChest = new TileEntityIronChest(); + IronChestTileEntity newChest = new IronChestTileEntity(); ITextComponent customName = null; NonNullList chestContents = NonNullList.withSize(27, ItemStack.EMPTY); - EnumFacing chestFacing = EnumFacing.NORTH; + Direction chestFacing = Direction.NORTH; if (tileEntity != null) { - if (tileEntity instanceof TileEntityIronChest) + if (tileEntity instanceof IronChestTileEntity) { - TileEntityIronChest chest = (TileEntityIronChest) tileEntity; - IBlockState chestState = world.getBlockState(blockPos); + IronChestTileEntity chest = (IronChestTileEntity) tileEntity; + BlockState chestState = world.getBlockState(blockPos); chestContents = chest.getItems(); - chestFacing = chestState.get(BlockChest.FACING); + chestFacing = chestState.get(ChestBlock.FACING); customName = chest.getCustomName(); newChest = this.type.target.makeEntity(); if (newChest == null) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } } - else if (tileEntity instanceof TileEntityChest) + else if (tileEntity instanceof ChestTileEntity) { - IBlockState chestState = world.getBlockState(blockPos); - chestFacing = chestState.get(net.minecraft.block.BlockChest.FACING); - TileEntityChest chest = (TileEntityChest) tileEntity; + BlockState chestState = world.getBlockState(blockPos); + chestFacing = chestState.get(net.minecraft.block.ChestBlock.FACING); + ChestTileEntity chest = (ChestTileEntity) tileEntity; - if (TileEntityChest.getPlayersUsing(world, blockPos) > 0) + if (ChestTileEntity.getPlayersUsing(world, blockPos) > 0) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } - if (!this.type.canUpgrade(IronChestType.WOOD)) + if (!this.type.canUpgrade(ChestType.WOOD)) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } chestContents = NonNullList.withSize(chest.getSizeInventory(), ItemStack.EMPTY); @@ -122,10 +121,10 @@ public class ItemChestChanger extends ItemTooltip tileEntity.updateContainingBlockInfo(); + world.removeBlock(blockPos, false); world.removeTileEntity(blockPos); - world.removeBlock(blockPos); - IBlockState iBlockState = IronChestType.get(this.type.target).with(BlockIronChest.FACING, chestFacing); + BlockState iBlockState = ChestType.get(this.type.target).with(ChestBlock.FACING, chestFacing); world.setTileEntity(blockPos, newChest); world.setBlockState(blockPos, iBlockState, 3); @@ -134,14 +133,14 @@ public class ItemChestChanger extends ItemTooltip TileEntity tileEntity2 = world.getTileEntity(blockPos); - if (tileEntity2 instanceof TileEntityIronChest) + if (tileEntity2 instanceof IronChestTileEntity) { if (customName != null) { - ((TileEntityIronChest) tileEntity2).setCustomName(customName); + ((IronChestTileEntity) tileEntity2).setCustomName(customName); } - ((TileEntityIronChest) tileEntity2).setItems(chestContents); + ((IronChestTileEntity) tileEntity2).setItems(chestContents); } if (!entityPlayer.abilities.isCreativeMode) @@ -149,6 +148,6 @@ public class ItemChestChanger extends ItemTooltip itemStack.shrink(1); } - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } } diff --git a/src/main/java/com/progwml6/ironchest/common/items/ChestChangerType.java b/src/main/java/com/progwml6/ironchest/common/items/ChestChangerType.java index 78952aa..a01dffd 100644 --- a/src/main/java/com/progwml6/ironchest/common/items/ChestChangerType.java +++ b/src/main/java/com/progwml6/ironchest/common/items/ChestChangerType.java @@ -10,18 +10,18 @@ ******************************************************************************/ package com.progwml6.ironchest.common.items; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.util.ItemNames; import net.minecraft.util.ResourceLocation; -import static com.progwml6.ironchest.common.blocks.IronChestType.COPPER; -import static com.progwml6.ironchest.common.blocks.IronChestType.CRYSTAL; -import static com.progwml6.ironchest.common.blocks.IronChestType.DIAMOND; -import static com.progwml6.ironchest.common.blocks.IronChestType.GOLD; -import static com.progwml6.ironchest.common.blocks.IronChestType.IRON; -import static com.progwml6.ironchest.common.blocks.IronChestType.OBSIDIAN; -import static com.progwml6.ironchest.common.blocks.IronChestType.SILVER; -import static com.progwml6.ironchest.common.blocks.IronChestType.WOOD; +import static com.progwml6.ironchest.common.blocks.ChestType.COPPER; +import static com.progwml6.ironchest.common.blocks.ChestType.CRYSTAL; +import static com.progwml6.ironchest.common.blocks.ChestType.DIAMOND; +import static com.progwml6.ironchest.common.blocks.ChestType.GOLD; +import static com.progwml6.ironchest.common.blocks.ChestType.IRON; +import static com.progwml6.ironchest.common.blocks.ChestType.OBSIDIAN; +import static com.progwml6.ironchest.common.blocks.ChestType.SILVER; +import static com.progwml6.ironchest.common.blocks.ChestType.WOOD; public enum ChestChangerType { @@ -37,20 +37,20 @@ public enum ChestChangerType DIAMOND_OBSIDIAN(DIAMOND, OBSIDIAN, ItemNames.DIAMOND_OBSIDIAN_UPGRADE); //@formatter:on - public final IronChestType source; + public final ChestType source; - public final IronChestType target; + public final ChestType target; public final ResourceLocation itemName; - ChestChangerType(IronChestType source, IronChestType target, String itemName) + ChestChangerType(ChestType source, ChestType target, String itemName) { this.source = source; this.target = target; this.itemName = new ResourceLocation(itemName); } - public boolean canUpgrade(IronChestType from) + public boolean canUpgrade(ChestType from) { return from == this.source; } diff --git a/src/main/java/com/progwml6/ironchest/common/items/ItemChest.java b/src/main/java/com/progwml6/ironchest/common/items/ChestItem.java similarity index 83% rename from src/main/java/com/progwml6/ironchest/common/items/ItemChest.java rename to src/main/java/com/progwml6/ironchest/common/items/ChestItem.java index 9787fe2..cf91208 100644 --- a/src/main/java/com/progwml6/ironchest/common/items/ItemChest.java +++ b/src/main/java/com/progwml6/ironchest/common/items/ChestItem.java @@ -11,12 +11,12 @@ package com.progwml6.ironchest.common.items; import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -public class ItemChest extends ItemBlock +public class ChestItem extends BlockItem { - public ItemChest(Block block, Item.Properties properties) + public ChestItem(Block block, Item.Properties properties) { super(block, properties); diff --git a/src/main/java/com/progwml6/ironchest/common/items/ItemTooltip.java b/src/main/java/com/progwml6/ironchest/common/items/TooltipItem.java similarity index 90% rename from src/main/java/com/progwml6/ironchest/common/items/ItemTooltip.java rename to src/main/java/com/progwml6/ironchest/common/items/TooltipItem.java index ec982c5..cd96e7c 100644 --- a/src/main/java/com/progwml6/ironchest/common/items/ItemTooltip.java +++ b/src/main/java/com/progwml6/ironchest/common/items/TooltipItem.java @@ -16,7 +16,7 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; @@ -25,9 +25,9 @@ import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.util.List; -public class ItemTooltip extends Item +public class TooltipItem extends Item { - public ItemTooltip(Properties properties) + public TooltipItem(Properties properties) { super(properties); } @@ -47,14 +47,14 @@ public class ItemTooltip extends Item { for (String tooltipString : getTooltips(TextFormatting.GRAY.toString() + translateRecursive(stack.getDisplayName() + ".tooltip"))) { - tooltip.add(new TextComponentString(tooltipString)); + tooltip.add(new StringTextComponent(tooltipString)); } } else if (I18n.hasKey(stack.getDisplayName() + ".tooltip")) { for (String tooltipString : getTooltips(TextFormatting.GRAY.toString() + translateRecursive(stack.getDisplayName() + ".tooltip"))) { - tooltip.add(new TextComponentString(tooltipString)); + tooltip.add(new StringTextComponent(tooltipString)); } } } diff --git a/src/main/java/com/progwml6/ironchest/common/network/PacketHandler.java b/src/main/java/com/progwml6/ironchest/common/network/PacketHandler.java index 4f6de71..6b617ae 100644 --- a/src/main/java/com/progwml6/ironchest/common/network/PacketHandler.java +++ b/src/main/java/com/progwml6/ironchest/common/network/PacketHandler.java @@ -12,13 +12,7 @@ package com.progwml6.ironchest.common.network; import com.progwml6.ironchest.IronChest; import com.progwml6.ironchest.common.network.packets.PacketTopStackSyncChest; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fml.network.NetworkDirection; import net.minecraftforge.fml.network.NetworkRegistry; import net.minecraftforge.fml.network.PacketDistributor; import net.minecraftforge.fml.network.simple.SimpleChannel; diff --git a/src/main/java/com/progwml6/ironchest/common/network/packets/PacketTopStackSyncChest.java b/src/main/java/com/progwml6/ironchest/common/network/packets/PacketTopStackSyncChest.java index 395e1b4..64db1da 100644 --- a/src/main/java/com/progwml6/ironchest/common/network/packets/PacketTopStackSyncChest.java +++ b/src/main/java/com/progwml6/ironchest/common/network/packets/PacketTopStackSyncChest.java @@ -10,8 +10,8 @@ ******************************************************************************/ package com.progwml6.ironchest.common.network.packets; -import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest; import com.progwml6.ironchest.IronChest; +import com.progwml6.ironchest.common.tileentity.CrystalChestTileEntity; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -80,9 +80,9 @@ public class PacketTopStackSyncChest { TileEntity tile = world.getTileEntity(message.pos); - if (tile instanceof TileEntityCrystalChest) + if (tile instanceof CrystalChestTileEntity) { - ((TileEntityCrystalChest) tile).receiveMessageFromServer(message.topStacks); + ((CrystalChestTileEntity) tile).receiveMessageFromServer(message.topStacks); } } }); diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/ChestTileEntityType.java b/src/main/java/com/progwml6/ironchest/common/tileentity/ChestTileEntityType.java new file mode 100644 index 0000000..1957d3c --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/ChestTileEntityType.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.tileentity; + +import com.progwml6.ironchest.IronChest; +import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.util.TileEntityNames; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.ObjectHolder; + +import java.util.function.Supplier; + +public class ChestTileEntityType +{ + @ObjectHolder(TileEntityNames.IRON_CHEST) + public static TileEntityType IRON_CHEST; + + @ObjectHolder(TileEntityNames.GOLD_CHEST) + public static TileEntityType GOLD_CHEST; + + @ObjectHolder(TileEntityNames.DIAMOND_CHEST) + public static TileEntityType DIAMOND_CHEST; + + @ObjectHolder(TileEntityNames.CRYSTAL_CHEST) + public static TileEntityType CRYSTAL_CHEST; + + @ObjectHolder(TileEntityNames.DIRT_CHEST) + public static TileEntityType DIRT_CHEST; + + @ObjectHolder(TileEntityNames.COPPER_CHEST) + public static TileEntityType COPPER_CHEST; + + @ObjectHolder(TileEntityNames.SILVER_CHEST) + public static TileEntityType SILVER_CHEST; + + @ObjectHolder(TileEntityNames.OBSIDIAN_CHEST) + public static TileEntityType OBSIDIAN_CHEST; + + public ChestTileEntityType() + { + + } + + @Mod.EventBusSubscriber(modid = IronChest.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) + public static class Registration + { + @SubscribeEvent + public static void onTileEntityRegistry(final RegistryEvent.Register> e) + { + e.getRegistry().registerAll( + TileEntityType.Builder.create((Supplier) IronChestTileEntity::new, IronChestBlocks.ironChestBlock).build(null).setRegistryName(TileEntityNames.IRON_CHEST), + TileEntityType.Builder.create((Supplier) GoldChestTileEntity::new, IronChestBlocks.goldChestBlock).build(null).setRegistryName(TileEntityNames.GOLD_CHEST), + TileEntityType.Builder.create((Supplier) DiamondChestTileEntity::new, IronChestBlocks.diamondChestBlock).build(null).setRegistryName(TileEntityNames.DIAMOND_CHEST), + TileEntityType.Builder.create((Supplier) CrystalChestTileEntity::new, IronChestBlocks.crystalChestBlock).build(null).setRegistryName(TileEntityNames.CRYSTAL_CHEST), + TileEntityType.Builder.create((Supplier) DirtChestTileEntity::new, IronChestBlocks.dirtChestBlock).build(null).setRegistryName(TileEntityNames.DIRT_CHEST), + TileEntityType.Builder.create((Supplier) CopperChestTileEntity::new, IronChestBlocks.copperChestBlock).build(null).setRegistryName(TileEntityNames.COPPER_CHEST), + TileEntityType.Builder.create((Supplier) SilverChestTileEntity::new, IronChestBlocks.silverChestBlock).build(null).setRegistryName(TileEntityNames.SILVER_CHEST), + TileEntityType.Builder.create((Supplier) ObsidianChestTileEntity::new, IronChestBlocks.obsidianChestBlock).build(null).setRegistryName(TileEntityNames.OBSIDIAN_CHEST) + ); + } + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDiamondChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/CopperChestTileEntity.java similarity index 52% rename from src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDiamondChest.java rename to src/main/java/com/progwml6/ironchest/common/tileentity/CopperChestTileEntity.java index 564f0d6..75157d7 100644 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDiamondChest.java +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/CopperChestTileEntity.java @@ -10,20 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.tileentity; -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; -public class TileEntityDiamondChest extends TileEntityIronChest +public class CopperChestTileEntity extends IronChestTileEntity { - public TileEntityDiamondChest() + public CopperChestTileEntity() { - super(IronChestEntityType.DIAMOND_CHEST, IronChestType.DIAMOND, IronChestBlocks.diamondChestBlock); + super(ChestTileEntityType.COPPER_CHEST, ChestType.COPPER, IronChestBlocks.copperChestBlock); } @Override - public String getGuiID() + protected Container createMenu(int id, PlayerInventory playerInventory) { - return GUIChest.GUI.DIAMOND.getGuiId().toString(); + return ChestContainer.createCopperContainer(id, playerInventory, this); } } diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityCrystalChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/CrystalChestTileEntity.java similarity index 83% rename from src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityCrystalChest.java rename to src/main/java/com/progwml6/ironchest/common/tileentity/CrystalChestTileEntity.java index 0763dbb..0c22f99 100644 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityCrystalChest.java +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/CrystalChestTileEntity.java @@ -10,36 +10,40 @@ ******************************************************************************/ package com.progwml6.ironchest.common.tileentity; -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; import com.progwml6.ironchest.common.network.PacketHandler; import com.progwml6.ironchest.common.network.packets.PacketTopStackSyncChest; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.fml.network.PacketDistributor; import java.util.Collections; -public class TileEntityCrystalChest extends TileEntityIronChest +public class CrystalChestTileEntity extends IronChestTileEntity { - /** Crystal Chest top stacks */ private NonNullList topStacks; - /** If the inventory got touched */ private boolean inventoryTouched; - /** If the inventory had items */ private boolean hadStuff; - public TileEntityCrystalChest() + public CrystalChestTileEntity() { - super(IronChestEntityType.CRYSTAL_CHEST, IronChestType.CRYSTAL, IronChestBlocks.crystalChestBlock); + super(ChestTileEntityType.CRYSTAL_CHEST, ChestType.CRYSTAL, IronChestBlocks.crystalChestBlock); this.topStacks = NonNullList.withSize(8, ItemStack.EMPTY); } + @Override + protected Container createMenu(int id, PlayerInventory playerInventory) + { + return ChestContainer.createCrystalContainer(id, playerInventory, this); + } + @Override public void tick() { @@ -64,11 +68,9 @@ public class TileEntityCrystalChest extends TileEntityIronChest @Override public ItemStack getStackInSlot(int index) { - this.fillWithLoot((EntityPlayer) null); - this.inventoryTouched = true; - return this.getItems().get(index); + return super.getStackInSlot(index); } public NonNullList getTopItems() @@ -76,9 +78,9 @@ public class TileEntityCrystalChest extends TileEntityIronChest return this.topStacks; } - protected void sortTopStacks() + private void sortTopStacks() { - if (!this.getIronChestType().isTransparent() || (this.world != null && this.world.isRemote)) + if (!this.getChestType().isTransparent() || (this.world != null && this.world.isRemote)) { return; } @@ -130,7 +132,7 @@ public class TileEntityCrystalChest extends TileEntityIronChest if (this.world != null) { - IBlockState iblockstate = this.world.getBlockState(this.pos); + BlockState iblockstate = this.world.getBlockState(this.pos); this.world.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3); } @@ -179,7 +181,7 @@ public class TileEntityCrystalChest extends TileEntityIronChest if (this.world != null) { - IBlockState iblockstate = this.world.getBlockState(this.pos); + BlockState iblockstate = this.world.getBlockState(this.pos); this.world.notifyBlockUpdate(this.pos, iblockstate, iblockstate, 3); } @@ -189,7 +191,7 @@ public class TileEntityCrystalChest extends TileEntityIronChest public NonNullList buildItemStackDataList() { - if (this.getIronChestType().isTransparent()) + if (this.getChestType().isTransparent()) { NonNullList sortList = NonNullList.withSize(this.getTopItems().size(), ItemStack.EMPTY); @@ -226,10 +228,4 @@ public class TileEntityCrystalChest extends TileEntityIronChest { this.topStacks = topStacks; } - - @Override - public String getGuiID() - { - return GUIChest.GUI.CRYSTAL.getGuiId().toString(); - } } diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityObsidianChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/DiamondChestTileEntity.java similarity index 52% rename from src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityObsidianChest.java rename to src/main/java/com/progwml6/ironchest/common/tileentity/DiamondChestTileEntity.java index 7c41e98..30c95be 100644 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityObsidianChest.java +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/DiamondChestTileEntity.java @@ -10,20 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.tileentity; -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; -public class TileEntityObsidianChest extends TileEntityIronChest +public class DiamondChestTileEntity extends IronChestTileEntity { - public TileEntityObsidianChest() + public DiamondChestTileEntity() { - super(IronChestEntityType.OBSIDIAN_CHEST, IronChestType.OBSIDIAN, IronChestBlocks.obsidianChestBlock); + super(ChestTileEntityType.DIAMOND_CHEST, ChestType.DIAMOND, IronChestBlocks.diamondChestBlock); } @Override - public String getGuiID() + protected Container createMenu(int id, PlayerInventory playerInventory) { - return GUIChest.GUI.OBSIDIAN.getGuiId().toString(); + return ChestContainer.createDiamondContainer(id, playerInventory, this); } } diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/DirtChestTileEntity.java b/src/main/java/com/progwml6/ironchest/common/tileentity/DirtChestTileEntity.java new file mode 100644 index 0000000..92dc125 --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/DirtChestTileEntity.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.tileentity; + +import com.progwml6.ironchest.common.blocks.ChestType; +import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.nbt.ListNBT; +import net.minecraft.nbt.StringNBT; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; + +public class DirtChestTileEntity extends IronChestTileEntity +{ + private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.WRITTEN_BOOK); + + private static boolean bookDataCreated = false; + + public DirtChestTileEntity() + { + super(ChestTileEntityType.DIRT_CHEST, ChestType.DIRTCHEST9000, IronChestBlocks.dirtChestBlock); + } + + @Override + protected Container createMenu(int id, PlayerInventory playerInventory) + { + return ChestContainer.createDirtContainer(id, playerInventory, this); + } + + @Override + public void wasPlaced(LivingEntity entityLivingBase, ItemStack itemStack) + { + if (!(itemStack.hasTag() && itemStack.getTag().getBoolean("been_placed"))) + { + this.setInventorySlotContents(0, dirtChest9000GuideBook.copy()); + } + + if (!bookDataCreated) + { + createBookData(); + } + } + + @Override + public void removeAdornments() + { + if (!this.getItems().get(0).isEmpty() && this.getItems().get(0).isItemEqual(dirtChest9000GuideBook)) + { + this.getItems().set(0, ItemStack.EMPTY); + } + } + + private static void createBookData() + { + dirtChest9000GuideBook.setTagInfo("author", new StringNBT("cpw")); + + dirtChest9000GuideBook.setTagInfo("title", new StringNBT(I18n.format("book.ironchest.dirtchest9000.title"))); + + ListNBT pages = new ListNBT(); + pages.add(new StringNBT(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page1")))); + pages.add(new StringNBT(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page2")))); + pages.add(new StringNBT(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page3")))); + pages.add(new StringNBT(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page4")))); + pages.add(new StringNBT(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page5")))); + + dirtChest9000GuideBook.setTagInfo("pages", pages); + + bookDataCreated = true; + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityCopperChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/GoldChestTileEntity.java similarity index 53% rename from src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityCopperChest.java rename to src/main/java/com/progwml6/ironchest/common/tileentity/GoldChestTileEntity.java index 72c6336..32bfd31 100644 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityCopperChest.java +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/GoldChestTileEntity.java @@ -10,20 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.tileentity; -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; -public class TileEntityCopperChest extends TileEntityIronChest +public class GoldChestTileEntity extends IronChestTileEntity { - public TileEntityCopperChest() + public GoldChestTileEntity() { - super(IronChestEntityType.COPPER_CHEST, IronChestType.COPPER, IronChestBlocks.copperChestBlock); + super(ChestTileEntityType.GOLD_CHEST, ChestType.GOLD, IronChestBlocks.goldChestBlock); } @Override - public String getGuiID() + protected Container createMenu(int id, PlayerInventory playerInventory) { - return GUIChest.GUI.COPPER.getGuiId().toString(); + return ChestContainer.createGoldContainer(id, playerInventory, this); } } diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/IronChestEntityType.java b/src/main/java/com/progwml6/ironchest/common/tileentity/IronChestEntityType.java deleted file mode 100644 index 380d5f4..0000000 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/IronChestEntityType.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.tileentity; - -import com.mojang.datafixers.DataFixUtils; -import com.mojang.datafixers.types.Type; -import com.progwml6.ironchest.common.util.TileEntityNames; -import com.progwml6.ironchest.IronChest; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SharedConstants; -import net.minecraft.util.datafix.DataFixesManager; -import net.minecraft.util.datafix.TypeReferences; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.IForgeRegistryEntry; -import net.minecraftforge.registries.ObjectHolder; - -public class IronChestEntityType -{ - @ObjectHolder(TileEntityNames.IRON_CHEST) - public static TileEntityType IRON_CHEST; - - @ObjectHolder(TileEntityNames.GOLD_CHEST) - public static TileEntityType GOLD_CHEST; - - @ObjectHolder(TileEntityNames.DIAMOND_CHEST) - public static TileEntityType DIAMOND_CHEST; - - @ObjectHolder(TileEntityNames.CRYSTAL_CHEST) - public static TileEntityType CRYSTAL_CHEST; - - @ObjectHolder(TileEntityNames.DIRT_CHEST) - public static TileEntityType DIRT_CHEST; - - @ObjectHolder(TileEntityNames.COPPER_CHEST) - public static TileEntityType COPPER_CHEST; - - @ObjectHolder(TileEntityNames.SILVER_CHEST) - public static TileEntityType SILVER_CHEST; - - @ObjectHolder(TileEntityNames.OBSIDIAN_CHEST) - public static TileEntityType OBSIDIAN_CHEST; - - public IronChestEntityType() - { - - } - - @Mod.EventBusSubscriber(modid = IronChest.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) - public static class Registration - { - @SubscribeEvent - public static void onTileEntityRegistry(final RegistryEvent.Register> e) - { - registerTileEntityType(e.getRegistry(), register("iron_chest", TileEntityType.Builder.create(TileEntityIronChest::new)), TileEntityNames.IRON_CHEST); - registerTileEntityType(e.getRegistry(), register("gold_chest", TileEntityType.Builder.create(TileEntityGoldChest::new)), TileEntityNames.GOLD_CHEST); - registerTileEntityType(e.getRegistry(), register("diamond_chest", TileEntityType.Builder.create(TileEntityDiamondChest::new)), TileEntityNames.DIAMOND_CHEST); - registerTileEntityType(e.getRegistry(), register("crystal_chest", TileEntityType.Builder.create(TileEntityCrystalChest::new)), TileEntityNames.CRYSTAL_CHEST); - registerTileEntityType(e.getRegistry(), register("dirt_chest", TileEntityType.Builder.create(TileEntityDirtChest::new)), TileEntityNames.DIRT_CHEST); - registerTileEntityType(e.getRegistry(), register("copper_chest", TileEntityType.Builder.create(TileEntityCopperChest::new)), TileEntityNames.COPPER_CHEST); - registerTileEntityType(e.getRegistry(), register("silver_chest", TileEntityType.Builder.create(TileEntitySilverChest::new)), TileEntityNames.SILVER_CHEST); - registerTileEntityType(e.getRegistry(), register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)), TileEntityNames.OBSIDIAN_CHEST); - } - } - - protected static > T registerTileEntityType(IForgeRegistry> registry, T tileEntityType, String name) - { - register(registry, tileEntityType, new ResourceLocation(name)); - return tileEntityType; - } - - protected static > T register(IForgeRegistry registry, T thing, ResourceLocation name) - { - thing.setRegistryName(name); - registry.register(thing); - return thing; - } - - public static TileEntityType register(String id, TileEntityType.Builder builder) - { - Type type = null; - - try - { - type = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(1519)).getChoiceType(TypeReferences.BLOCK_ENTITY, id); - } - catch (IllegalArgumentException illegalstateexception) - { - if (SharedConstants.developmentMode) - { - throw illegalstateexception; - } - } - - TileEntityType tileEntityType = builder.build(type); - return tileEntityType; - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityIronChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/IronChestTileEntity.java similarity index 52% rename from src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityIronChest.java rename to src/main/java/com/progwml6/ironchest/common/tileentity/IronChestTileEntity.java index 73d6c3c..2a52302 100644 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityIronChest.java +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/IronChestTileEntity.java @@ -10,86 +10,71 @@ ******************************************************************************/ package com.progwml6.ironchest.common.tileentity; -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.BlockChest; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestBlock; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.core.IronChestBlocks; -import com.progwml6.ironchest.common.gui.ContainerIronChest; +import com.progwml6.ironchest.common.inventory.ChestContainer; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.SoundEvents; -import net.minecraft.inventory.Container; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.ItemStackHelper; +import net.minecraft.inventory.container.Container; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.IChestLid; +import net.minecraft.tileentity.ITickableTileEntity; +import net.minecraft.tileentity.LockableLootTileEntity; +import net.minecraft.tileentity.LockableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityLockableLoot; import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public class TileEntityIronChest extends TileEntityLockableLoot implements IChestLid, ITickable +@OnlyIn( + value = Dist.CLIENT, + _interface = IChestLid.class +) +public class IronChestTileEntity extends LockableLootTileEntity implements IChestLid, ITickableTileEntity { private NonNullList chestContents; - /** The current angle of the lid (between 0 and 1) */ protected float lidAngle; - /** The angle of the lid last tick */ protected float prevLidAngle; - /** The number of players currently using this chest */ protected int numPlayersUsing; - /** - * A counter that is incremented once each tick. Used to determine when to recompute {@link #numPlayersUsing}; this - * is done every 200 ticks (but staggered between different chests). However, the new value isn't actually sent to - * clients when it is changed. - */ private int ticksSinceSync; - private IronChestType chestType; + private ChestType chestType; private Block blockToUse; - public TileEntityIronChest() - { - this(IronChestEntityType.IRON_CHEST, IronChestType.IRON, IronChestBlocks.ironChestBlock); - } - - protected TileEntityIronChest(TileEntityType typeIn, IronChestType chestTypeIn, Block blockToUseIn) + protected IronChestTileEntity(TileEntityType typeIn, ChestType chestTypeIn, Block blockToUseIn) { super(typeIn); - this.chestType = chestTypeIn; + this.chestContents = NonNullList.withSize(chestTypeIn.size, ItemStack.EMPTY); + this.chestType = chestTypeIn; this.blockToUse = blockToUseIn; } - @Override - public void setItems(NonNullList contents) + public IronChestTileEntity() { - this.chestContents = NonNullList.withSize(this.getIronChestType().size, ItemStack.EMPTY); - - for (int i = 0; i < contents.size(); i++) - { - if (i < this.chestContents.size()) - { - this.getItems().set(i, contents.get(i)); - } - } + this(ChestTileEntityType.IRON_CHEST, ChestType.IRON, IronChestBlocks.ironChestBlock); } @Override @@ -98,240 +83,6 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements IChes return this.getItems().size(); } - public IronChestType getIronChestType() - { - IronChestType type = IronChestType.IRON; - - if (this.hasWorld()) - { - IronChestType typeNew = BlockChest.getTypeFromBlock(this.getBlockState().getBlock()); - - if (typeNew != null) - { - type = typeNew; - } - } - - return type; - } - - @Override - public ItemStack getStackInSlot(int index) - { - this.fillWithLoot((EntityPlayer) null); - - return this.getItems().get(index); - } - - @Override - public void markDirty() - { - super.markDirty(); - } - - @Override - public void tick() - { - int i = this.pos.getX(); - int j = this.pos.getY(); - int k = this.pos.getZ(); - ++this.ticksSinceSync; - if (!this.world.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + i + j + k) % 200 == 0) - { - this.numPlayersUsing = 0; - - for (EntityPlayer entityplayer : this.world - .getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(i - 5.0F, j - 5.0F, k - 5.0F, i + 1 + 5.0F, j + 1 + 5.0F, k + 1 + 5.0F))) - { - if (entityplayer.openContainer instanceof ContainerIronChest) - { - ++this.numPlayersUsing; - } - } - } - - this.prevLidAngle = this.lidAngle; - - if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F) - { - this.playSound(SoundEvents.BLOCK_CHEST_OPEN); - } - - if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) - { - float f2 = this.lidAngle; - if (this.numPlayersUsing > 0) - { - this.lidAngle += 0.1F; - } - else - { - this.lidAngle -= 0.1F; - } - - if (this.lidAngle > 1.0F) - { - this.lidAngle = 1.0F; - } - - if (this.lidAngle < 0.5F && f2 >= 0.5F) - { - this.playSound(SoundEvents.BLOCK_CHEST_CLOSE); - } - - if (this.lidAngle < 0.0F) - { - this.lidAngle = 0.0F; - } - } - } - - private void playSound(SoundEvent soundIn) - { - double d0 = this.pos.getX() + 0.5D; - double d1 = this.pos.getY() + 0.5D; - double d2 = this.pos.getZ() + 0.5D; - - this.world.playSound((EntityPlayer) null, d0, d1, d2, soundIn, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F); - } - - @Override - public ITextComponent getName() - { - ITextComponent itextcomponent = this.getCustomName(); - return itextcomponent != null ? itextcomponent : new TextComponentTranslation(this.getIronChestType().name(), new Object[0]); - } - - @Override - public void read(NBTTagCompound compound) - { - super.read(compound); - - this.chestContents = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY); - - if (!this.checkLootAndRead(compound)) - { - ItemStackHelper.loadAllItems(compound, this.chestContents); - } - - if (compound.contains("CustomName", 8)) - { - this.customName = ITextComponent.Serializer.fromJson(compound.getString("CustomName")); - } - } - - @Override - public NBTTagCompound write(NBTTagCompound compound) - { - super.write(compound); - if (!this.checkLootAndWrite(compound)) - { - ItemStackHelper.saveAllItems(compound, this.chestContents); - } - - ITextComponent itextcomponent = this.getCustomName(); - if (itextcomponent != null) - { - compound.putString("CustomName", ITextComponent.Serializer.toJson(itextcomponent)); - } - - return compound; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * See {@link Block#eventReceived} for more information. This must return true serverside before it is called - * clientside. - */ - @Override - public boolean receiveClientEvent(int id, int type) - { - if (id == 1) - { - this.numPlayersUsing = type; - return true; - } - else - { - return super.receiveClientEvent(id, type); - } - } - - @Override - public void openInventory(EntityPlayer player) - { - if (!player.isSpectator()) - { - if (this.numPlayersUsing < 0) - { - this.numPlayersUsing = 0; - } - - ++this.numPlayersUsing; - this.onOpenOrClose(); - } - } - - @Override - public void closeInventory(EntityPlayer player) - { - if (!player.isSpectator()) - { - --this.numPlayersUsing; - this.onOpenOrClose(); - } - } - - protected void onOpenOrClose() - { - Block block = this.getBlockState().getBlock(); - - if (block instanceof BlockChest) - { - this.world.addBlockEvent(this.pos, block, 1, this.numPlayersUsing); - this.world.notifyNeighborsOfStateChange(this.pos, block); - } - } - - @Override - public boolean isItemValidForSlot(int index, ItemStack stack) - { - return this.getIronChestType().acceptsStack(stack); - } - - public void wasPlaced(EntityLivingBase entityliving, ItemStack stack) - { - } - - public void removeAdornments() - { - } - - @Override - public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) - { - this.fillWithLoot(playerIn); - - return new ContainerIronChest(playerInventory, this, this.chestType, playerIn, this.chestType.xSize, this.chestType.ySize); - } - - @Override - public String getGuiID() - { - return GUIChest.GUI.IRON.getGuiId().toString(); - } - - @Override - public NonNullList getItems() - { - return this.chestContents; - } - @Override public boolean isEmpty() { @@ -346,28 +97,241 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements IChes return true; } + @Override + protected ITextComponent getDefaultName() + { + return new TranslationTextComponent("container.chest"); + } + + @Override + public void read(CompoundNBT compound) + { + super.read(compound); + + this.chestContents = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY); + + if (!this.checkLootAndRead(compound)) + { + ItemStackHelper.loadAllItems(compound, this.chestContents); + } + } + + @Override + public CompoundNBT write(CompoundNBT compound) + { + super.write(compound); + + if (!this.checkLootAndWrite(compound)) + { + ItemStackHelper.saveAllItems(compound, this.chestContents); + } + + return compound; + } + + @Override + public void tick() + { + int i = this.pos.getX(); + int j = this.pos.getY(); + int k = this.pos.getZ(); + ++this.ticksSinceSync; + this.numPlayersUsing = getNumberOfPlayersUsing(this.world, this, this.ticksSinceSync, i, j, k, this.numPlayersUsing); + this.prevLidAngle = this.lidAngle; + float f = 0.1F; + if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F) + { + this.playSound(SoundEvents.BLOCK_CHEST_OPEN); + } + + if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) + { + float f1 = this.lidAngle; + if (this.numPlayersUsing > 0) + { + this.lidAngle += 0.1F; + } + else + { + this.lidAngle -= 0.1F; + } + + if (this.lidAngle > 1.0F) + { + this.lidAngle = 1.0F; + } + + float f2 = 0.5F; + if (this.lidAngle < 0.5F && f1 >= 0.5F) + { + this.playSound(SoundEvents.BLOCK_CHEST_CLOSE); + } + + if (this.lidAngle < 0.0F) + { + this.lidAngle = 0.0F; + } + } + + } + + public static int getNumberOfPlayersUsing(World worldIn, LockableTileEntity lockableTileEntity, int ticksSinceSync, int x, int y, int z, int numPlayersUsing) + { + if (!worldIn.isRemote && numPlayersUsing != 0 && (ticksSinceSync + x + y + z) % 200 == 0) + { + numPlayersUsing = getNumberOfPlayersUsing(worldIn, lockableTileEntity, x, y, z); + } + + return numPlayersUsing; + } + + public static int getNumberOfPlayersUsing(World world, LockableTileEntity lockableTileEntity, int x, int y, int z) + { + int i = 0; + + for (PlayerEntity playerentity : world.getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB((double) ((float) x - 5.0F), (double) ((float) y - 5.0F), (double) ((float) z - 5.0F), (double) ((float) (x + 1) + 5.0F), (double) ((float) (y + 1) + 5.0F), (double) ((float) (z + 1) + 5.0F)))) + { + if (playerentity.openContainer instanceof ChestContainer) + { + ++i; + } + } + + return i; + } + + private void playSound(SoundEvent soundIn) + { + double d0 = (double) this.pos.getX() + 0.5D; + double d1 = (double) this.pos.getY() + 0.5D; + double d2 = (double) this.pos.getZ() + 0.5D; + + this.world.playSound((PlayerEntity) null, d0, d1, d2, soundIn, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F); + } + + @Override + public boolean receiveClientEvent(int id, int type) + { + if (id == 1) + { + this.numPlayersUsing = type; + return true; + } + else + { + return super.receiveClientEvent(id, type); + } + } + + @Override + public void openInventory(PlayerEntity player) + { + if (!player.isSpectator()) + { + if (this.numPlayersUsing < 0) + { + this.numPlayersUsing = 0; + } + + ++this.numPlayersUsing; + this.onOpenOrClose(); + } + } + + @Override + public void closeInventory(PlayerEntity player) + { + if (!player.isSpectator()) + { + --this.numPlayersUsing; + this.onOpenOrClose(); + } + } + + protected void onOpenOrClose() + { + Block block = this.getBlockState().getBlock(); + + if (block instanceof ChestBlock) + { + this.world.addBlockEvent(this.pos, block, 1, this.numPlayersUsing); + this.world.notifyNeighborsOfStateChange(this.pos, block); + } + } + + @Override + public NonNullList getItems() + { + return this.chestContents; + } + + @Override + public void setItems(NonNullList itemsIn) + { + this.chestContents = NonNullList.withSize(this.getChestType().size, ItemStack.EMPTY); + + for (int i = 0; i < itemsIn.size(); i++) + { + if (i < this.chestContents.size()) + { + this.getItems().set(i, itemsIn.get(i)); + } + } + } + @Override @OnlyIn(Dist.CLIENT) public float getLidAngle(float partialTicks) { - return this.prevLidAngle + (this.lidAngle - this.prevLidAngle) * partialTicks; + return MathHelper.func_219799_g(partialTicks, this.prevLidAngle, this.lidAngle); } public static int getPlayersUsing(IBlockReader reader, BlockPos posIn) { - IBlockState iblockstate = reader.getBlockState(posIn); - if (iblockstate.hasTileEntity()) + BlockState blockstate = reader.getBlockState(posIn); + if (blockstate.hasTileEntity()) { TileEntity tileentity = reader.getTileEntity(posIn); - if (tileentity instanceof TileEntityIronChest) + if (tileentity instanceof IronChestTileEntity) { - return ((TileEntityIronChest) tileentity).numPlayersUsing; + return ((IronChestTileEntity) tileentity).numPlayersUsing; } } return 0; } + @Override + protected Container createMenu(int windowId, PlayerInventory playerInventory) + { + return ChestContainer.createIronContainer(windowId, playerInventory, this); + } + + public void wasPlaced(LivingEntity entityliving, ItemStack stack) + { + } + + public void removeAdornments() + { + } + + public ChestType getChestType() + { + ChestType type = ChestType.IRON; + + if (this.hasWorld()) + { + ChestType typeNew = ChestBlock.getTypeFromBlock(this.getBlockState().getBlock()); + + if (typeNew != null) + { + type = typeNew; + } + } + + return type; + } + public Block getBlockToUse() { return this.blockToUse; diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/ObsidianChestTileEntity.java b/src/main/java/com/progwml6/ironchest/common/tileentity/ObsidianChestTileEntity.java new file mode 100644 index 0000000..00b3eec --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/ObsidianChestTileEntity.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.tileentity; + +import com.progwml6.ironchest.common.blocks.ChestType; +import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; + +public class ObsidianChestTileEntity extends IronChestTileEntity +{ + public ObsidianChestTileEntity() + { + super(ChestTileEntityType.OBSIDIAN_CHEST, ChestType.OBSIDIAN, IronChestBlocks.obsidianChestBlock); + } + + @Override + protected Container createMenu(int id, PlayerInventory playerInventory) + { + return ChestContainer.createObsidianContainer(id, playerInventory, this); + } +} diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityGoldChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/SilverChestTileEntity.java similarity index 52% rename from src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityGoldChest.java rename to src/main/java/com/progwml6/ironchest/common/tileentity/SilverChestTileEntity.java index dfe597f..dba55e6 100644 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityGoldChest.java +++ b/src/main/java/com/progwml6/ironchest/common/tileentity/SilverChestTileEntity.java @@ -10,20 +10,22 @@ ******************************************************************************/ package com.progwml6.ironchest.common.tileentity; -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; +import com.progwml6.ironchest.common.blocks.ChestType; import com.progwml6.ironchest.common.core.IronChestBlocks; +import com.progwml6.ironchest.common.inventory.ChestContainer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; -public class TileEntityGoldChest extends TileEntityIronChest +public class SilverChestTileEntity extends IronChestTileEntity { - public TileEntityGoldChest() + public SilverChestTileEntity() { - super(IronChestEntityType.GOLD_CHEST, IronChestType.GOLD, IronChestBlocks.goldChestBlock); + super(ChestTileEntityType.SILVER_CHEST, ChestType.SILVER, IronChestBlocks.silverChestBlock); } @Override - public String getGuiID() + protected Container createMenu(int id, PlayerInventory playerInventory) { - return GUIChest.GUI.GOLD.getGuiId().toString(); + return ChestContainer.createSilverContainer(id, playerInventory, this); } -} +} \ No newline at end of file diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDirtChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDirtChest.java deleted file mode 100644 index 31ceab4..0000000 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntityDirtChest.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.tileentity; - -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; -import com.progwml6.ironchest.common.core.IronChestBlocks; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; - -public class TileEntityDirtChest extends TileEntityIronChest -{ - private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.WRITTEN_BOOK); - - private static boolean bookDataCreated = false; - - public TileEntityDirtChest() - { - super(IronChestEntityType.DIRT_CHEST, IronChestType.DIRTCHEST9000, IronChestBlocks.dirtChestBlock); - } - - @Override - public void wasPlaced(EntityLivingBase entityLivingBase, ItemStack itemStack) - { - if (!(itemStack.hasTag() && itemStack.getTag().getBoolean("dirtchest"))) - { - this.setInventorySlotContents(0, dirtChest9000GuideBook.copy()); - } - - if (!bookDataCreated) - { - createBookData(); - } - } - - @Override - public void removeAdornments() - { - if (!this.getItems().get(0).isEmpty() && this.getItems().get(0).isItemEqual(dirtChest9000GuideBook)) - { - this.getItems().set(0, ItemStack.EMPTY); - } - } - - public static void createBookData() - { - dirtChest9000GuideBook.setTagInfo("author", new NBTTagString("cpw")); - - dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(I18n.format("book.ironchest.dirtchest9000.title"))); - - NBTTagList pages = new NBTTagList(); - pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page1")))); - pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page2")))); - pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page3")))); - pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page4")))); - pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page5")))); - - dirtChest9000GuideBook.setTagInfo("pages", pages); - - bookDataCreated = true; - } - - @Override - public String getGuiID() - { - return GUIChest.GUI.DIRTCHEST9000.getGuiId().toString(); - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntitySilverChest.java b/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntitySilverChest.java deleted file mode 100644 index 3704401..0000000 --- a/src/main/java/com/progwml6/ironchest/common/tileentity/TileEntitySilverChest.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html - *

- * Contributors: - * cpw - initial API and implementation - ******************************************************************************/ -package com.progwml6.ironchest.common.tileentity; - -import com.progwml6.ironchest.client.gui.GUIChest; -import com.progwml6.ironchest.common.blocks.IronChestType; -import com.progwml6.ironchest.common.core.IronChestBlocks; - -public class TileEntitySilverChest extends TileEntityIronChest -{ - public TileEntitySilverChest() - { - super(IronChestEntityType.SILVER_CHEST, IronChestType.SILVER, IronChestBlocks.silverChestBlock); - } - - @Override - public String getGuiID() - { - return GUIChest.GUI.SILVER.getGuiId().toString(); - } -} diff --git a/src/main/java/com/progwml6/ironchest/common/util/ContainerNames.java b/src/main/java/com/progwml6/ironchest/common/util/ContainerNames.java new file mode 100644 index 0000000..e80c3ff --- /dev/null +++ b/src/main/java/com/progwml6/ironchest/common/util/ContainerNames.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2012 cpw. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + *

+ * Contributors: + * cpw - initial API and implementation + ******************************************************************************/ +package com.progwml6.ironchest.common.util; + +import com.progwml6.ironchest.IronChest; + +public class ContainerNames +{ + public static final String IRON_CHEST = IronChest.MOD_ID + ":iron_chest"; + + public static final String GOLD_CHEST = IronChest.MOD_ID + ":gold_chest"; + + public static final String DIAMOND_CHEST = IronChest.MOD_ID + ":diamond_chest"; + + public static final String COPPER_CHEST = IronChest.MOD_ID + ":copper_chest"; + + public static final String SILVER_CHEST = IronChest.MOD_ID + ":silver_chest"; + + public static final String CRYSTAL_CHEST = IronChest.MOD_ID + ":crystal_chest"; + + public static final String OBSIDIAN_CHEST = IronChest.MOD_ID + ":obsidian_chest"; + + public static final String DIRT_CHEST = IronChest.MOD_ID + ":dirt_chest"; +} diff --git a/src/main/resources/assets/ironchest/textures/gui/copper_container.png b/src/main/resources/assets/ironchest/textures/gui/copper_container.png index 2fdb824efcb80fa10626b46874f548ffd7e92fcf..41197b8d9a2fb472d80183641309a9271209b1d7 100644 GIT binary patch literal 1513 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6-2GbExU!q>+tIX_n~F(p4K zRj(qq04UGEU}IlVkeHmETB4AYnx2_wtMq>NekFy>6kDZmQ(pt$0_W6>OpmIf)Zi+= zkmRcDWXlvKdpj8?t&$_iLWKz5 z00rm#qErP_Ju}^8LlYwfb4xu#GXq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5{u diff --git a/src/main/resources/assets/ironchest/textures/gui/diamond_container.png b/src/main/resources/assets/ironchest/textures/gui/diamond_container.png index b53f47299173ac9ea4e8c7f6271a880e41ad3909..cdcafc91097af8b7001877bdb4c70a0dd2322e16 100644 GIT binary patch literal 1743 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5ML5`i)DhDcuYnxz%#etZ2wxwo@hD&O3a#3bMNoIbY0?5q7r2NtnTO}oZkR|$1TY%ovhx-r6frn6P9xzyn zfc~E+lklE_fz{sA#WAE}&fB|peWNo)+Ah{E3K6}vKv3mZf#Nd0pldU`HD=AsFyZ+5 zyyi#bYd+4s1&`Tp3*El`Cs#fp_4Zn}@3r55v`@{wZC3o0qehy)?uXF5`}fn={qd=t zZO`=K^YioB@0i1jtmdYrJ*%-hAMPhU_%A~1*RTKl?OWRMzPa{geLwPJ^cfX= z7>Gr0g1(@u}SwJ&PbBs5?|7~Y1UvIOc+o9~uoxJCZyB(Ha&P+=?_x$sj z^~c{GjbYi8oIX)jys=@o5CexWaj01EMBiN3vc3mO6J)Ks-|XN>Iqp|++*RShIu?dQ zL?VdAbCp4w&na2!G2PrKe6LWDV}~|lg8`99yz$MA$duuH0sS=RmMKq=y1`f=9<%xg;|kNFj+FSYO5{=k;FtO3bE(ck0_WKB`T@(Wy==E-mx!ZU&CmK%047nGnPXm+0r2?Ya=TAlBGst$(l7I zL>No9gm5xMS>{sr-oMT{_x_&e_q^}(e82DeewObaZ^C&CLuQ5(3;+OTV3AP2;f-Ont4npaRyqiCE4QQAt61Hj{Y4yfH4T7IuAo8vd@_ zc|HJ^DW*FNqjd9vPm-da#^34Loe6*HJ<_oKsqf(B2hGJYGOnhdt{KXdW~5-H zgk>t$J;nYpy0g7wW?n`+ib2E=ut96w1OxYlAz&v`UHz<3Gu>+d2^nI9f@bsVX4#W* z6xLc#z*7yB^7|h%6OEqH+?R<%;xj6D>u^#bxebp}*8m z8-SUh$bkbXc+Cl{8ZFl6;K`Xa8qdp&xi_{GJ*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>{c?`}i4 zOOL?-7@!7V7ioVBF0s$J!Z4sy^p!7L=UFjSo~<*f4CfxpXalbCk3!caz$yva)=Bd2 zgJ^{3CgZmnAj?pI12|WM0D$~GxWr(@=gFfpl=}@3ry?wr2^APhz<(DOl^_%NLSC34 zg!tbx|Khr&{QzP@eU+?-D+&`#xq0=d=b>|fJ|^mg#oy4M6BA%_p#S{&AIN1v0XTII z`GL(_NeQsPY`iaxYY`uE=ZacGup?jN5?6B2f35$V;<6{G4^6Luzx>DZ&FIxY8}Ri1 zD}hHN1T1t;X85NCr*GD;=au0C6RTS?(nr_yYrdR&IOv@h>|C}Hs<)6lGOa;(Dtj@`v|EcG(+o&$g9JR@2kJuCt^(Os; zw55)2_FK*LU;SU!a2fmyDXGW#v~2h?WRChWO#YdW*VOai&Tf`*pX{1*F5(({z)x_p zNJfHTq*)eY1tRqY=B19~k` Aj{pDw diff --git a/src/main/resources/assets/ironchest/textures/gui/silver_container.png b/src/main/resources/assets/ironchest/textures/gui/silver_container.png index 65179f2a98efe9dd2ec5767084150ef3f11fc6a5..b182f90df9ca8433cffee47142c8595abe5b66be 100644 GIT binary patch literal 1693 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5ML5`i)DhDcuYnxz%#etZ2wxwo@hD&O3a#3bMNoIbY0?5q7r2NtnTO}oZkR|$1TY%ovhx-r6frn6P9xzyn zfc~E+lklE_ftAnau zMZfD#OWWJp*8Y&Sv$H#Q`gFIfb^YGYA3l6|D0}aYNW;wS{~P)%>gwiApDu1)_OI%A z{@QhqRT)}1iAHxz_#b@ySU7L~eEUCsZ*M%bo0Im;qAxk^-v7@J^q6k$Y@hpGk7@4t z=QC&SjL|dBkAM89vD=|++wDTZ4B7Jx3O+=mGp-8Ox8H8)gXGt-{fV-0-9Sg)%scM7pwx!B!GMuy1lE7p3a&ebWz*)nK*znVU}H#RA{v49x0k|o z@8C#D-wkx!wU0auhggV4VEufr;kpY2Pn;{W)?-@xSd!?N1jhMJu}#K#_+Z!*zq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1>ST8%FABey1c*E9559C{rY^C&0_JM;C%_I+mBb<)&qt6sl2JFR65$s&4U~A zQk3HxCcU$Xfi6J(+3-z;smBhZx1rr#0AOwT`GUA4jIqZi*w4sJ4?G2e($d4bzHc2{ zbo@rT+Ni+EwW-0l1!MN;!BIKO33myOhz)PS%ly9R$wJpG7t$z-ulW5k;@Z)PeR51$ z%$aUYkMO&v@6k~-ivDmsJiPmeS{$QIH?!4oRufY#881G`Vgbz3{B=(w6!yaZ?X1c9 ze1rg-1&tR1w7UQX0d&Bp_OW#8u75)mwb_Ti2hs2UW_`7xd3J!FWD~$Ls5Qp^4 zc-(p&!y@#*eEV~@-}7mK9q6i3@5K233LScQ-2W%=f2;szSWmF?csn#fzYy3REXcrC z&`?xb$fc#EdlEl!@!lRa_v`4n_4knf#N{_RsvlsLI6t+T>J?aJyq14r<>snzaw+L- zFip`lt;l#~|7U8_G(q713Wwl7H+=xa6aM7|B@g;5_;9!tievXq=+*_^5U*blP7e4d z2)~K=C4R#O_2%d_uZK=f_;E1E9czpKAv~;RN46 z9`buBzs3I^3@mFMslS8ccl*UMf_L31JetdUw^>znOkMbda8E+!VimM=X{B~ u3Kv=6!0aX!T(f6*afSNxC-QF(c$-H|td2TFkPrCTW29%UTcLCP!9M`bjC(i$ diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/copper_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/copper_chest.json new file mode 100644 index 0000000..27d00f0 --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/copper_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:copper_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:copper_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/crystal_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/crystal_chest.json new file mode 100644 index 0000000..9613472 --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/crystal_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:crystal_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:crystal_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/diamond_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/diamond_chest.json new file mode 100644 index 0000000..00ee9e4 --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/diamond_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:diamond_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:diamond_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/dirt_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/dirt_chest.json new file mode 100644 index 0000000..c8db1bf --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/dirt_chest.json @@ -0,0 +1,30 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:dirt_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "function": "minecraft:set_nbt", + "tag": "{been_placed:1}" + } + ], + "name": "ironchest:dirt_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/gold_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/gold_chest.json new file mode 100644 index 0000000..9691196 --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/gold_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:gold_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:gold_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/iron_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/iron_chest.json new file mode 100644 index 0000000..f1448bc --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/iron_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:iron_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:iron_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/obsidian_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/obsidian_chest.json new file mode 100644 index 0000000..f348abe --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/obsidian_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:obsidian_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:obsidian_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/loot_tables/blocks/silver_chest.json b/src/main/resources/data/ironchest/loot_tables/blocks/silver_chest.json new file mode 100644 index 0000000..6d53666 --- /dev/null +++ b/src/main/resources/data/ironchest/loot_tables/blocks/silver_chest.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "ironchest:silver_chest", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "ironchest:silver_chest" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/_constants.json b/src/main/resources/data/ironchest/recipes/_constants.json deleted file mode 100644 index 109ccd2..0000000 --- a/src/main/resources/data/ironchest/recipes/_constants.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "name": "ironchest:iron", - "tag": "forge:ingots/iron" - }, - { - "name": "ironchest:gold", - "tag": "forge:ingots/gold" - }, - { - "name": "ironchest:diamond", - "tag": "forge:gems/diamond" - }, - { - "name": "ironchest:copper", - "tag": "forge:gems/lapis", - "_comment": "replaceme" - }, - { - "name": "ironchest:silver", - "tag": "forge:ingots/nether_brick", - "_comment": "replaceme" - }, - { - "name": "ironchest:glass", - "tag": "forge:storage_blocks", - "_comment": "replaceme" - }, - { - "name": "ironchest:planks", - "tag": "minecraft:planks" - }, - { - "name": "ironchest:chest", - "tag": "forge:chests/wooden" - }, - { - "name": "ironchest:obsidian", - "item": { - "item": "minecraft:obsidian" - } - }, - { - "name": "ironchest:dirt", - "items": [ - { - "item": "minecraft:dirt" - }, - { - "item": "minecraft:coarse_dirt" - }, - { - "item": "minecraft:podzol" - } - ] - } -] \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/copper_iron_chest.json b/src/main/resources/data/ironchest/recipes/chests/copper_iron_chest.json index 71f6097..6b899eb 100644 --- a/src/main/resources/data/ironchest/recipes/chests/copper_iron_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/copper_iron_chest.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:iron" - }, - "G": { - "constant": "ironchest:glass" + "tag": "forge:ingots/iron" }, "S": { "item": "ironchest:copper_chest" - } + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:iron_chest" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/copper_silver_chest.json b/src/main/resources/data/ironchest/recipes/chests/copper_silver_chest.json index 2c6d10d..0ca6764 100644 --- a/src/main/resources/data/ironchest/recipes/chests/copper_silver_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/copper_silver_chest.json @@ -7,7 +7,7 @@ ], "key": { "M": { - "constant": "ironchest:silver" + "tag": "forge:ingots/silver" }, "S": { "item": "ironchest:copper_chest" diff --git a/src/main/resources/data/ironchest/recipes/chests/diamond_crystal_chest.json b/src/main/resources/data/ironchest/recipes/chests/diamond_crystal_chest.json index f74893d..ed56158 100644 --- a/src/main/resources/data/ironchest/recipes/chests/diamond_crystal_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/diamond_crystal_chest.json @@ -6,14 +6,65 @@ "GGG" ], "key": { - "G": { - "constant": "ironchest:glass" - }, "S": { "item": "ironchest:diamond_chest" - } + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:crystal_chest" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/diamond_obsidian_chest.json b/src/main/resources/data/ironchest/recipes/chests/diamond_obsidian_chest.json index 0acffba..ed9417c 100644 --- a/src/main/resources/data/ironchest/recipes/chests/diamond_obsidian_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/diamond_obsidian_chest.json @@ -7,7 +7,7 @@ ], "key": { "M": { - "constant": "ironchest:obsidian" + "item": "minecraft:obsidian" }, "S": { "item": "ironchest:diamond_chest" diff --git a/src/main/resources/data/ironchest/recipes/chests/gold_diamond_chest.json b/src/main/resources/data/ironchest/recipes/chests/gold_diamond_chest.json index 11270b1..2d5d36b 100644 --- a/src/main/resources/data/ironchest/recipes/chests/gold_diamond_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/gold_diamond_chest.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:diamond" - }, - "G": { - "constant": "ironchest:glass" + "tag": "forge:gems/diamond" }, "S": { "item": "ironchest:gold_chest" - } + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:diamond_chest" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/iron_gold_chest.json b/src/main/resources/data/ironchest/recipes/chests/iron_gold_chest.json index e82f7bb..d2d477b 100644 --- a/src/main/resources/data/ironchest/recipes/chests/iron_gold_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/iron_gold_chest.json @@ -7,7 +7,7 @@ ], "key": { "M": { - "constant": "ironchest:gold" + "tag": "forge:ingots/gold" }, "S": { "item": "ironchest:iron_chest" diff --git a/src/main/resources/data/ironchest/recipes/chests/iron_silver_chest.json b/src/main/resources/data/ironchest/recipes/chests/iron_silver_chest.json index 02c8d76..1ad9072 100644 --- a/src/main/resources/data/ironchest/recipes/chests/iron_silver_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/iron_silver_chest.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:silver" - }, - "G": { - "constant": "ironchest:glass" + "tag": "forge:ingots/silver" }, "S": { "item": "ironchest:iron_chest" - } + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:silver_chest" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/silver_diamond_chest.json b/src/main/resources/data/ironchest/recipes/chests/silver_diamond_chest.json index 3e246cb..4507e1a 100644 --- a/src/main/resources/data/ironchest/recipes/chests/silver_diamond_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/silver_diamond_chest.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:diamond" - }, - "G": { - "constant": "ironchest:glass" + "tag": "forge:gems/diamond" }, "S": { "item": "ironchest:silver_chest" - } + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:diamond_chest" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/silver_gold_chest.json b/src/main/resources/data/ironchest/recipes/chests/silver_gold_chest.json index d01a430..90d007f 100644 --- a/src/main/resources/data/ironchest/recipes/chests/silver_gold_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/silver_gold_chest.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:gold" - }, - "G": { - "constant": "ironchest:glass" + "tag": "forge:ingots/gold" }, "S": { "item": "ironchest:silver_chest" - } + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:gold_chest" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/vanilla_copper_chest.json b/src/main/resources/data/ironchest/recipes/chests/vanilla_copper_chest.json index b45428d..1dcc25f 100644 --- a/src/main/resources/data/ironchest/recipes/chests/vanilla_copper_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/vanilla_copper_chest.json @@ -7,10 +7,10 @@ ], "key": { "M": { - "constant": "ironchest:copper" + "tag": "forge:ingots/copper" }, "S": { - "constant": "ironchest:chest" + "tag": "forge:chests/wooden" } }, "result": { diff --git a/src/main/resources/data/ironchest/recipes/chests/vanilla_dirt_chest.json b/src/main/resources/data/ironchest/recipes/chests/vanilla_dirt_chest.json index 026f54b..ee107df 100644 --- a/src/main/resources/data/ironchest/recipes/chests/vanilla_dirt_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/vanilla_dirt_chest.json @@ -6,14 +6,23 @@ "MMM" ], "key": { - "M": { - "constant": "ironchest:dirt" - }, "S": { - "constant": "ironchest:chest" - } + "tag": "forge:chests/wooden" + }, + "M": [ + { + "item": "minecraft:dirt" + }, + { + "item": "minecraft:coarse_dirt" + }, + { + "item": "minecraft:podzol" + } + ] }, "result": { "item": "ironchest:dirt_chest" - } + }, + "_comment": "replaceme with tag forge:dirt when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/chests/vanilla_iron_chest.json b/src/main/resources/data/ironchest/recipes/chests/vanilla_iron_chest.json index 3e365a2..45f6275 100644 --- a/src/main/resources/data/ironchest/recipes/chests/vanilla_iron_chest.json +++ b/src/main/resources/data/ironchest/recipes/chests/vanilla_iron_chest.json @@ -7,10 +7,10 @@ ], "key": { "M": { - "constant": "ironchest:iron" + "tag": "forge:ingots/iron" }, "S": { - "constant": "ironchest:chest" + "tag": "forge:chests/wooden" } }, "result": { diff --git a/src/main/resources/data/ironchest/recipes/upgrades/copper_iron_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/copper_iron_chest_upgrade.json index 106638b..e621d63 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/copper_iron_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/copper_iron_chest_upgrade.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:iron" + "tag": "forge:ingots/iron" }, "S": { - "constant": "ironchest:copper" + "tag": "forge:ingots/copper" }, - "G": { - "constant": "ironchest:glass" - } + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:copper_iron_chest_upgrade" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/upgrades/copper_silver_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/copper_silver_chest_upgrade.json index bb27459..c477be0 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/copper_silver_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/copper_silver_chest_upgrade.json @@ -7,10 +7,10 @@ ], "key": { "M": { - "constant": "ironchest:silver" + "tag": "forge:ingots/silver" }, "S": { - "constant": "ironchest:copper" + "tag": "forge:ingots/copper" } }, "result": { diff --git a/src/main/resources/data/ironchest/recipes/upgrades/diamond_crystal_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/diamond_crystal_chest_upgrade.json index 318add9..c6e9b00 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/diamond_crystal_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/diamond_crystal_chest_upgrade.json @@ -6,14 +6,65 @@ "GGG" ], "key": { - "G": { - "constant": "ironchest:glass" - }, "S": { - "constant": "ironchest:obsidian" - } + "item": "minecraft:obsidian" + }, + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:diamond_crystal_chest_upgrade" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/upgrades/diamond_obsidian_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/diamond_obsidian_chest_upgrade.json index c3849cd..32a7f19 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/diamond_obsidian_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/diamond_obsidian_chest_upgrade.json @@ -7,13 +7,64 @@ ], "key": { "M": { - "constant": "ironchest:obsidian" + "item": "minecraft:obsidian" }, - "G": { - "constant": "ironchest:glass" - } + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:diamond_obsidian_chest_upgrade" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/upgrades/gold_diamond_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/gold_diamond_chest_upgrade.json index 6f9fd52..fe3034d 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/gold_diamond_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/gold_diamond_chest_upgrade.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:diamond" + "tag": "forge:gems/diamond" }, "S": { - "constant": "ironchest:gold" + "tag": "forge:ingots/gold" }, - "G": { - "constant": "ironchest:glass" - } + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:gold_diamond_chest_upgrade" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/upgrades/iron_gold_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/iron_gold_chest_upgrade.json index 56b9706..d71746a 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/iron_gold_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/iron_gold_chest_upgrade.json @@ -7,10 +7,10 @@ ], "key": { "M": { - "constant": "ironchest:gold" + "tag": "forge:ingots/gold" }, "S": { - "constant": "ironchest:iron" + "tag": "forge:ingots/iron" } }, "result": { diff --git a/src/main/resources/data/ironchest/recipes/upgrades/silver_gold_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/silver_gold_chest_upgrade.json index dd0f7cc..ead75af 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/silver_gold_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/silver_gold_chest_upgrade.json @@ -7,16 +7,67 @@ ], "key": { "M": { - "constant": "ironchest:gold" + "tag": "forge:ingots/gold" }, "S": { - "constant": "ironchest:silver" + "tag": "forge:ingots/silver" }, - "G": { - "constant": "ironchest:glass" - } + "G": [ + { + "item": "minecraft:glass" + }, + { + "item": "minecraft:white_stained_glass" + }, + { + "item": "minecraft:orange_stained_glass" + }, + { + "item": "minecraft:magenta_stained_glass" + }, + { + "item": "minecraft:light_blue_stained_glass" + }, + { + "item": "minecraft:yellow_stained_glass" + }, + { + "item": "minecraft:lime_stained_glass" + }, + { + "item": "minecraft:pink_stained_glass" + }, + { + "item": "minecraft:gray_stained_glass" + }, + { + "item": "minecraft:light_gray_stained_glass" + }, + { + "item": "minecraft:cyan_stained_glass" + }, + { + "item": "minecraft:purple_stained_glass" + }, + { + "item": "minecraft:blue_stained_glass" + }, + { + "item": "minecraft:brown_stained_glass" + }, + { + "item": "minecraft:green_stained_glass" + }, + { + "item": "minecraft:red_stained_glass" + }, + { + "item": "minecraft:black_stained_glass" + } + ] }, "result": { "item": "ironchest:silver_gold_chest_upgrade" - } + }, + "_comment": "replaceme with tag forge:glass when out." } \ No newline at end of file diff --git a/src/main/resources/data/ironchest/recipes/upgrades/wood_copper_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/wood_copper_chest_upgrade.json index cffd038..f9e34b1 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/wood_copper_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/wood_copper_chest_upgrade.json @@ -7,10 +7,10 @@ ], "key": { "M": { - "constant": "ironchest:copper" + "tag": "forge:ingots/copper" }, "S": { - "constant": "ironchest:planks" + "tag": "minecraft:planks" } }, "result": { diff --git a/src/main/resources/data/ironchest/recipes/upgrades/wood_iron_chest_upgrade.json b/src/main/resources/data/ironchest/recipes/upgrades/wood_iron_chest_upgrade.json index 4ae7095..cb196a3 100644 --- a/src/main/resources/data/ironchest/recipes/upgrades/wood_iron_chest_upgrade.json +++ b/src/main/resources/data/ironchest/recipes/upgrades/wood_iron_chest_upgrade.json @@ -7,10 +7,10 @@ ], "key": { "M": { - "constant": "ironchest:iron" + "tag": "forge:ingots/iron" }, "S": { - "constant": "ironchest:planks" + "tag": "minecraft:planks" } }, "result": {