From 8327360fa977c59afb691fdea05a9df96326a7a2 Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Mon, 2 Feb 2015 21:49:18 -0800 Subject: [PATCH] 1.8 Version Ready to GO Easy enough upgrade, items/blocks have models.json now, pulled the same scaling that a potato has. Everything else was a clean port. --- README.md | 3 +-- build.gradle | 1 + src/main/java/com/renevo/pcb/ClientProxy.java | 8 ++++++++ src/main/java/com/renevo/pcb/CommonProxy.java | 4 ++++ .../pcb/ContainerPortableCraftBench.java | 6 +++--- .../com/renevo/pcb/GuiPortableCraftBench.java | 6 +++--- .../com/renevo/pcb/ItemPortableCraftBench.java | 10 ---------- .../java/com/renevo/pcb/NeiIntegration.java | 2 -- .../pcb/PortableCraftBenchGuiHandler.java | 8 +++----- .../com/renevo/pcb/PortableCraftBenchMod.java | 6 ++---- .../pcb/models/item/portableCraftBench.json | 18 ++++++++++++++++++ 11 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 src/main/resources/assets/pcb/models/item/portableCraftBench.json diff --git a/README.md b/README.md index 1a147ad..97554a3 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,7 @@ Minecraft Portable Workbench Working with the code - gradlew setupDevWorkspace - gradlew eclipse + gradlew setupDecompWorkspace gradlew build diff --git a/build.gradle b/build.gradle index ce66e88..542804d 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,7 @@ archivesBaseName = "portablecraftbench" minecraft { version = "1.8-11.14.0.1298" runDir = "eclipse" + mappings = 'snapshot_nodoc_20141130' } processResources diff --git a/src/main/java/com/renevo/pcb/ClientProxy.java b/src/main/java/com/renevo/pcb/ClientProxy.java index 584ddff..50c3b3c 100644 --- a/src/main/java/com/renevo/pcb/ClientProxy.java +++ b/src/main/java/com/renevo/pcb/ClientProxy.java @@ -1,5 +1,8 @@ package com.renevo.pcb; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.model.ModelResourceLocation; + public class ClientProxy extends CommonProxy { @Override @@ -26,4 +29,9 @@ public void postInitialization() { // Railcraft NeiIntegration.registerCraftingContainers("mods.railcraft.client.gui.GuiCartWork"); } + + @Override + public void initialization() { + Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ItemPortableCraftBench.portableCraftBench, 0, new ModelResourceLocation(PortableCraftBenchMod.MODID + ":" + "portableCraftBench", "inventory")); + } } diff --git a/src/main/java/com/renevo/pcb/CommonProxy.java b/src/main/java/com/renevo/pcb/CommonProxy.java index 080a008..9e683bd 100644 --- a/src/main/java/com/renevo/pcb/CommonProxy.java +++ b/src/main/java/com/renevo/pcb/CommonProxy.java @@ -5,4 +5,8 @@ public class CommonProxy { public void postInitialization() { } + + public void initialization() { + + } } diff --git a/src/main/java/com/renevo/pcb/ContainerPortableCraftBench.java b/src/main/java/com/renevo/pcb/ContainerPortableCraftBench.java index feb3947..7de7692 100644 --- a/src/main/java/com/renevo/pcb/ContainerPortableCraftBench.java +++ b/src/main/java/com/renevo/pcb/ContainerPortableCraftBench.java @@ -4,13 +4,13 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.*; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; public class ContainerPortableCraftBench extends net.minecraft.inventory.ContainerWorkbench { - public ContainerPortableCraftBench(InventoryPlayer inventoryPlayer, World world, int x, int y, int z) { - super(inventoryPlayer, world, x, y, z); + public ContainerPortableCraftBench(InventoryPlayer inventoryPlayer, World world, BlockPos pos) { + super(inventoryPlayer, world, pos); } /** diff --git a/src/main/java/com/renevo/pcb/GuiPortableCraftBench.java b/src/main/java/com/renevo/pcb/GuiPortableCraftBench.java index 333b25e..160ea69 100644 --- a/src/main/java/com/renevo/pcb/GuiPortableCraftBench.java +++ b/src/main/java/com/renevo/pcb/GuiPortableCraftBench.java @@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; +import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -13,8 +13,8 @@ public class GuiPortableCraftBench extends GuiContainer { private static final ResourceLocation backgroundResourceLocation = new ResourceLocation("textures/gui/container/crafting_table.png"); - public GuiPortableCraftBench(InventoryPlayer playerInventory, World world, int x, int y, int z) { - super(new ContainerPortableCraftBench(playerInventory, world, x, y, z)); + public GuiPortableCraftBench(InventoryPlayer playerInventory, World world, BlockPos pos) { + super(new ContainerPortableCraftBench(playerInventory, world, pos)); } @Override diff --git a/src/main/java/com/renevo/pcb/ItemPortableCraftBench.java b/src/main/java/com/renevo/pcb/ItemPortableCraftBench.java index 7fc73c6..70a3d19 100644 --- a/src/main/java/com/renevo/pcb/ItemPortableCraftBench.java +++ b/src/main/java/com/renevo/pcb/ItemPortableCraftBench.java @@ -1,9 +1,6 @@ package com.renevo.pcb; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.*; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -32,7 +29,6 @@ public ItemPortableCraftBench() { setMaxStackSize(1); setUnlocalizedName("portableCraftBench"); setCreativeTab(CreativeTabs.tabTools); - setTextureName(PortableCraftBenchMod.MODID + ":" + "portableCraftBench"); } @Override @@ -45,10 +41,4 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer return player.getCurrentEquippedItem(); } } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(PortableCraftBenchMod.MODID + ":" + "portableCraftBench"); - } } diff --git a/src/main/java/com/renevo/pcb/NeiIntegration.java b/src/main/java/com/renevo/pcb/NeiIntegration.java index 2fd836b..c1b870a 100644 --- a/src/main/java/com/renevo/pcb/NeiIntegration.java +++ b/src/main/java/com/renevo/pcb/NeiIntegration.java @@ -6,8 +6,6 @@ import net.minecraftforge.fml.common.FMLLog; -import net.minecraft.client.gui.inventory.GuiContainer; - public class NeiIntegration { public static void registerCraftingContainers(Class craftingContainer) { diff --git a/src/main/java/com/renevo/pcb/PortableCraftBenchGuiHandler.java b/src/main/java/com/renevo/pcb/PortableCraftBenchGuiHandler.java index a1f0b5f..69a0dfe 100644 --- a/src/main/java/com/renevo/pcb/PortableCraftBenchGuiHandler.java +++ b/src/main/java/com/renevo/pcb/PortableCraftBenchGuiHandler.java @@ -1,9 +1,7 @@ package com.renevo.pcb; -import net.minecraft.client.gui.inventory.GuiCrafting; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ContainerWorkbench; -import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.network.IGuiHandler; @@ -13,7 +11,7 @@ public class PortableCraftBenchGuiHandler implements IGuiHandler { @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ItemPortableCraftBench.portableCraftBench) - return new GuiPortableCraftBench(player.inventory, world, x, y, z); + return new GuiPortableCraftBench(player.inventory, world, new BlockPos(x, y, z)); FMLLog.info("No GUI to show"); return null; @@ -22,7 +20,7 @@ public Object getClientGuiElement(int id, EntityPlayer player, World world, int @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if (id == PortableCraftBenchMod.GUI_PORTABLE_CRAFT_BENCH_ID && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ItemPortableCraftBench.portableCraftBench) - return new ContainerPortableCraftBench(player.inventory, world, x, y, z); + return new ContainerPortableCraftBench(player.inventory, world, new BlockPos(x, y, z)); FMLLog.info("No GUI to show"); diff --git a/src/main/java/com/renevo/pcb/PortableCraftBenchMod.java b/src/main/java/com/renevo/pcb/PortableCraftBenchMod.java index 0c94255..9928f66 100644 --- a/src/main/java/com/renevo/pcb/PortableCraftBenchMod.java +++ b/src/main/java/com/renevo/pcb/PortableCraftBenchMod.java @@ -1,11 +1,7 @@ package com.renevo.pcb; -import org.apache.logging.log4j.Level; - -import net.minecraft.init.Blocks; import net.minecraft.stats.*; import net.minecraftforge.common.*; -import net.minecraftforge.common.config.*; import net.minecraftforge.fml.common.*; import net.minecraftforge.fml.common.Mod.*; import net.minecraftforge.fml.common.event.*; @@ -41,6 +37,8 @@ public void init(FMLInitializationEvent event) { // 6 left, 0 up/down - since we are just adding a new achievement, we don't need an achievement page, this somehow just works... achievementPcb = new Achievement("achievement.pcb", "pcb", 6, 0, ItemPortableCraftBench.portableCraftBench, net.minecraft.stats.AchievementList.buildWorkBench); achievementPcb.registerStat(); + + proxy.initialization(); } @EventHandler diff --git a/src/main/resources/assets/pcb/models/item/portableCraftBench.json b/src/main/resources/assets/pcb/models/item/portableCraftBench.json new file mode 100644 index 0000000..5269d40 --- /dev/null +++ b/src/main/resources/assets/pcb/models/item/portableCraftBench.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "pcb:items/portableCraftBench" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} \ No newline at end of file