diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
17 files changed, 430 insertions, 430 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 1d0c9be34d..bcf8d73f86 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -1,6 +1,10 @@ package gtPlusPlus.core.handler; import static gtPlusPlus.core.lib.LoadedMods.Gregtech; + +import java.util.LinkedList; +import java.util.Queue; + import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.common.compat.*; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; @@ -13,19 +17,15 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.registration.gregtech.*; - -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 Queue<Object> RemoveRecipeQueue = new LinkedList<>(); + public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<>(); public static Boolean areInitItemsLoaded = false; - - + + public static void registerMyModsOreDictEntries(){ Utils.LOG_INFO("Registering Materials with OreDict."); @@ -38,42 +38,42 @@ public class COMPAT_HANDLER { 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(); - GregtechIndustrialFuelRefinery.run(); - GregtechTreeFarmerTE.run(); - GregtechIndustrialTreeFarm.run(); + 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(); + GregtechIndustrialFuelRefinery.run(); + GregtechTreeFarmerTE.run(); + GregtechIndustrialTreeFarm.run(); } } - + //InterMod public static void intermodOreDictionarySupport(){ - + if (LoadedMods.Big_Reactors){ COMPAT_BigReactors.OreDict(); } @@ -103,23 +103,23 @@ public class COMPAT_HANDLER { } if (LoadedMods.IndustrialCraft2){ COMPAT_IC2.OreDict(); - } + } } - + public static void RemoveRecipesFromOtherMods(){ //Removal of Recipes - for(Object item : RemoveRecipeQueue){ + for(final Object item : RemoveRecipeQueue){ RecipeUtils.removeCraftingRecipe(item); - } + } } - + public static void InitialiseHandlerThenAddRecipes(){ RegistrationHandler.run(); } public static void InitialiseLateHandlerThenAddRecipes(){ LateRegistrationHandler.run(); } - + 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 b30487c070..bf43c464e3 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -11,12 +11,12 @@ public class COMPAT_IntermodStaging { public static void preInit(){ HANDLER_GT.preInit(); - HANDLER_GC.preInit(); + HANDLER_GC.preInit(); HANDLER_TF.preInit(); HANDLER_FR.preInit(); HANDLER_IC2.preInit(); HANDLER_Computronics.preInit(); - + } public static void init(){ diff --git a/src/Java/gtPlusPlus/core/handler/CraftingManager.java b/src/Java/gtPlusPlus/core/handler/CraftingManager.java index bd0f114b1a..6fb580cc32 100644 --- a/src/Java/gtPlusPlus/core/handler/CraftingManager.java +++ b/src/Java/gtPlusPlus/core/handler/CraftingManager.java @@ -8,10 +8,10 @@ public class CraftingManager { } public static void addCraftingRecipies() { - + } public static void addSmeltingRecipies() { - + } } diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index 5f2416413b..998547d17d 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -1,5 +1,7 @@ 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.gui.beta.Gui_ID_Registry; @@ -20,8 +22,6 @@ 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 { @@ -36,18 +36,18 @@ public class GuiHandler implements IGuiHandler { - 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()); } @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 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){ @@ -94,9 +94,9 @@ public class GuiHandler implements IGuiHandler { } @Override //GuiModTileEntity - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + 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+"."); - TileEntity te = world.getTileEntity(x, y, z); + final TileEntity te = world.getTileEntity(x, y, z); if (te != null){ if (ID == GUI1){ if (CORE.configSwitches.enableCustomAlvearyBlocks){ @@ -114,7 +114,7 @@ public class GuiHandler implements IGuiHandler { { // 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()))); + return new GuiBaseBackpack(new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem()))); } if (te != null){ @@ -136,31 +136,31 @@ public class GuiHandler implements IGuiHandler { //New Methods - public static void openGui(EntityPlayer entityplayer, IGuiManager guiHandler) + public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler) { openGui(entityplayer, guiHandler, (short)0); } - public static void openGui(EntityPlayer entityplayer, IGuiManager guiHandler, short data) + public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler, final short data) { - int guiData = encodeGuiData(guiHandler, data); - ChunkCoordinates coordinates = guiHandler.getCoordinates(); + final int guiData = encodeGuiData(guiHandler, data); + final 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) + private static int encodeGuiData(final IGuiManager guiHandler, final short data) { - MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); - return data << 16 | guiId.getId(); + final MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); + return (data << 16) | guiId.getId(); } - private static MU_GuiId decodeGuiID(int guiData) + private static MU_GuiId decodeGuiID(final int guiData) { - int guiId = guiData & 0xFF; + final int guiId = guiData & 0xFF; return Gui_ID_Registry.getGuiId(guiId); } - private static short decodeGuiData(int guiId) + private static short decodeGuiData(final int guiId) { return (short)(guiId >> 16); } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java index 7d739bdca3..a24b08d781 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java @@ -8,21 +8,21 @@ public class LateRegistrationHandler { public static int recipesSuccess = 0; public static int recipesFailed = 0; - + public static void run(){ - init(); + init(); } - + private final static void init(){ - for(ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue){ - item.buildRecipe(); - } + 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); } - + } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java index 30e15668d9..e887607827 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java @@ -8,11 +8,11 @@ public class RegistrationHandler { public static int recipesSuccess = 0; public static int recipesFailed = 0; - + public static void run(){ - init(); + init(); } - + private final static void init(){ RECIPES_Tools.RECIPES_LOAD(); RECIPES_Machines.RECIPES_LOAD(); @@ -20,10 +20,10 @@ public class RegistrationHandler { RECIPES_MachineComponents.RECIPES_LOAD(); RECIPE_Batteries.RECIPES_LOAD(); RECIPES_General.RECIPES_LOAD(); - //RECIPES_MTWRAPPER.run(); + //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); } - + } diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index ee334845cb..25ec4d98c7 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -2,16 +2,17 @@ package gtPlusPlus.core.handler.events; import static gtPlusPlus.core.lib.CORE.configSwitches.chanceToDropDrainedShard; import static gtPlusPlus.core.lib.CORE.configSwitches.chanceToDropFluoriteOre; + +import java.util.ArrayList; +import java.util.Random; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.ArrayList; -import java.util.Random; - import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -19,13 +20,12 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class BlockEventHandler { - private Random random = new Random(); + private final Random random = new Random(); @SubscribeEvent - public void onBlockLeftClicked(PlayerInteractEvent event) { + public void onBlockLeftClicked(final PlayerInteractEvent event) { /*if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; ItemStack heldItem = event.entityPlayer.getHeldItem(); @@ -44,7 +44,7 @@ public class BlockEventHandler { } @SubscribeEvent - public void onEntityDrop(LivingDropsEvent event) { + public void onEntityDrop(final LivingDropsEvent event) { /*if (event.entityLiving instanceof EntityPig && event.source instanceof EntityDamageSource) { // getEntity will return the Entity that caused the damage,even for indirect damage sources like arrows/fireballs // (where it will return the Entity that shot the projectile rather than the projectile itself) @@ -63,7 +63,7 @@ public class BlockEventHandler { @SubscribeEvent - public void onBlockBreak(BlockEvent.BreakEvent event) { + public void onBlockBreak(final BlockEvent.BreakEvent event) { } @@ -74,34 +74,34 @@ public class BlockEventHandler { //Used to handle Thaumcraft Shards when TC is not installed. @SubscribeEvent - public void harvestDrops(BlockEvent.HarvestDropsEvent event) { + public void harvestDrops(final BlockEvent.HarvestDropsEvent event) { //Spawn Dull Shards (Can spawn from Tree Logs, Grass or Stone. Stone going to be the most common source.) - if ((event.block == Blocks.stone || event.block == Blocks.sandstone || event.block == Blocks.log || event.block == Blocks.log2 || event.block == Blocks.grass) - && !LoadedMods.Thaumcraft && chanceToDropDrainedShard != 0) { + if (((event.block == Blocks.stone) || (event.block == Blocks.sandstone) || (event.block == Blocks.log) || (event.block == Blocks.log2) || (event.block == Blocks.grass)) + && !LoadedMods.Thaumcraft && (chanceToDropDrainedShard != 0)) { //small chance for one to spawn per stone mined. 1 per 3 stacks~ //TODO MAKE A CONFIG OPTION if (MathUtils.randInt(1, chanceToDropDrainedShard) == 1){ //Let's sort out a lucky charm for the player. - int FancyChance = MathUtils.randInt(1, 4); + final int FancyChance = MathUtils.randInt(1, 4); if (MathUtils.randInt(1, 100) < 90){ - event.drops.add(new ItemStack(ModItems.shardDull)); + event.drops.add(new ItemStack(ModItems.shardDull)); } //Make a Fire Shard else if (FancyChance == 1){ - event.drops.add(new ItemStack(ModItems.shardIgnis)); + event.drops.add(new ItemStack(ModItems.shardIgnis)); } //Make a Water Shard. else if (FancyChance == 2){ - event.drops.add(new ItemStack(ModItems.shardAqua)); + event.drops.add(new ItemStack(ModItems.shardAqua)); } //Make an Earth Shard. else if (FancyChance == 3){ - event.drops.add(new ItemStack(ModItems.shardTerra)); + event.drops.add(new ItemStack(ModItems.shardTerra)); } //Make an Air Shard. else if (FancyChance == 4){ - event.drops.add(new ItemStack(ModItems.shardAer)); - } - } + event.drops.add(new ItemStack(ModItems.shardAer)); + } + } else { Utils.LOG_WARNING("invalid chance"); } @@ -109,34 +109,36 @@ public class BlockEventHandler { //Spawns Fluorite from Lime Stone if (chanceToDropFluoriteOre != 0){ - if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()){ - if (!oreLimestone.isEmpty()) - for (ItemStack temp : oreLimestone){ + if (!this.oreLimestone.isEmpty() || !this.blockLimestone.isEmpty()){ + if (!this.oreLimestone.isEmpty()) { + for (final ItemStack temp : this.oreLimestone){ if (ItemUtils.getSimpleStack(Item.getItemFromBlock(event.block)) == temp) { if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1){ - event.drops.add(fluoriteOre.copy()); + event.drops.add(this.fluoriteOre.copy()); } } } - if (!blockLimestone.isEmpty()) - for (ItemStack temp : blockLimestone){ + } + if (!this.blockLimestone.isEmpty()) { + for (final ItemStack temp : this.blockLimestone){ if (ItemUtils.getSimpleStack(Item.getItemFromBlock(event.block)) == temp) { if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1){ - event.drops.add(fluoriteOre.copy()); + event.drops.add(this.fluoriteOre.copy()); } } } + } } if (event.block == Blocks.sandstone){ if (MathUtils.randInt(1, chanceToDropFluoriteOre*20) == 1){ - event.drops.add(fluoriteOre.copy()); + event.drops.add(this.fluoriteOre.copy()); } } } } @SubscribeEvent - public void logsHarvest(BlockEvent.HarvestDropsEvent event) { + public void logsHarvest(final BlockEvent.HarvestDropsEvent event) { /*if (event.block instanceof BlockLog) { // http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2444501-harvestdropevent-changing-drops-of-vanilla-blocks diff --git a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java index 025d5fc8af..f1587fa82a 100644 --- a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java @@ -10,7 +10,7 @@ import net.minecraft.util.MovementInputFromOptions; */ public class CustomMovementHandler { - + public boolean isDisabled; public boolean canDoubleTap; @@ -22,17 +22,17 @@ public class CustomMovementHandler { private long lastSprintPressed; private boolean handledSneakPress; private boolean handledSprintPress; - private boolean wasRiding; + private boolean wasRiding; /* * MovementInputFromOptions.updatePlayerMoveState() */ - public void update(Minecraft mc, MovementInputFromOptions options, EntityPlayerSP thisPlayer) + public void update(final Minecraft mc, final MovementInputFromOptions options, final EntityPlayerSP thisPlayer) { options.moveStrafe = 0.0F; options.moveForward = 0.0F; - GameSettings settings = mc.gameSettings; + final GameSettings settings = mc.gameSettings; if(settings.keyBindForward.getIsKeyPressed()) { @@ -61,7 +61,7 @@ public class CustomMovementHandler { // // Check to see if Enabled - Added 6/17/14 to provide option to disable Sneak Toggle - boolean isSneaking = SneakManager.Sneaking(); + final boolean isSneaking = SneakManager.Sneaking(); //Utils.LOG_INFO("Can sneak: "+isSneaking); //Utils.LOG_INFO("Can sprint: "+SneakManager.Sprinting()); if (isSneaking) @@ -94,7 +94,7 @@ public class CustomMovementHandler { this.wasRiding = false; } // If the key was held down for more than 300ms, stop sneaking upon release. - else if(System.currentTimeMillis() - this.lastPressed > 300L) + else if((System.currentTimeMillis() - this.lastPressed) > 300L) { options.sneak = false; } @@ -109,8 +109,8 @@ public class CustomMovementHandler { if(options.sneak || SneakManager.Sneaking()) { - options.moveStrafe = (float)((double)options.moveStrafe * 0.3D); - options.moveForward = (float)((double)options.moveForward * 0.3D); + options.moveStrafe = (float)(options.moveStrafe * 0.3D); + options.moveForward = (float)(options.moveForward * 0.3D); } // @@ -118,16 +118,16 @@ public class CustomMovementHandler { // // Establish conditions where we don't want to start a sprint - sneaking, riding, flying, hungry - boolean enoughHunger = (float)thisPlayer.getFoodStats().getFoodLevel() > 6.0F || thisPlayer.capabilities.isFlying; - boolean canSprint = !options.sneak && !thisPlayer.isRiding() && !thisPlayer.capabilities.isFlying && enoughHunger; + final boolean enoughHunger = (thisPlayer.getFoodStats().getFoodLevel() > 6.0F) || thisPlayer.capabilities.isFlying; + final boolean canSprint = !options.sneak && !thisPlayer.isRiding() && !thisPlayer.capabilities.isFlying && enoughHunger; - isDisabled = !SneakManager.Sprinting(); - canDoubleTap = SneakManager.optionDoubleTap; + this.isDisabled = !SneakManager.Sprinting(); + this.canDoubleTap = SneakManager.optionDoubleTap; // Key Pressed - if((canSprint || isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) + if((canSprint || this.isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) { - if(!isDisabled) + if(!this.isDisabled) { this.sprint = !this.sprint; this.lastSprintPressed = System.currentTimeMillis(); @@ -137,10 +137,10 @@ public class CustomMovementHandler { } // Key Released - if((canSprint || isDisabled) && !settings.keyBindSprint.getIsKeyPressed() && this.handledSprintPress) + if((canSprint || this.isDisabled) && !settings.keyBindSprint.getIsKeyPressed() && this.handledSprintPress) { // Was key held for longer than 300ms? If so, mark it so we can resume vanilla behavior - if(System.currentTimeMillis() - this.lastSprintPressed > 300L) + if((System.currentTimeMillis() - this.lastSprintPressed) > 300L) { this.sprintHeldAndReleased = true; } @@ -149,7 +149,7 @@ public class CustomMovementHandler { } - public void UpdateSprint(boolean newValue, boolean doubleTapped){ + public void UpdateSprint(final boolean newValue, final boolean doubleTapped){ if (!SneakManager.Sprinting()){ this.sprint = false; this.sprintDoubleTapped = doubleTapped; @@ -157,7 +157,7 @@ public class CustomMovementHandler { else{ this.sprint = newValue; this.sprintDoubleTapped = doubleTapped; - } + } } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 40a4b6e501..0666acc7fa 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -1,19 +1,16 @@ 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.proxy.ClientProxy; 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; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class LoginEventHandler { @@ -22,7 +19,7 @@ public class LoginEventHandler { 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(); @@ -36,21 +33,22 @@ public class LoginEventHandler { try { - if (localPlayerRef instanceof EntityPlayerMP){ + if (this.localPlayerRef instanceof EntityPlayerMP){ //Populates player cache - if (!localPlayerRef.worldObj.isRemote){ - PlayerCache.appendParamChanges(localPlayersName, localPlayersUUID.toString()); + 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."); - if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) + if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) { 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."); + 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++."); + Utils.LOG_INFO("You're using the latest recommended version of GT++."); } } @@ -90,14 +88,14 @@ public class LoginEventHandler { } }; - //t.start(); + //t.start(); }*/ - } - } catch (Throwable errr){ + } + } 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 7d7a40c356..dff8d3049e 100644 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java @@ -1,46 +1,45 @@ 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 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(BreakEvent event) { + public void onBreakBlock(final BreakEvent event) { try{ - TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); + final TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); if (entity != null){ - EntityPlayer playerInternal = event.getPlayer(); + final EntityPlayer playerInternal = event.getPlayer(); Utils.LOG_WARNING(entity.getClass().getSimpleName()); 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 ((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(); + final UUID ownerUUID = ((GregtechMetaSafeBlockBase)X).ownerUUID; + final UUID accessorUUID = playerInternal.getUniqueID(); Utils.LOG_WARNING("Owner UUID: "+ownerUUID); - Utils.LOG_WARNING("Accessor UUID: "+accessorUUID); + Utils.LOG_WARNING("Accessor UUID: "+accessorUUID); if (((GregtechMetaSafeBlockBase)X).bUnbreakable){ - + Utils.LOG_INFO("UUID info. Accessor: "+accessorUUID + " | Owner: "+ownerUUID); - - if (accessorUUID == ownerUUID){ + + if (accessorUUID == ownerUUID){ PlayerUtils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed."); event.setCanceled(false); } @@ -55,16 +54,16 @@ public class PickaxeBlockBreakEventHandler { } } - catch (NullPointerException e) { + 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/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java index f330fea861..02072fe32f 100644 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java @@ -40,11 +40,11 @@ public class SneakManager { toggleState(Sprinting); } - private static State toggleState(State state){ + private static State toggleState(final State state){ Utils.LOG_INFO("State Toggle"); if (state == State.ON) { return State.OFF; - } + } return State.ON; } @@ -68,14 +68,14 @@ public class SneakManager { ON(true), OFF(false); - private boolean STATE; + private final boolean STATE; private State (final boolean State) { this.STATE = State; } public boolean getState() { - return STATE; + return this.STATE; } } diff --git a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java index 559301f4f0..0cd438c389 100644 --- a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java @@ -17,14 +17,14 @@ public class UnbreakableBlockManager{ } - public final void setmTileEntity(BaseMetaTileEntity mTileEntity/*, EntityPlayer aPlayer*/) { + public final void setmTileEntity(final BaseMetaTileEntity mTileEntity/*, EntityPlayer aPlayer*/) { UnbreakableBlockManager.mTileEntity = mTileEntity; if (!hasRun){ hasRun = true; - makeIndestructible(/*aPlayer*/); + this.makeIndestructible(/*aPlayer*/); } else { - Utils.LOG_WARNING("Why do you run twice?"); + Utils.LOG_WARNING("Why do you run twice?"); } } @@ -38,28 +38,28 @@ public class UnbreakableBlockManager{ Utils.LOG_WARNING("Initializing the code to set this TE to -1 hardness and make it indestructible."); - int X = ((BaseMetaTileEntity)mTileEntity).xCoord; //(GregtechMetaSafeBlock) this.mTileEntity.getXCoord(); - int Y = ((BaseMetaTileEntity)mTileEntity).yCoord; - int Z = ((BaseMetaTileEntity)mTileEntity).zCoord; + final int X = mTileEntity.xCoord; //(GregtechMetaSafeBlock) this.mTileEntity.getXCoord(); + final int Y = mTileEntity.yCoord; + final int Z = mTileEntity.zCoord; Utils.LOG_WARNING("Grabbing TileEntity @ [x,y,z] |"+X+"|"+Y+"|"+Z+"|"); - try{ - GregtechMetaSafeBlock MetaSafeBlock = ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()); - TileEntity BaseMetaTileEntity = ((BaseMetaTileEntity)mTileEntity).getTileEntity(X, Y, Z); + try{ + final GregtechMetaSafeBlock MetaSafeBlock = ((GregtechMetaSafeBlock) UnbreakableBlockManager.mTileEntity.getMetaTileEntity()); + final TileEntity BaseMetaTileEntity = mTileEntity.getTileEntity(X, Y, Z); //MetaSafeBlockBase. - World TE_WORLD = MetaSafeBlock.getBaseMetaTileEntity().getWorld(); + final World TE_WORLD = MetaSafeBlock.getBaseMetaTileEntity().getWorld(); Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - TileEntity entity = BaseMetaTileEntity; - innerInvincible(MetaSafeBlock, entity, TE_WORLD, /*aPlayer,*/ X, Y, Z); + final TileEntity entity = BaseMetaTileEntity; + innerInvincible(MetaSafeBlock, entity, TE_WORLD, /*aPlayer,*/ X, Y, Z); } - catch (NullPointerException e) { + catch (final NullPointerException e) { System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: "); e.printStackTrace(); } } - private static void innerInvincible(GregtechMetaSafeBlock MetaSafeBlock, TileEntity entity, World TE_WORLD, /*EntityPlayer aPlayer,*/ int X, int Y, int Z){ + 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){ Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); Utils.LOG_WARNING("Grabbed TE: "+entity.toString()); @@ -67,19 +67,19 @@ public class UnbreakableBlockManager{ - if (entity instanceof BaseTileEntity && !(entity instanceof BaseMetaPipeEntity)){ - IMetaTileEntity I = ((BaseMetaTileEntity)entity).getMetaTileEntity(); + if ((entity instanceof BaseTileEntity) && !(entity instanceof BaseMetaPipeEntity)){ + final IMetaTileEntity I = ((BaseMetaTileEntity)entity).getMetaTileEntity(); Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); Utils.LOG_WARNING("I Details: "+I.getMetaName()+" | "+I.getTileEntityBaseType()+" | "+I.toString()); - - if (I instanceof GregtechMetaSafeBlock){ + + if (I instanceof GregtechMetaSafeBlock){ Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Block ThisBlock = I.getBaseMetaTileEntity().getBlock(X, Y, Z); + final Block ThisBlock = I.getBaseMetaTileEntity().getBlock(X, Y, Z); Utils.LOG_WARNING("Block Details: "+ThisBlock.toString()); diff --git a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java index f5e87ff512..f86e1ff160 100644 --- a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java +++ b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java @@ -1,12 +1,13 @@ package gtPlusPlus.core.handler.render; +import java.util.Collection; + +import org.lwjgl.opengl.GL11; + import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; - -import java.util.Collection; - import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderManager; @@ -16,105 +17,104 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderPlayerEvent; -import org.lwjgl.opengl.GL11; - public class CapeHandler extends RenderPlayer { - private final ResourceLocation[] mCapes = { - new ResourceLocation(CORE.MODID+":textures/TesterCape.png"), - new ResourceLocation(CORE.MODID+":textures/Draknyte1.png"), - new ResourceLocation("gregtech:textures/GregoriusCape.png") }; - private final Collection<String> mCapeList; + private final ResourceLocation[] mCapes = { + new ResourceLocation(CORE.MODID+":textures/TesterCape.png"), + new ResourceLocation(CORE.MODID+":textures/Draknyte1.png"), + new ResourceLocation("gregtech:textures/GregoriusCape.png") }; + private final Collection<String> mCapeList; - public CapeHandler(Collection<String> aCapeList) { - this.mCapeList = aCapeList; - setRenderManager(RenderManager.instance); - } + public CapeHandler(final Collection<String> aCapeList) { + this.mCapeList = aCapeList; + this.setRenderManager(RenderManager.instance); + } - public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { - AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; - if (GT_Utility.getFullInvisibility(aPlayer)) { - aEvent.setCanceled(true); - return; + public void receiveRenderSpecialsEvent(final RenderPlayerEvent.Specials.Pre aEvent) { + final AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; + if (GT_Utility.getFullInvisibility(aPlayer)) { + aEvent.setCanceled(true); + return; + } + final float aPartialTicks = aEvent.partialRenderTick; + if (aPlayer.isInvisible()) { + return; + } + if (GT_Utility.getPotion(aPlayer, + Integer.valueOf(Potion.invisibility.id).intValue())) { + return; + } + try { + ResourceLocation tResource = null; + if (aPlayer.getDisplayName().equalsIgnoreCase("XW3B")) { + tResource = this.mCapes[0]; } - float aPartialTicks = aEvent.partialRenderTick; - if (aPlayer.isInvisible()) { - return; + if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) { + tResource = this.mCapes[0]; } - if (GT_Utility.getPotion(aPlayer, - Integer.valueOf(Potion.invisibility.id).intValue())) { - return; + if (aPlayer.getDisplayName().equalsIgnoreCase("Draknyte1")) { + tResource = this.mCapes[1]; } - try { - ResourceLocation tResource = null; - if (aPlayer.getDisplayName().equalsIgnoreCase("XW3B")) { - tResource = this.mCapes[0]; - } - if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) { - tResource = this.mCapes[0]; + if (aPlayer.getDisplayName().equalsIgnoreCase("GregoriusT")) { + tResource = this.mCapes[2]; + } + if ((tResource != null) && (!(aPlayer.getHideCape()))) { + this.bindTexture(tResource); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 0.125F); + final double d0 = (aPlayer.field_71091_bM + + ((aPlayer.field_71094_bP - aPlayer.field_71091_bM) + * aPartialTicks)) + - (aPlayer.prevPosX + ((aPlayer.posX - aPlayer.prevPosX) + * aPartialTicks)); + final double d1 = (aPlayer.field_71096_bN + + ((aPlayer.field_71095_bQ - aPlayer.field_71096_bN) + * aPartialTicks)) + - (aPlayer.prevPosY + ((aPlayer.posY - aPlayer.prevPosY) + * aPartialTicks)); + final double d2 = (aPlayer.field_71097_bO + + ((aPlayer.field_71085_bR - aPlayer.field_71097_bO) + * aPartialTicks)) + - (aPlayer.prevPosZ + ((aPlayer.posZ - aPlayer.prevPosZ) + * aPartialTicks)); + final float f6 = aPlayer.prevRenderYawOffset + + ((aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) + * aPartialTicks); + final double d3 = MathHelper.sin((f6 * CORE.PI) / 180.0F); + final double d4 = -MathHelper.cos((f6 * CORE.PI) / 180.0F); + float f7 = (float) d1 * 10.0F; + float f8 = (float) ((d0 * d3) + (d2 * d4)) * 100.0F; + final float f9 = (float) ((d0 * d4) - (d2 * d3)) * 100.0F; + if (f7 < -6.0F) { + f7 = -6.0F; } - if (aPlayer.getDisplayName().equalsIgnoreCase("Draknyte1")) { - tResource = this.mCapes[1]; + if (f7 > 32.0F) { + f7 = 32.0F; } - if (aPlayer.getDisplayName().equalsIgnoreCase("GregoriusT")) { - tResource = this.mCapes[2]; + if (f8 < 0.0F) { + f8 = 0.0F; } - if ((tResource != null) && (!(aPlayer.getHideCape()))) { - bindTexture(tResource); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); - double d0 = aPlayer.field_71091_bM - + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) - * aPartialTicks - - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) - * aPartialTicks); - double d1 = aPlayer.field_71096_bN - + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) - * aPartialTicks - - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) - * aPartialTicks); - double d2 = aPlayer.field_71097_bO - + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) - * aPartialTicks - - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) - * aPartialTicks); - float f6 = aPlayer.prevRenderYawOffset - + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) - * aPartialTicks; - double d3 = MathHelper.sin(f6 * CORE.PI / 180.0F); - double d4 = -MathHelper.cos(f6 * CORE.PI / 180.0F); - float f7 = (float) d1 * 10.0F; - float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F; - float f9 = (float) (d0 * d4 - (d2 * d3)) * 100.0F; - if (f7 < -6.0F) { - f7 = -6.0F; - } - if (f7 > 32.0F) { - f7 = 32.0F; - } - if (f8 < 0.0F) { - f8 = 0.0F; - } - float f10 = aPlayer.prevCameraYaw - + (aPlayer.cameraYaw - aPlayer.prevCameraYaw) - * aPartialTicks; - f7 += MathHelper - .sin((aPlayer.prevDistanceWalkedModified + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) - * aPartialTicks) * 6.0F) - * 32.0F * f10; - if (aPlayer.isSneaking()) { - f7 += 25.0F; - } - GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - ((ModelBiped) this.mainModel).renderCloak(0.0625F); - GL11.glPopMatrix(); + final float f10 = aPlayer.prevCameraYaw + + ((aPlayer.cameraYaw - aPlayer.prevCameraYaw) + * aPartialTicks); + f7 += MathHelper + .sin((aPlayer.prevDistanceWalkedModified + ((aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) + * aPartialTicks)) * 6.0F) + * 32.0F * f10; + if (aPlayer.isSneaking()) { + f7 += 25.0F; } - } catch (Throwable e) { - if (GT_Values.D1) - e.printStackTrace(GT_Log.err); + GL11.glRotatef(6.0F + (f8 / 2.0F) + f7, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + ((ModelBiped) this.mainModel).renderCloak(0.0625F); + GL11.glPopMatrix(); + } + } catch (final Throwable e) { + if (GT_Values.D1) { + e.printStackTrace(GT_Log.err); } } - + } + } diff --git a/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java b/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java index 9bad3d2f4e..845576e023 100644 --- a/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java +++ b/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java @@ -25,86 +25,86 @@ public class FirepitModel extends ModelBase public FirepitModel() { - textureWidth = 16; - textureHeight = 16; - - Side_A = new ModelRenderer(this, 0, 0); - Side_A.addBox(0F, 0F, 0F, 12, 6, 1); - Side_A.setRotationPoint(-6F, 18F, -6F); - Side_A.setTextureSize(16, 16); - Side_A.mirror = true; - setRotation(Side_A, -0.3148822F, 0F, 0F); + this.textureWidth = 16; + this.textureHeight = 16; + + this.Side_A = new ModelRenderer(this, 0, 0); + this.Side_A.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_A.setRotationPoint(-6F, 18F, -6F); + this.Side_A.setTextureSize(16, 16); + this.Side_A.mirror = true; + setRotation(this.Side_A, -0.3148822F, 0F, 0F); //Side_A.mirror = false; - Side_B = new ModelRenderer(this, 0, 0); - Side_B.addBox(0F, 0F, 0F, 12, 6, 1); - Side_B.setRotationPoint(-6F, 18F, 6F); - Side_B.setTextureSize(16, 16); - Side_B.mirror = true; - setRotation(Side_B, -0.3148822F, (CORE.PI/2), 0F); - - Side_C = new ModelRenderer(this, 0, 0); - Side_C.addBox(0F, 0F, 0F, 12, 6, 1); - Side_C.setRotationPoint(6F, 18F, 6F); - Side_C.setTextureSize(16, 16); - Side_C.mirror = true; - setRotation(Side_C, -0.3148822F, CORE.PI, 0F); + this.Side_B = new ModelRenderer(this, 0, 0); + this.Side_B.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_B.setRotationPoint(-6F, 18F, 6F); + this.Side_B.setTextureSize(16, 16); + this.Side_B.mirror = true; + setRotation(this.Side_B, -0.3148822F, (CORE.PI/2), 0F); + + this.Side_C = new ModelRenderer(this, 0, 0); + this.Side_C.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_C.setRotationPoint(6F, 18F, 6F); + this.Side_C.setTextureSize(16, 16); + this.Side_C.mirror = true; + setRotation(this.Side_C, -0.3148822F, CORE.PI, 0F); //Side_C.mirror = false; - Side_D = new ModelRenderer(this, 0, 0); - Side_D.addBox(0F, 0F, 0F, 12, 6, 1); - Side_D.setRotationPoint(6F, 18F, -6F); - Side_D.setTextureSize(16, 16); - Side_D.mirror = true; - setRotation(Side_D, -0.3148822F, 4.712389F, 0F); - - Log1 = new ModelRenderer(this, 0, 10); - Log1.addBox(0F, 0F, 0F, 14, 2, 2); - Log1.setRotationPoint(4F, 10F, -4F); - Log1.setTextureSize(16, 16); - Log1.mirror = true; - setRotation(Log1, 0F, 0F, (CORE.PI/2)); - - Log2 = new ModelRenderer(this, -2, 10); - Log2.addBox(0F, 0F, 0F, 14, 2, 2); - Log2.setRotationPoint(-4F, 10F, -4F); - Log2.setTextureSize(16, 16); - Log2.mirror = true; - setRotation(Log2, (CORE.PI/2), 0F, (CORE.PI/2)); + this.Side_D = new ModelRenderer(this, 0, 0); + this.Side_D.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_D.setRotationPoint(6F, 18F, -6F); + this.Side_D.setTextureSize(16, 16); + this.Side_D.mirror = true; + setRotation(this.Side_D, -0.3148822F, 4.712389F, 0F); + + this.Log1 = new ModelRenderer(this, 0, 10); + this.Log1.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log1.setRotationPoint(4F, 10F, -4F); + this.Log1.setTextureSize(16, 16); + this.Log1.mirror = true; + setRotation(this.Log1, 0F, 0F, (CORE.PI/2)); + + this.Log2 = new ModelRenderer(this, -2, 10); + this.Log2.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log2.setRotationPoint(-4F, 10F, -4F); + this.Log2.setTextureSize(16, 16); + this.Log2.mirror = true; + setRotation(this.Log2, (CORE.PI/2), 0F, (CORE.PI/2)); //Log2.mirror = false; - Log3 = new ModelRenderer(this, 0, 10); - Log3.addBox(0F, 0F, 0F, 14, 2, 2); - Log3.setRotationPoint(-4F, 10F, 4F); - Log3.setTextureSize(16, 16); - Log3.mirror = true; - setRotation(Log3, CORE.PI, 0F, (CORE.PI/2)); - - Log4 = new ModelRenderer(this, -2, 10); - Log4.addBox(0F, 0F, 0F, 14, 2, 2); - Log4.setRotationPoint(4F, 10F, 4F); - Log4.setTextureSize(16, 16); - Log4.mirror = true; - setRotation(Log4, 4.712389F, 0F, (CORE.PI/2)); + this.Log3 = new ModelRenderer(this, 0, 10); + this.Log3.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log3.setRotationPoint(-4F, 10F, 4F); + this.Log3.setTextureSize(16, 16); + this.Log3.mirror = true; + setRotation(this.Log3, CORE.PI, 0F, (CORE.PI/2)); + + this.Log4 = new ModelRenderer(this, -2, 10); + this.Log4.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log4.setRotationPoint(4F, 10F, 4F); + this.Log4.setTextureSize(16, 16); + this.Log4.mirror = true; + setRotation(this.Log4, 4.712389F, 0F, (CORE.PI/2)); //Log4.mirror = false; } @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + public void render(final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) { super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - Side_A.render(f5); - Side_B.render(f5); - Side_C.render(f5); - Side_D.render(f5); - Log1.render(f5); - Log2.render(f5); - Log3.render(f5); - Log4.render(f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.Side_A.render(f5); + this.Side_B.render(f5); + this.Side_C.render(f5); + this.Side_D.render(f5); + this.Log1.render(f5); + this.Log2.render(f5); + this.Log3.render(f5); + this.Log4.render(f5); } - private static void setRotation(ModelRenderer model, float x, float y, float z) + private static void setRotation(final ModelRenderer model, final float x, final float y, final float z) { model.rotateAngleX = x; model.rotateAngleY = y; @@ -112,7 +112,7 @@ public class FirepitModel extends ModelBase } @Override - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + public void setRotationAngles(final float f, final float f1, final float f2, final float f3, final float f4, final float f5, final Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java b/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java index 5a02de77b5..7b8d23e25b 100644 --- a/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java +++ b/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.handler.render; +import org.lwjgl.opengl.GL11; + import net.minecraft.block.Block; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -8,31 +10,29 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - -import org.lwjgl.opengl.GL11; public class FirepitRender extends TileEntitySpecialRenderer{ ResourceLocation texture = new ResourceLocation("miscutils" + ":"+ "textures/blocks/FirePit/mossyFirepit.png"); - private FirepitModel model; + private final FirepitModel model; public FirepitRender(){ this.model = new FirepitModel(); } - private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); + private void adjustRotatePivotViaMeta(final World world, final int x, final int y, final int z) { + final int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override - public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float i) { + public void renderTileEntityAt(final TileEntity entity, final double x, final double y, final double z, final float i) { GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.1F, (float)y + 1.0F, (float)z + 0.5F); GL11.glRotatef(180, 0F, 0F, 1F); - this.bindTexture(texture); + this.bindTexture(this.texture); GL11.glPushMatrix(); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glTranslatef(1.0f, 1.0f, 1.0f); @@ -40,16 +40,16 @@ public class FirepitRender extends TileEntitySpecialRenderer{ GL11.glPopMatrix(); } - //Set the lighting stuff, so it changes it's brightness properly. - private void adjustLightFixture(World world, int i, int j, int k, Block block) { - Tessellator tess = Tessellator.instance; + //Set the lighting stuff, so it changes it's brightness properly. + private void adjustLightFixture(final World world, final int i, final int j, final int k, final Block block) { + final Tessellator tess = Tessellator.instance; //float brightness = block.getBlockBrightness(world, i, j, k); //As of MC 1.7+ block.getBlockBrightness() has become block.getLightValue(): - float brightness = block.getLightValue(world, i, j, k); - int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); - int modulousModifier = skyLight % 65536; - int divModifier = skyLight / 65536; + final float brightness = block.getLightValue(world, i, j, k); + final int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); + final int modulousModifier = skyLight % 65536; + final int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier); } } diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java index f37886c6c0..289446eb07 100644 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java +++ b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java @@ -14,29 +14,29 @@ import net.minecraft.world.World; public class Workbench_CraftingHandler { private static final Workbench_CraftingHandler instance = new Workbench_CraftingHandler(); - private List recipes = new ArrayList(); - + private final List recipes = new ArrayList(); + public static final Workbench_CraftingHandler getInstance() { - return instance; + return instance; } public Workbench_CraftingHandler() { - - //just a example recipe so you know how to add them - addRecipe(new ItemStack(Blocks.iron_block), new Object[] - { - "###", - "###", - "###", - Character.valueOf('#'), Items.iron_ingot - }); - - //another example Recipe, but shapeless - addShapelessRecipe(new ItemStack(Items.cake),new Object[]{Items.stick}); - - + + //just a example recipe so you know how to add them + this.addRecipe(new ItemStack(Blocks.iron_block), new Object[] + { + "###", + "###", + "###", + Character.valueOf('#'), Items.iron_ingot + }); + + //another example Recipe, but shapeless + this.addShapelessRecipe(new ItemStack(Items.cake),new Object[]{Items.stick}); + + } - - void addRecipe(ItemStack par1ItemStack, Object par2ArrayOfObj[]) + + void addRecipe(final ItemStack par1ItemStack, final Object par2ArrayOfObj[]) { String s = ""; int i = 0; @@ -45,11 +45,11 @@ public class Workbench_CraftingHandler { if (par2ArrayOfObj[i] instanceof String[]) { - String as[] = (String[])par2ArrayOfObj[i++]; + final String as[] = (String[])par2ArrayOfObj[i++]; for (int l = 0; l < as.length; l++) { - String s2 = as[l]; + final String s2 = as[l]; k++; j = s2.length(); s = (new StringBuilder()).append(s).append(s2).toString(); @@ -59,18 +59,18 @@ public class Workbench_CraftingHandler { { while (par2ArrayOfObj[i] instanceof String) { - String s1 = (String)par2ArrayOfObj[i++]; + final String s1 = (String)par2ArrayOfObj[i++]; k++; j = s1.length(); s = (new StringBuilder()).append(s).append(s1).toString(); } } - HashMap hashmap = new HashMap(); + final HashMap hashmap = new HashMap(); for (; i < par2ArrayOfObj.length; i += 2) { - Character character = (Character)par2ArrayOfObj[i]; + final Character character = (Character)par2ArrayOfObj[i]; ItemStack itemstack = null; if (par2ArrayOfObj[i + 1] instanceof Item) @@ -89,11 +89,11 @@ public class Workbench_CraftingHandler { hashmap.put(character, itemstack); } - ItemStack aitemstack[] = new ItemStack[j * k]; + final ItemStack aitemstack[] = new ItemStack[j * k]; - for (int i1 = 0; i1 < j * k; i1++) + for (int i1 = 0; i1 < (j * k); i1++) { - char c = s.charAt(i1); + final char c = s.charAt(i1); if (hashmap.containsKey(Character.valueOf(c))) { @@ -105,18 +105,18 @@ public class Workbench_CraftingHandler { } } - recipes.add(new ShapedRecipes(j, k, aitemstack, par1ItemStack)); + this.recipes.add(new ShapedRecipes(j, k, aitemstack, par1ItemStack)); } - public void addShapelessRecipe(ItemStack par1ItemStack, Object par2ArrayOfObj[]) + public void addShapelessRecipe(final ItemStack par1ItemStack, final Object par2ArrayOfObj[]) { - ArrayList arraylist = new ArrayList(); - Object aobj[] = par2ArrayOfObj; - int i = aobj.length; + final ArrayList arraylist = new ArrayList(); + final Object aobj[] = par2ArrayOfObj; + final int i = aobj.length; for (int j = 0; j < i; j++) { - Object obj = aobj[j]; + final Object obj = aobj[j]; if (obj instanceof ItemStack) { @@ -140,10 +140,10 @@ public class Workbench_CraftingHandler { } } - recipes.add(new ShapelessRecipes(par1ItemStack, arraylist)); + this.recipes.add(new ShapelessRecipes(par1ItemStack, arraylist)); } - public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World) + public ItemStack findMatchingRecipe(final InventoryCrafting par1InventoryCrafting, final World par2World) { int i = 0; ItemStack itemstack = null; @@ -151,7 +151,7 @@ public class Workbench_CraftingHandler { for (int j = 0; j < par1InventoryCrafting.getSizeInventory(); j++) { - ItemStack itemstack2 = par1InventoryCrafting.getStackInSlot(j); + final ItemStack itemstack2 = par1InventoryCrafting.getStackInSlot(j); if (itemstack2 == null) { @@ -188,9 +188,9 @@ public class Workbench_CraftingHandler { return new ItemStack(itemstack.itemID, 1, k1); }*/ - for (int k = 0; k < recipes.size(); k++) + for (int k = 0; k < this.recipes.size(); k++) { - IRecipe irecipe = (IRecipe)recipes.get(k); + final IRecipe irecipe = (IRecipe)this.recipes.get(k); if (irecipe.matches(par1InventoryCrafting, par2World)) { @@ -201,9 +201,9 @@ public class Workbench_CraftingHandler { return null; } - + public List getRecipeList() { - return recipes; + return this.recipes; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java index 97ea2365c0..b68ae89e5c 100644 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java +++ b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java @@ -8,34 +8,35 @@ public class Workbench_RecipeSorter implements Comparator { final Workbench_CraftingHandler CraftingManagerCrafter; - Workbench_RecipeSorter(Workbench_CraftingHandler par1CraftingManager) + Workbench_RecipeSorter(final Workbench_CraftingHandler par1CraftingManager) { - CraftingManagerCrafter = par1CraftingManager; + this.CraftingManagerCrafter = par1CraftingManager; } - public int compareRecipes(IRecipe par1IRecipe, IRecipe par2IRecipe) + public int compareRecipes(final IRecipe par1IRecipe, final IRecipe par2IRecipe) { - if ((par1IRecipe instanceof ShapelessRecipes) && (par2IRecipe instanceof ShapedRecipes)) - { - return 1; - } - - if ((par2IRecipe instanceof ShapelessRecipes) && (par1IRecipe instanceof ShapedRecipes)) - { - return -1; - } - - if (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize()) - { - return -1; - } - - return par2IRecipe.getRecipeSize() <= par1IRecipe.getRecipeSize() ? 0 : 1; + if ((par1IRecipe instanceof ShapelessRecipes) && (par2IRecipe instanceof ShapedRecipes)) + { + return 1; + } + + if ((par2IRecipe instanceof ShapelessRecipes) && (par1IRecipe instanceof ShapedRecipes)) + { + return -1; + } + + if (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize()) + { + return -1; + } + + return par2IRecipe.getRecipeSize() <= par1IRecipe.getRecipeSize() ? 0 : 1; } - public int compare(Object par1Obj, Object par2Obj) + @Override + public int compare(final Object par1Obj, final Object par2Obj) { - return compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); + return this.compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); } }
\ No newline at end of file |