mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-26 06:43:05 +00:00
Add hook for own ToolStation/Forge GUI for correct Mining Level Display
This commit is contained in:
1 parent
7682bf8b37
commit
bbbfad3b85
5 files changed
+101
No files matched your search
+14
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+29
@@ -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;
|
||||
}
|
||||
}
|
||||
+20
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user