aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/handler
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
commit0669f5eb9d5029a8b94ec552171b0837605f7747 (patch)
tree6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/core/handler
parent3654052fb63a571c5eaca7f20714b87c17f7e966 (diff)
downloadGT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java143
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java25
-rw-r--r--src/Java/gtPlusPlus/core/handler/CraftingManager.java14
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java180
-rw-r--r--src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java30
-rw-r--r--src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java26
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java127
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java63
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java175
-rw-r--r--src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java199
-rw-r--r--src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java40
11 files changed, 488 insertions, 534 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index d6caf1af72..b107dcfa31 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -1,7 +1,5 @@
package gtPlusPlus.core.handler;
-import static gtPlusPlus.core.lib.LoadedMods.Gregtech;
-
import java.util.LinkedList;
import java.util.Queue;
@@ -20,104 +18,105 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.*;
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(){
-
- Utils.LOG_INFO("Registering Materials with OreDict.");
- //In-house
- //tools
- GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer));
+ public static Queue<Object> RemoveRecipeQueue = new LinkedList<Object>();
+ public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<ShapedRecipeObject>();
+ public static Boolean areInitItemsLoaded = false;
- 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 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();
- }
+ public static void InitialiseLateHandlerThenAddRecipes() {
+ LateRegistrationHandler.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 RemoveRecipesFromOtherMods(){
- //Removal of Recipes
- for(Object item : RemoveRecipeQueue){
- RecipeUtils.removeCraftingRecipe(item);
- }
+
+ 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 InitialiseHandlerThenAddRecipes(){
- RegistrationHandler.run();
+
+ 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 InitialiseLateHandlerThenAddRecipes(){
- LateRegistrationHandler.run();
+
+ public static void RemoveRecipesFromOtherMods() {
+ // Removal of Recipes
+ for (final Object item : COMPAT_HANDLER.RemoveRecipeQueue) {
+ RecipeUtils.removeCraftingRecipe(item);
+ }
}
-
- 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 ccf2b83837..4dce04f3d5 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
@@ -10,18 +10,7 @@ import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF;
public class COMPAT_IntermodStaging {
- 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(){
+ public static void init() {
HANDLER_GT.init();
HANDLER_GC.init();
HANDLER_TF.init();
@@ -31,7 +20,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();
@@ -41,5 +30,15 @@ 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 bd0f114b1a..89f7ec1682 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 mainRegistry() {
- addCraftingRecipies();
- addSmeltingRecipies();
- }
-
public static void addCraftingRecipies() {
-
+
}
public static void addSmeltingRecipies() {
-
+
+ }
+
+ public static void mainRegistry() {
+ CraftingManager.addCraftingRecipies();
+ CraftingManager.addSmeltingRecipies();
}
}
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index a5af5cd378..e3cf2caf9b 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -25,138 +25,126 @@ import net.minecraft.world.World;
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; //
+ 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);
+ }
+ 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);
+ }
- @Override //ContainerModTileEntity
- public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
- TileEntity te = world.getTileEntity(x, y, z);
+ 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);
+ }
- if (te != null){
- if (ID == GUI1){
- if (CORE.configSwitches.enableCustomAlvearyBlocks){
- return new CONTAINER_FrameHousing((TileAlvearyFrameHousing)te, player);
+ @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);
}
}
- else if (ID == GUI2){
- //return new CONTAINER_RTG(player, (TileEntityRTG)te);
+ else if (ID == GuiHandler.GUI2) {
+ Utils.LOG_WARNING("Opening Gui with Id: " + ID + " RTG");
+ // return new GUI_RTG((TileEntityRTG) te.);
}
-
-
}
- 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 (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 (te != null){
- if (ID == GUI4){
-
- return new Container_Workbench(player.inventory, (TileEntityWorkbench)te);
-
+ if (te != null) {
+ if (ID == GuiHandler.GUI4) {
+ return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te);
}
- if (ID == GUI5){
+ if (ID == GuiHandler.GUI5) {
Utils.LOG_INFO("sad");
- return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te);
-
+ return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te);
}
}
-
-
-
-
-
-
return null;
}
- @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);
+ @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);
}
}
- else if (ID == GUI2){
- Utils.LOG_WARNING("Opening Gui with Id: "+ID+" RTG");
- //return new GUI_RTG((TileEntityRTG) te.);
+ else if (ID == GuiHandler.GUI2) {
+ // return new CONTAINER_RTG(player, (TileEntityRTG)te);
}
+
}
- 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 (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 (te != null){
- if (ID == GUI4){
- return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te);
+ if (te != null) {
+ if (ID == GuiHandler.GUI4) {
+
+ return new Container_Workbench(player.inventory, (TileEntityWorkbench) te);
+
}
- if (ID == GUI5){
+ if (ID == GuiHandler.GUI5) {
Utils.LOG_INFO("sad");
- return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te);
+ return new Container_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 7d739bdca3..71fa76ba38 100644
--- a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java
@@ -6,23 +6,25 @@ import gtPlusPlus.core.util.Utils;
public class LateRegistrationHandler {
- 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();
- }
+ public static int recipesSuccess = 0;
+ public static int recipesFailed = 0;
+
+ private final static void init() {
+ for (final ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue) {
+ item.buildRecipe();
+ }
try {
Thread.sleep(10);
- } catch (InterruptedException e) {
+ }
+ catch (final InterruptedException e) {
Utils.LOG_INFO(e.toString());
}
- Utils.LOG_INFO("Late Recipes Loaded: "+recipesSuccess+" Failed: "+recipesFailed);
+ Utils.LOG_INFO("Late Recipes Loaded: " + LateRegistrationHandler.recipesSuccess + " Failed: "
+ + LateRegistrationHandler.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 30e15668d9..00e0327134 100644
--- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
@@ -6,24 +6,26 @@ import gtPlusPlus.core.util.Utils;
public class RegistrationHandler {
- public static int recipesSuccess = 0;
- public static int recipesFailed = 0;
-
- public static void run(){
- init();
- }
-
- private final static void init(){
+ public static int recipesSuccess = 0;
+ public static int recipesFailed = 0;
+
+ 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: "+recipesSuccess+" Failed: "+recipesFailed);
+ // RECIPES_MTWRAPPER.run();
+ Utils.LOG_INFO(
+ "Loaded: " + RegistrationHandler.recipesSuccess + " Failed: " + RegistrationHandler.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 90f231faf4..0e38e91ddb 100644
--- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java
@@ -13,12 +13,12 @@ import net.minecraft.entity.player.EntityPlayerMP;
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(PlayerEvent.PlayerLoggedInEvent event) {
+ public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
this.localPlayerRef = event.player;
this.localPlayersName = event.player.getDisplayName();
@@ -26,68 +26,71 @@ public class LoginEventHandler {
try {
+ if (this.localPlayerRef instanceof EntityPlayerMP && this.localPlayerRef != null) {
- 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)));
- }
+ // 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.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){
+ /*
+ * 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) {
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 1bbfd13123..5c962a5d2f 100644
--- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java
@@ -16,36 +16,38 @@ import net.minecraftforge.event.world.BlockEvent.BreakEvent;
public class PickaxeBlockBreakEventHandler {
@SubscribeEvent
- 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();
+ 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();
Utils.LOG_WARNING(entity.getClass().getSimpleName());
- if (entity.getClass().getSimpleName().equals("")){
+ if (entity.getClass().getSimpleName().equals("")) {
}
- 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){
+ 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) {
- UUID ownerUUID = ((GregtechMetaSafeBlockBase)X).ownerUUID;
- UUID accessorUUID = playerInternal.getUniqueID();
- Utils.LOG_WARNING("Owner UUID: "+ownerUUID);
- Utils.LOG_WARNING("Accessor UUID: "+accessorUUID);
+ 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){
-
- Utils.LOG_INFO("UUID info. Accessor: "+accessorUUID + " | Owner: "+ownerUUID);
-
- if (accessorUUID == ownerUUID){
- PlayerUtils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed.");
+ if (((GregtechMetaSafeBlockBase) X).bUnbreakable) {
+
+ Utils.LOG_INFO("UUID info. Accessor: " + accessorUUID + " | Owner: " + ownerUUID);
+
+ if (accessorUUID == ownerUUID) {
+ PlayerUtils.messagePlayer(playerInternal,
+ "Since you own this block, it has been destroyed.");
event.setCanceled(false);
}
else {
event.setCanceled(true);
- PlayerUtils.messagePlayer(playerInternal, "Since you do not own this block, it has not been destroyed.");
+ PlayerUtils.messagePlayer(playerInternal,
+ "Since you do not own this block, it has not been destroyed.");
}
//
}
@@ -54,16 +56,17 @@ public class PickaxeBlockBreakEventHandler {
}
}
- catch (NullPointerException e) {
- System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: "+e.getCause());
+ catch (final NullPointerException e) {
+ System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: " + e.getCause());
}
}
-
-
+
@SubscribeEvent
- public void onPlayerInteraction(PlayerInteractEvent aEvent) {
- if (aEvent.entityPlayer != null && aEvent.entityPlayer.worldObj != null && aEvent.action != null && aEvent.world.provider != null && !aEvent.entityPlayer.worldObj.isRemote && aEvent.action != null && aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR) {
- //Utils.LOG_ERROR("Test");
- }
- }
+ public void onPlayerInteraction(final PlayerInteractEvent aEvent) {
+ if (aEvent.entityPlayer != null && aEvent.entityPlayer.worldObj != null && aEvent.action != null
+ && aEvent.world.provider != null && !aEvent.entityPlayer.worldObj.isRemote && aEvent.action != null
+ && aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR) {
+ // Utils.LOG_ERROR("Test");
+ }
+ }
}
diff --git a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java
index 4abffed1bc..a7c25266ff 100644
--- a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java
+++ b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java
@@ -8,128 +8,123 @@ import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
-public class UnbreakableBlockManager{
+public class UnbreakableBlockManager {
private static boolean hasRun = false;
- public final BaseMetaTileEntity getmTileEntity() {
- return mTileEntity;
- }
-
-
- public final void setmTileEntity(BaseMetaTileEntity mTileEntity/*, EntityPlayer aPlayer*/) {
- UnbreakableBlockManager.mTileEntity = mTileEntity;
- if (!hasRun){
- hasRun = true;
- makeIndestructible(/*aPlayer*/);
- }
- else {
- Utils.LOG_WARNING("Why do you run twice?");
- }
- }
-
-
- //BaseMetaTileEntity
- //GregtechMetaSafeBlock
+ // BaseMetaTileEntity
+ // GregtechMetaSafeBlock
private static BaseMetaTileEntity mTileEntity = null;
+ private static void innerInvincible(final GregtechMetaSafeBlock MetaSafeBlock, final TileEntity entity,
+ final World TE_WORLD, /* EntityPlayer aPlayer, */ final int X, final int Y, final int Z) {
+ if (entity != null && !entity.equals(null)) {
+ Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value=" + MetaSafeBlock.bUnbreakable);
+ Utils.LOG_WARNING("Grabbed TE: " + entity.toString());
- private void