aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/handler
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-22 18:22:54 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-22 18:22:54 +0100
commit3dcd9e39f138315c903650c69f9a1a9782226cc4 (patch)
treee99ad39ba2e8bb756cdf01b33b3c5cb5d7ca33c6 /src/Java/gtPlusPlus/core/handler
parent78eb969baa21cba8738976c0e480d938bbb57e85 (diff)
downloadGT5-Unofficial-3dcd9e39f138315c903650c69f9a1a9782226cc4.tar.gz
GT5-Unofficial-3dcd9e39f138315c903650c69f9a1a9782226cc4.tar.bz2
GT5-Unofficial-3dcd9e39f138315c903650c69f9a1a9782226cc4.zip
- Removed some logging.
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java169
1 files changed, 74 insertions, 95 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index 8acb75552c..816b35ea4b 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -26,157 +26,136 @@ import gtPlusPlus.core.tileentities.machines.*;
public class GuiHandler implements IGuiHandler {
- public static final int GUI1 = 0; //Project Table
- public static final int GUI2 = 1; //Helium Generator
- public static final int GUI3 = 2; //BackpackHandler
- public static final int GUI4 = 3; //Workbench
- public static final int GUI5 = 4; //Workbench Adv
- public static final int GUI6 = 5; //Fish trap
- public static final int GUI7 = 6; //Trade table
- public static final int GUI8 = 7; //Circuit Programmer
- public static final int GUI9 = 8; //Grindle
-
-
-
- public static void init(){
+ public static final int GUI1 = 0; // Project Table
+ public static final int GUI2 = 1; // Helium Generator
+ public static final int GUI3 = 2; // BackpackHandler
+ public static final int GUI4 = 3; // Workbench
+ public static final int GUI5 = 4; // Workbench Adv
+ public static final int GUI6 = 5; // Fish trap
+ public static final int GUI7 = 6; // Trade table
+ public static final int GUI8 = 7; // Circuit Programmer
+ public static final int GUI9 = 8; // Grindle
+
+ public static void init() {
Logger.INFO("Registering GUIs.");
NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler());
- //Register GuiHandler
- //NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler());
+ // Register GuiHandler
+ // NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new
+ // GuiHandler());
}
-
- @Override //ContainerModTileEntity
- public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
+ @Override // ContainerModTileEntity
+ public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
+ final int y, final int z) {
final TileEntity te = world.getTileEntity(x, y, z);
- if (te != null){
- if (ID == GUI1){
- return new Container_ProjectTable(player.inventory, (TileEntityProjectTable)te);
- }
- else if (ID == GUI2){
+ if (te != null) {
+ if (ID == GUI1) {
+ return new Container_ProjectTable(player.inventory, (TileEntityProjectTable) te);
+ } else if (ID == GUI2) {
return new Container_ModularityTable(player.inventory, (TileEntityModularityTable) te);
}
}
- if (ID == GUI3)
- {
+ if (ID == GUI3) {
// Use the player's held item to create the inventory
- return new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem()));
+ return new Container_BackpackBase(player, player.inventory,
+ new BaseInventoryBackpack(player.getHeldItem()));
}
- if (te != null){
- if (ID == GUI4){
- return new Container_Workbench(player.inventory, (TileEntityWorkbench)te);
- }
- else if (ID == GUI5){
+ if (te != null) {
+ if (ID == GUI4) {
+ return new Container_Workbench(player.inventory, (TileEntityWorkbench) te);
+ } else if (ID == GUI5) {
Logger.INFO("sad");
- return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te);
-
- }
- else if (ID == GUI6){
- return new Container_FishTrap(player.inventory, (TileEntityFishTrap)te);
- }
- else if (ID == GUI7){
- return new Container_TradeTable(player.inventory, (TileEntityTradeTable)te);
- }
- else if (ID == GUI8){
- Logger.INFO("Returning CP Container.");
- return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer)te);
+ return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te);
+
+ } else if (ID == GUI6) {
+ return new Container_FishTrap(player.inventory, (TileEntityFishTrap) te);
+ } else if (ID == GUI7) {
+ return new Container_TradeTable(player.inventory, (TileEntityTradeTable) te);
+ } else if (ID == GUI8) {
+ return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
}
}
- if (ID == GUI9){
+ if (ID == GUI9) {
return new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem()));
}
-
-
-
-
-
-
return null;
}
- @Override //GuiModTileEntity
- public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
- Logger.WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+".");
+ @Override // GuiModTileEntity
+ public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
+ final int y, final int z) {
+ Logger.WARNING("getClientGuiElement Called by: " + player + ", in world: " + player.dimension + " at x:" + x
+ + ", y:" + y + ", z:" + z + ".");
final TileEntity te = world.getTileEntity(x, y, z);
- if (te != null){
- if (ID == GUI1){
- return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable)te);
- }
- else if (ID == GUI2){
+ if (te != null) {
+ if (ID == GUI1) {
+ return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable) te);
+ } else if (ID == GUI2) {
return new GUI_ModularityTable(player.inventory, (TileEntityModularityTable) te);
}
}
- if (ID == GUI3)
- {
+ if (ID == GUI3) {
// We have to cast the new container as our custom class
// and pass in currently held item for the inventory
- return new GuiBaseBackpack(new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem())));
+ return new GuiBaseBackpack(new Container_BackpackBase(player, player.inventory,
+ new BaseInventoryBackpack(player.getHeldItem())));
}
- if (te != null){
- if (ID == GUI4){
- return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te);
- }
- else if (ID == GUI5){
+ if (te != null) {
+ if (ID == GUI4) {
+ return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te);
+ } else if (ID == GUI5) {
Logger.INFO("sad");
- return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te);
- }
- else if (ID == GUI6){
- return new GUI_FishTrap(player.inventory, (TileEntityFishTrap)te);
- }
- else if (ID == GUI7){
- return new GUI_TradeTable(player.inventory, (TileEntityTradeTable)te, ((TileEntityBase) te).getOwner());
- }
- else if (ID == GUI8){
- Logger.INFO("Returning CP GUI.");
- return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer)te);
+ return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te);
+ } else if (ID == GUI6) {
+ return new GUI_FishTrap(player.inventory, (TileEntityFishTrap) te);
+ } else if (ID == GUI7) {
+ return new GUI_TradeTable(player.inventory, (TileEntityTradeTable) te,
+ ((TileEntityBase) te).getOwner());
+ } else if (ID == GUI8) {
+ return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
}
}
- if (ID == GUI9){
- return new GuiBaseGrindle(new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
+ if (ID == GUI9) {
+ return new GuiBaseGrindle(
+ new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
}
return null;
}
-
-
- //New Methods
- public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler)
- {
- openGui(entityplayer, guiHandler, (short)0);
+ // New Methods
+ public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler) {
+ openGui(entityplayer, guiHandler, (short) 0);
}
- public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler, final short data)
- {
+ public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler, final short data) {
final int guiData = encodeGuiData(guiHandler, data);
final ChunkCoordinates coordinates = guiHandler.getCoordinates();
- entityplayer.openGui(GTplusplus.instance, guiData, entityplayer.worldObj, coordinates.posX, coordinates.posY, coordinates.posZ);
+ entityplayer.openGui(GTplusplus.instance, guiData, entityplayer.worldObj, coordinates.posX, coordinates.posY,
+ coordinates.posZ);
}
- private static int encodeGuiData(final IGuiManager guiHandler, final short data)
- {
+ private static int encodeGuiData(final IGuiManager guiHandler, final short data) {
final MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler);
return (data << 16) | guiId.getId();
}
- private static MU_GuiId decodeGuiID(final int guiData)
- {
+ private static MU_GuiId decodeGuiID(final int guiData) {
final int guiId = guiData & 0xFF;
return Gui_ID_Registry.getGuiId(guiId);
}
- private static short decodeGuiData(final int guiId)
- {
- return (short)(guiId >> 16);
+ private static short decodeGuiData(final int guiId) {
+ return (short) (guiId >> 16);
}
} \ No newline at end of file