diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
11 files changed, 607 insertions, 510 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index b107dcfa31..63cf7d42c2 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -1,122 +1,155 @@ package gtPlusPlus.core.handler; -import java.util.LinkedList; -import java.util.Queue; - +import static gtPlusPlus.core.lib.LoadedMods.Gregtech; import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.common.compat.*; +import gtPlusPlus.core.common.compat.COMPAT_BigReactors; +import gtPlusPlus.core.common.compat.COMPAT_CompactWindmills; +import gtPlusPlus.core.common.compat.COMPAT_EnderIO; +import gtPlusPlus.core.common.compat.COMPAT_ExtraUtils; +import gtPlusPlus.core.common.compat.COMPAT_IC2; +import gtPlusPlus.core.common.compat.COMPAT_MorePlanets; +import gtPlusPlus.core.common.compat.COMPAT_PneumaticCraft; +import gtPlusPlus.core.common.compat.COMPAT_RFTools; +import gtPlusPlus.core.common.compat.COMPAT_SimplyJetpacks; +import gtPlusPlus.core.common.compat.COMPAT_Thaumcraft; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.recipe.*; +import gtPlusPlus.core.recipe.RECIPES_GREGTECH; +import gtPlusPlus.core.recipe.RECIPES_LaserEngraver; +import gtPlusPlus.core.recipe.ShapedRecipeObject; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; -import gtPlusPlus.xmod.gregtech.registration.gregtech.*; +import gtPlusPlus.xmod.gregtech.registration.gregtech.Gregtech4Content; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechDehydrator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechEnergyBuffer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeothermalThermalGenerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialBlastSmelter; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCentrifuge; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCokeOven; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialElectrolyzer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMacerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMassFabricator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMultiTank; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialPlatePress; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWiremill; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIronBlastFurnace; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLFTR; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPowerSubStation; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechRocketFuelGenerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSafeBlock; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSolarGenerators; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSteamCondenser; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSuperConductionPoint; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTieredFluidTanks; + +import java.util.LinkedList; +import java.util.Queue; + import net.minecraft.item.ItemStack; public class COMPAT_HANDLER { + + public static Queue<Object> RemoveRecipeQueue = new LinkedList<Object>(); + public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<ShapedRecipeObject>(); + public static Boolean areInitItemsLoaded = false; + + + public static void registerMyModsOreDictEntries(){ - public static Queue<Object> RemoveRecipeQueue = new LinkedList<Object>(); - public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<ShapedRecipeObject>(); - public static Boolean areInitItemsLoaded = false; + Utils.LOG_INFO("Registering Materials with OreDict."); + //In-house - public static void InitialiseHandlerThenAddRecipes() { - RegistrationHandler.run(); - } + //tools + GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer)); - public static void InitialiseLateHandlerThenAddRecipes() { - LateRegistrationHandler.run(); + for(int i=1; i<=10; i++){ + GT_OreDictUnificator.registerOre("bufferCore_"+CORE.VOLTAGES[i-1], new ItemStack(ItemUtils.getItem("miscutils:item.itemBufferCore"+i))); + } } + + public static void registerGregtechMachines() { + if (Gregtech) { + new RECIPES_LaserEngraver(); + GregtechEnergyBuffer.run(); + GregtechLFTR.run(); + GregtechSteamCondenser.run(); + GregtechSafeBlock.run(); + GregtechSuperConductionPoint.run(); + GregtechIronBlastFurnace.run(); + GregtechIndustrialCentrifuge.run(); + GregtechIndustrialCokeOven.run(); + GregtechIndustrialPlatePress.run(); + GregtechRocketFuelGenerator.run(); + GregtechIndustrialElectrolyzer.run(); + GregtechIndustrialMacerator.run(); + GregtechIndustrialWiremill.run(); + GregtechIndustrialMassFabricator.run(); + GregtechIndustrialBlastSmelter.run(); + GregtechSolarGenerators.run(); + GregtechPowerSubStation.run(); + GregtechDehydrator.run(); + GregtechTieredFluidTanks.run(); + GregtechIndustrialMultiTank.run(); + GregtechGeothermalThermalGenerator.run(); + Gregtech4Content.run(); + } - // InterMod - public static void intermodOreDictionarySupport() { - - if (LoadedMods.Big_Reactors) { + } + + //InterMod + public static void intermodOreDictionarySupport(){ + + if (LoadedMods.Big_Reactors){ COMPAT_BigReactors.OreDict(); } - if (LoadedMods.EnderIO) { + if (LoadedMods.EnderIO){ COMPAT_EnderIO.OreDict(); } - if (LoadedMods.MorePlanets) { + if (LoadedMods.MorePlanets){ COMPAT_MorePlanets.OreDict(); } - if (LoadedMods.Simply_Jetpacks) { + if (LoadedMods.Simply_Jetpacks){ COMPAT_SimplyJetpacks.OreDict(); } - if (LoadedMods.RFTools) { + if (LoadedMods.RFTools){ COMPAT_RFTools.OreDict(); } - if (LoadedMods.Thaumcraft) { + if (LoadedMods.Thaumcraft){ COMPAT_Thaumcraft.OreDict(); } - if (LoadedMods.Extra_Utils) { + if (LoadedMods.Extra_Utils){ COMPAT_ExtraUtils.OreDict(); } - if (LoadedMods.PneumaticCraft) { + if (LoadedMods.PneumaticCraft){ COMPAT_PneumaticCraft.OreDict(); } - if (LoadedMods.CompactWindmills) { + if (LoadedMods.CompactWindmills){ COMPAT_CompactWindmills.OreDict(); } - if (LoadedMods.IndustrialCraft2) { + if (LoadedMods.IndustrialCraft2){ COMPAT_IC2.OreDict(); - } + } } - - public static void registerGregtechMachines() { - if (LoadedMods.Gregtech) { - new RECIPES_LaserEngraver(); - GregtechEnergyBuffer.run(); - GregtechLFTR.run(); - GregtechSteamCondenser.run(); - GregtechSafeBlock.run(); - GregtechSuperConductionPoint.run(); - GregtechIronBlastFurnace.run(); - GregtechIndustrialCentrifuge.run(); - GregtechIndustrialCokeOven.run(); - GregtechIndustrialPlatePress.run(); - GregtechRocketFuelGenerator.run(); - GregtechIndustrialElectrolyzer.run(); - GregtechIndustrialMacerator.run(); - GregtechIndustrialWiremill.run(); - GregtechIndustrialMassFabricator.run(); - GregtechIndustrialBlastSmelter.run(); - GregtechSolarGenerators.run(); - GregtechPowerSubStation.run(); - GregtechDehydrator.run(); - GregtechTieredFluidTanks.run(); - GregtechIndustrialMultiTank.run(); - GregtechGeothermalThermalGenerator.run(); - Gregtech4Content.run(); - } - + + public static void RemoveRecipesFromOtherMods(){ + //Removal of Recipes + for(Object item : RemoveRecipeQueue){ + RecipeUtils.removeCraftingRecipe(item); + } } - - public static void registerMyModsOreDictEntries() { - - Utils.LOG_INFO("Registering Materials with OreDict."); - // In-house - - // tools - GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer)); - - for (int i = 1; i <= 10; i++) { - GT_OreDictUnificator.registerOre("bufferCore_" + CORE.VOLTAGES[i - 1], - new ItemStack(ItemUtils.getItem("miscutils:item.itemBufferCore" + i))); - } + + public static void InitialiseHandlerThenAddRecipes(){ + RegistrationHandler.run(); } - - public static void RemoveRecipesFromOtherMods() { - // Removal of Recipes - for (final Object item : COMPAT_HANDLER.RemoveRecipeQueue) { - RecipeUtils.removeCraftingRecipe(item); - } + public static void InitialiseLateHandlerThenAddRecipes(){ + LateRegistrationHandler.run(); } - - public static void startLoadingGregAPIBasedRecipes() { + + public static void startLoadingGregAPIBasedRecipes(){ RECIPES_GREGTECH.run(); } } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index 4dce04f3d5..ccf2b83837 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -10,7 +10,18 @@ import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; public class COMPAT_IntermodStaging { - public static void init() { + public static void preInit(){ + HANDLER_GT.preInit(); + HANDLER_GC.preInit(); + HANDLER_TF.preInit(); + HANDLER_FR.preInit(); + HANDLER_Psych.preInit(); + HANDLER_IC2.preInit(); + HANDLER_Computronics.preInit(); + + } + + public static void init(){ HANDLER_GT.init(); HANDLER_GC.init(); HANDLER_TF.init(); @@ -20,7 +31,7 @@ public class COMPAT_IntermodStaging { HANDLER_Computronics.init(); } - public static void postInit() { + public static void postInit(){ HANDLER_GT.postInit(); HANDLER_GC.postInit(); HANDLER_TF.postInit(); @@ -30,15 +41,5 @@ public class COMPAT_IntermodStaging { HANDLER_Computronics.postInit(); } - public static void preInit() { - HANDLER_GT.preInit(); - HANDLER_GC.preInit(); - HANDLER_TF.preInit(); - HANDLER_FR.preInit(); - HANDLER_Psych.preInit(); - HANDLER_IC2.preInit(); - HANDLER_Computronics.preInit(); - - } } diff --git a/src/Java/gtPlusPlus/core/handler/CraftingManager.java b/src/Java/gtPlusPlus/core/handler/CraftingManager.java index 89f7ec1682..bd0f114b1a 100644 --- a/src/Java/gtPlusPlus/core/handler/CraftingManager.java +++ b/src/Java/gtPlusPlus/core/handler/CraftingManager.java @@ -2,16 +2,16 @@ package gtPlusPlus.core.handler; public class CraftingManager { - public static void addCraftingRecipies() { - + public static void mainRegistry() { + addCraftingRecipies(); + addSmeltingRecipies(); } - public static void addSmeltingRecipies() { - + public static void addCraftingRecipies() { + } - public static void mainRegistry() { - CraftingManager.addCraftingRecipies(); - CraftingManager.addSmeltingRecipies(); + public static void addSmeltingRecipies() { + } } diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index e3cf2caf9b..c2b120d428 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.handler; -import cpw.mods.fml.common.network.IGuiHandler; -import cpw.mods.fml.common.network.NetworkRegistry; import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.container.*; +import gtPlusPlus.core.container.Container_BackpackBase; +import gtPlusPlus.core.container.Container_Workbench; +import gtPlusPlus.core.container.Container_WorkbenchAdvanced; import gtPlusPlus.core.gui.beta.Gui_ID_Registry; import gtPlusPlus.core.gui.beta.MU_GuiId; import gtPlusPlus.core.gui.item.GuiBaseBackpack; @@ -22,129 +22,143 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; public class GuiHandler implements IGuiHandler { - public static final int GUI1 = 0; // Frame Alveary - public static final int GUI2 = 1; // RTG - 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; // - public static final int GUI7 = 6; // - public static final int GUI8 = 7; // - - private static short decodeGuiData(final int guiId) { - return (short) (guiId >> 16); - } + public static final int GUI1 = 0; //Frame Alveary + public static final int GUI2 = 1; //RTG + 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; // + public static final int GUI7 = 6; // + public static final int GUI8 = 7; // - private static MU_GuiId decodeGuiID(final int guiData) { - final int guiId = guiData & 0xFF; - return Gui_ID_Registry.getGuiId(guiId); - } - private static int encodeGuiData(final IGuiManager guiHandler, final short data) { - final MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); - return data << 16 | guiId.getId(); - } - public static void init() { + public static void init(){ - Utils.LOG_INFO("Registering GUIs."); - NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); - // Register GuiHandler - // NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new - // GuiHandler()); + Utils.LOG_INFO("Registering GUIs."); + NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); + //Register GuiHandler + //NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); } - // New Methods - public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler) { - GuiHandler.openGui(entityplayer, guiHandler, (short) 0); - } - public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler, final short data) { - final int guiData = GuiHandler.encodeGuiData(guiHandler, data); - final ChunkCoordinates coordinates = guiHandler.getCoordinates(); - entityplayer.openGui(GTplusplus.instance, guiData, entityplayer.worldObj, coordinates.posX, coordinates.posY, - coordinates.posZ); - } + @Override //ContainerModTileEntity + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + TileEntity te = world.getTileEntity(x, y, z); - @Override // GuiModTileEntity - public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, - final int y, final int z) { - Utils.LOG_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 == GuiHandler.GUI1) { - if (CORE.configSwitches.enableCustomAlvearyBlocks) { - Utils.LOG_WARNING("Opening Gui with Id: " + ID + " Alveary Frame Housing"); - return new GUI_FrameHousing((TileAlvearyFrameHousing) te, player); + if (te != null){ + if (ID == GUI1){ + if (CORE.configSwitches.enableCustomAlvearyBlocks){ + return new CONTAINER_FrameHousing((TileAlvearyFrameHousing)te, player); } } - else if (ID == GuiHandler.GUI2) { - Utils.LOG_WARNING("Opening Gui with Id: " + ID + " RTG"); - // return new GUI_RTG((TileEntityRTG) te.); + else if (ID == GUI2){ + //return new CONTAINER_RTG(player, (TileEntityRTG)te); } + + } - if (ID == GuiHandler.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()))); + if (ID == GUI3) + { + // Use the player's held item to create the inventory + return new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem())); } - if (te != null) { - if (ID == GuiHandler.GUI4) { - return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te); + if (te != null){ + if (ID == GUI4){ + + return new Container_Workbench(player.inventory, (TileEntityWorkbench)te); + } - if (ID == GuiHandler.GUI5) { + if (ID == GUI5){ Utils.LOG_INFO("sad"); - return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); + return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te); + } } + + + + + + return null; } - @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 == GuiHandler.GUI1) { - if (CORE.configSwitches.enableCustomAlvearyBlocks) { - return new CONTAINER_FrameHousing((TileAlvearyFrameHousing) te, player); + @Override //GuiModTileEntity + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + Utils.LOG_WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+"."); + TileEntity te = world.getTileEntity(x, y, z); + if (te != null){ + if (ID == GUI1){ + if (CORE.configSwitches.enableCustomAlvearyBlocks){ + Utils.LOG_WARNING("Opening Gui with Id: "+ID+" Alveary Frame Housing"); + return new GUI_FrameHousing((TileAlvearyFrameHousing) te, player); } } - else if (ID == GuiHandler.GUI2) { - // return new CONTAINER_RTG(player, (TileEntityRTG)te); + else if (ID == GUI2){ + Utils.LOG_WARNING("Opening Gui with Id: "+ID+" RTG"); + //return new GUI_RTG((TileEntityRTG) te.); } - } - if (ID == GuiHandler.GUI3) { - // Use the player's held item to create the inventory - return new Container_BackpackBase(player, player.inventory, - new BaseInventoryBackpack(player.getHeldItem())); + 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((Container_BackpackBase) new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem()))); } - if (te != null) { - if (ID == GuiHandler.GUI4) { - - return new Container_Workbench(player.inventory, (TileEntityWorkbench) te); - + if (te != null){ + if (ID == GUI4){ + return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te); } - if (ID == GuiHandler.GUI5) { + if (ID == GUI5){ Utils.LOG_INFO("sad"); - return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); - + return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te); } } return null; } + + + //New Methods + public static void openGui(EntityPlayer entityplayer, IGuiManager guiHandler) + { + openGui(entityplayer, guiHandler, (short)0); + } + + public static void openGui(EntityPlayer entityplayer, IGuiManager guiHandler, short data) + { + int guiData = encodeGuiData(guiHandler, data); + ChunkCoordinates coordinates = guiHandler.getCoordinates(); + entityplayer.openGui(GTplusplus.instance, guiData, entityplayer.worldObj, coordinates.posX, coordinates.posY, coordinates.posZ); + } + + private static int encodeGuiData(IGuiManager guiHandler, short data) + { + MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); + return data << 16 | guiId.getId(); + } + + private static MU_GuiId decodeGuiID(int guiData) + { + int guiId = guiData & 0xFF; + return Gui_ID_Registry.getGuiId(guiId); + } + + private static short decodeGuiData(int guiId) + { + return (short)(guiId >> 16); + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java index 71fa76ba38..7d739bdca3 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java @@ -6,25 +6,23 @@ import gtPlusPlus.core.util.Utils; public class LateRegistrationHandler { - public static int recipesSuccess = 0; - public static int recipesFailed = 0; - - private final static void init() { - for (final ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue) { - item.buildRecipe(); - } + public static int recipesSuccess = 0; + public static int recipesFailed = 0; + + public static void run(){ + init(); + } + + private final static void init(){ + for(ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue){ + item.buildRecipe(); + } try { Thread.sleep(10); - } - catch (final InterruptedException e) { + } catch (InterruptedException e) { Utils.LOG_INFO(e.toString()); } - Utils.LOG_INFO("Late Recipes Loaded: " + LateRegistrationHandler.recipesSuccess + " Failed: " - + LateRegistrationHandler.recipesFailed); + Utils.LOG_INFO("Late Recipes Loaded: "+recipesSuccess+" Failed: "+recipesFailed); } - - public static void run() { - LateRegistrationHandler.init(); - } - + } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java index 00e0327134..275a67f571 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java @@ -1,31 +1,34 @@ package gtPlusPlus.core.handler.Recipes; import gtPlusPlus.core.handler.COMPAT_HANDLER; -import gtPlusPlus.core.recipe.*; +import gtPlusPlus.core.recipe.RECIPES_General; +import gtPlusPlus.core.recipe.RECIPES_MachineComponents; +import gtPlusPlus.core.recipe.RECIPES_Machines; +import gtPlusPlus.core.recipe.RECIPES_Shapeless; +import gtPlusPlus.core.recipe.RECIPES_Tools; +import gtPlusPlus.core.recipe.RECIPE_Batteries; import gtPlusPlus.core.util.Utils; public class RegistrationHandler { - public static int recipesSuccess = 0; - public static int recipesFailed = 0; - - private final static void init() { + public static int recipesSuccess = 0; + public static int recipesFailed = 0; + + public static void run(){ + init(); + } + + private final static void init(){ RECIPES_Tools.RECIPES_LOAD(); RECIPES_Machines.RECIPES_LOAD(); RECIPES_Shapeless.RECIPES_LOAD(); RECIPES_MachineComponents.RECIPES_LOAD(); RECIPE_Batteries.RECIPES_LOAD(); RECIPES_General.RECIPES_LOAD(); - // RECIPES_MTWRAPPER.run(); - Utils.LOG_INFO( - "Loaded: " + RegistrationHandler.recipesSuccess + " Failed: " + RegistrationHandler.recipesFailed); + //RECIPES_MTWRAPPER.run(); + Utils.LOG_INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed); COMPAT_HANDLER.areInitItemsLoaded = true; - // Utils.LOG_INFO("MT Loaded: "+RECIPES_MTWRAPPER.MT_RECIPES_LOADED+" MT - // Failed: "+RECIPES_MTWRAPPER.MT_RECIPES_FAILED); + //Utils.LOG_INFO("MT Loaded: "+RECIPES_MTWRAPPER.MT_RECIPES_LOADED+" MT Failed: "+RECIPES_MTWRAPPER.MT_RECIPES_FAILED); } - - public static void run() { - RegistrationHandler.init(); - } - + } diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 0e38e91ddb..e529d47699 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -1,24 +1,25 @@ package gtPlusPlus.core.handler.events; -import java.util.UUID; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.player.PlayerUtils; + +import java.util.UUID; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; public class LoginEventHandler { - public String localPlayersName; - public UUID localPlayersUUID; - private EntityPlayer localPlayerRef; + public String localPlayersName; + public UUID localPlayersUUID; + private EntityPlayer localPlayerRef; @SubscribeEvent - public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) { + public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { this.localPlayerRef = event.player; this.localPlayersName = event.player.getDisplayName(); @@ -26,71 +27,68 @@ public class LoginEventHandler { try { - if (this.localPlayerRef instanceof EntityPlayerMP && this.localPlayerRef != null) { - // Populates player cache - if (!this.localPlayerRef.worldObj.isRemote) { - PlayerCache.appendParamChanges(this.localPlayersName, this.localPlayersUUID.toString()); - - if (!CORE.isModUpToDate) { - Utils.LOG_INFO("You're not using the latest recommended version of GT++, consider updating."); - Utils.LOG_INFO("Latest version is: " + CORE.MASTER_VERSION); - Utils.LOG_INFO("You currently have: " + CORE.VERSION); - PlayerUtils.messagePlayer(this.localPlayerRef, - "You're not using the latest recommended version of GT++, consider updating."); - } - else { - Utils.LOG_INFO("You're using the latest recommended version of GT++."); - } + if (localPlayerRef instanceof EntityPlayerMP && localPlayerRef != null){ + //Populates player cache + if (!localPlayerRef.worldObj.isRemote){ + PlayerCache.appendParamChanges(localPlayersName, localPlayersUUID.toString()); + + if (!CORE.isModUpToDate){ + Utils.LOG_INFO("You're not using the latest recommended version of GT++, consider updating."); + Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); + Utils.LOG_INFO("You currently have: "+CORE.VERSION); + PlayerUtils.messagePlayer(localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); + } + else { + Utils.LOG_INFO("You're using the latest recommended version of GT++."); + } + } - /* - * if (localPlayerRef.getCommandSenderName().toLowerCase(). - * equalsIgnoreCase("ImQ009") || - * localPlayerRef.getCommandSenderName().toLowerCase().contains( - * "player")){ Utils.LOG_INFO("Spawning a new Santa Thread."); - * Thread t = new Thread() { UUID threadHandlerIDthing = - * localPlayersUUID; - * - * @Override public void run() { while(true && - * Minecraft.getMinecraft().getIntegratedServer() != null) { try - * { if(localPlayerRef == null){ localPlayerRef = - * Utils.getPlayerOnServerFromUUID(threadHandlerIDthing); } - * - * - * //ImQ009 is a legend. if - * (localPlayerRef.getCommandSenderName().toLowerCase(). - * equalsIgnoreCase("ImQ009")){ - * Utils.messagePlayer(localPlayerRef, - * "Enjoy some complimentary Raisin Bread."); - * localPlayerRef.inventory.addItemStackToInventory(UtilsItems. - * getSimpleStack(ModItems.itemIngotRaisinBread, - * MathUtils.randInt(1, 5))); } - * - * - * if - * (localPlayerRef.getCommandSenderName().toLowerCase().contains - * ("player")){ Utils.messagePlayer(localPlayerRef, - * "Enjoy some complimentary Raisin Bread."); - * localPlayerRef.inventory.addItemStackToInventory(UtilsItems. - * getSimpleStack(ModItems.itemIngotRaisinBread, - * MathUtils.randInt(1, 5))); } - * Thread.sleep(1000*60*MathUtils.randInt(15, 90)); } catch - * (InterruptedException ie) { Utils.LOG_INFO( - * "Santa Mode Disabled."); } } - * - * Utils.LOG_INFO("Thread Stopped. Handler Closed."); - * - * } }; //t.start(); - * - * - * } - */ - - } - } - catch (final Throwable errr) { + + /*if (localPlayerRef.getCommandSenderName().toLowerCase().equalsIgnoreCase("ImQ009") || localPlayerRef.getCommandSenderName().toLowerCase().contains("player")){ + Utils.LOG_INFO("Spawning a new Santa Thread."); + Thread t = new Thread() { + UUID threadHandlerIDthing = localPlayersUUID; + @Override + public void run() { + while(true && Minecraft.getMinecraft().getIntegratedServer() != null) { + try { + if(localPlayerRef == null){ + localPlayerRef = Utils.getPlayerOnServerFromUUID(threadHandlerIDthing); + } + + + //ImQ009 is a legend. + if (localPlayerRef.getCommandSenderName().toLowerCase().equalsIgnoreCase("ImQ009")){ + Utils.messagePlayer(localPlayerRef, "Enjoy some complimentary Raisin Bread."); + localPlayerRef.inventory.addItemStackToInventory(UtilsItems.getSimpleStack(ModItems.itemIngotRaisinBread, MathUtils.randInt(1, 5))); + } + + + if (localPlayerRef.getCommandSenderName().toLowerCase().contains("player")){ + Utils.messagePlayer(localPlayerRef, "Enjoy some complimentary Raisin Bread."); + localPlayerRef.inventory.addItemStackToInventory(UtilsItems.getSimpleStack(ModItems.itemIngotRaisinBread, MathUtils.randInt(1, 5))); + } + Thread.sleep(1000*60*MathUtils.randInt(15, 90)); + } catch (InterruptedException ie) { + Utils.LOG_INFO("Santa Mode Disabled."); + } + } + + Utils.LOG_INFO("Thread Stopped. Handler Closed."); + + } + }; + //t.start(); + + + }*/ + + + } + } catch (Throwable errr){ Utils.LOG_INFO("Login Handler encountered an error."); } diff --git a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java index 5c962a5d2f..49b844f057 100644 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java @@ -1,53 +1,54 @@ package gtPlusPlus.core.handler.events; -import java.util.UUID; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.metatileentity.*; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.BaseTileEntity; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; + +import java.util.UUID; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class PickaxeBlockBreakEventHandler { @SubscribeEvent - public void onBreakBlock(final BreakEvent event) { - try { - final TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); - if (entity != null && !entity.equals(null)) { - final EntityPlayer playerInternal = event.getPlayer(); + public void onBreakBlock(BreakEvent event) { + try{ + TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); + if (entity != null && !entity.equals(null)){ + EntityPlayer playerInternal = event.getPlayer(); Utils.LOG_WARNING(entity.getClass().getSimpleName()); - if (entity.getClass().getSimpleName().equals("")) { + if (entity.getClass().getSimpleName().equals("")){ } - if (entity instanceof BaseTileEntity && !(entity instanceof BaseMetaPipeEntity)) { - final IMetaTileEntity X = ((BaseMetaTileEntity) entity).getMetaTileEntity(); - final Block ThisBlock = X.getBaseMetaTileEntity().getBlock(event.x, event.y, event.z); - if (X instanceof GregtechMetaSafeBlockBase) { - - final UUID ownerUUID = ((GregtechMetaSafeBlockBase) X).ownerUUID; - final UUID accessorUUID = playerInternal.getUniqueID(); - Utils.LOG_WARNING("Owner UUID: " + ownerUUID); - Utils.LOG_WARNING("Accessor UUID: " + accessorUUID); - - if (((GregtechMetaSafeBlockBase) X).bUnbreakable) { + if (entity instanceof BaseTileEntity && !(entity instanceof BaseMetaPipeEntity)){ + IMetaTileEntity X = ((BaseMetaTileEntity)entity).getMetaTileEntity(); + Block ThisBlock = X.getBaseMetaTileEntity().getBlock(event.x, event.y, event.z); + if (X instanceof GregtechMetaSafeBlockBase){ - Utils.LOG_INFO("UUID info. Accessor: " + accessorUUID + " | Owner: " + ownerUUID); + UUID ownerUUID = ((GregtechMetaSafe |
