aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/handler/events
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-03-04 12:58:47 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-03-04 12:58:47 +1000
commitae21012d216df71f31aed6fbc9d76215fc24ceed (patch)
treecc89accbe6ce5c04b72ed3c5e46b2a185f88be6a /src/Java/gtPlusPlus/core/handler/events
parentba89972a22a316030f8c3bd99974f915b1d7aefc (diff)
downloadGT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.gz
GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.bz2
GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.zip
+ New texture for the slow builders ring.
+ Added the Alkalus Disk. $ Fixed Frame Box Assembler Recipes. $ Fixed Missing 7Li material. $ Fixed Tiered Tanks not showing their capacity in the tooltip. $ Fixed tooltips for alloys containing Bronze or Steel. $ Fixed Clay Pipe Extruder Recipes. - Removed a handful of Plasma cells for misc. materials. % Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements. % Cleaned up The Entire Project.
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler/events')
-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
6 files changed, 111 insertions, 112 deletions
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());