aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/handler
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java88
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java4
-rw-r--r--src/Java/gtPlusPlus/core/handler/CraftingManager.java4
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java44
-rw-r--r--src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java16
-rw-r--r--src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java10
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java60
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java38
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java32
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java47
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/SneakManager.java8
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java38
-rw-r--r--src/Java/gtPlusPlus/core/handler/render/CapeHandler.java184
-rw-r--r--src/Java/gtPlusPlus/core/handler/render/FirepitModel.java134
-rw-r--r--src/Java/gtPlusPlus/core/handler/render/FirepitRender.java30
-rw-r--r--src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java80
-rw-r--r--src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java43
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/gt