diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java index 44a1408..062bda4 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java @@ -1,12 +1,17 @@ package iguanaman.iguanatweakstconstruct.harvestlevels; +import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import iguanaman.iguanatweakstconstruct.harvestlevels.proxy.HarvestCommonProxy; import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.Log; import mantle.pulsar.pulse.Handler; import mantle.pulsar.pulse.Pulse; import net.minecraftforge.common.MinecraftForge; +import tconstruct.common.TProxyCommon; +import tconstruct.tools.ToolProxyCommon; /** * The Harvest-Tweaks Pulse. If this were a separate mod instead of pulse-module, it'd be a @Mod @@ -26,11 +31,20 @@ import net.minecraftforge.common.MinecraftForge; @Pulse(id = Reference.PULSE_HARVESTTWEAKS, description = "Modify tool and block mining levels to create a tiered-ish progression") public class IguanaHarvestLevelTweaks { + @SidedProxy(clientSide = "iguanaman.iguanatweakstconstruct.harvestlevels.proxy.HarvestClientProxy", serverSide = "\"iguanaman.iguanatweakstconstruct.harvestlevels.proxy.HarvestCommonProxy") + public static HarvestCommonProxy proxy; @Handler public void applyTinkerTweaks(FMLPreInitializationEvent event) { TinkerToolTweaks.modifyToolMaterials(); + + } + + @Handler + public void registerHandlers(FMLInitializationEvent event) + { + proxy.initialize(); } @Handler diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/gui/ToolForgeGUI.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/gui/ToolForgeGUI.java new file mode 100644 index 0000000..1e41f5e --- /dev/null +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/gui/ToolForgeGUI.java @@ -0,0 +1,19 @@ +package iguanaman.iguanatweakstconstruct.harvestlevels.gui; + +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.world.World; +import tconstruct.tools.gui.ToolForgeGui; +import tconstruct.tools.logic.ToolForgeLogic; + +public class ToolForgeGUI extends ToolForgeGui { + + public ToolForgeGUI(InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y, int z) { + super(inventoryplayer, stationlogic, world, x, y, z); + } + + @Override + protected String getHarvestLevelName(int num) { + return HarvestLevels.getHarvestLevelName(num); + } +} diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/gui/ToolStationGUI.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/gui/ToolStationGUI.java new file mode 100644 index 0000000..3d09874 --- /dev/null +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/gui/ToolStationGUI.java @@ -0,0 +1,19 @@ +package iguanaman.iguanatweakstconstruct.harvestlevels.gui; + +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.world.World; +import tconstruct.tools.gui.ToolStationGui; +import tconstruct.tools.logic.ToolStationLogic; + +public class ToolStationGUI extends ToolStationGui { + + public ToolStationGUI(InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y, int z) { + super(inventoryplayer, stationlogic, world, x, y, z); + } + + @Override + protected String getHarvestLevelName(int num) { + return HarvestLevels.getHarvestLevelName(num); + } +} diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/proxy/HarvestClientProxy.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/proxy/HarvestClientProxy.java new file mode 100644 index 0000000..d229686 --- /dev/null +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/proxy/HarvestClientProxy.java @@ -0,0 +1,29 @@ +package iguanaman.iguanatweakstconstruct.harvestlevels.proxy; + +import iguanaman.iguanatweakstconstruct.harvestlevels.gui.ToolForgeGUI; +import iguanaman.iguanatweakstconstruct.harvestlevels.gui.ToolStationGUI; +import iguanaman.iguanatweakstconstruct.util.Log; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import tconstruct.common.TProxyCommon; +import tconstruct.tools.ToolProxyCommon; +import tconstruct.tools.logic.ToolForgeLogic; +import tconstruct.tools.logic.ToolStationLogic; + +public class HarvestClientProxy extends HarvestCommonProxy { + @Override + public void initialize() { + Log.info("Replacing GUIs"); + TProxyCommon.registerClientGuiHandler(ToolProxyCommon.toolStationID, this); + TProxyCommon.registerClientGuiHandler(ToolProxyCommon.toolForgeID, this); + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if(ID == ToolProxyCommon.toolStationID) + return new ToolStationGUI(player.inventory, (ToolStationLogic) world.getTileEntity(x, y, z), world, x, y, z); + if(ID == ToolProxyCommon.toolForgeID) + return new ToolForgeGUI(player.inventory, (ToolForgeLogic) world.getTileEntity(x, y, z), world, x, y, z); + return null; + } +} diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/proxy/HarvestCommonProxy.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/proxy/HarvestCommonProxy.java new file mode 100644 index 0000000..f671f11 --- /dev/null +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/proxy/HarvestCommonProxy.java @@ -0,0 +1,20 @@ +package iguanaman.iguanatweakstconstruct.harvestlevels.proxy; + +import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class HarvestCommonProxy implements IGuiHandler { + + public void initialize() {} + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + return null; + } +}