From 638787d1407b156b115f3f5f4610d9ae0916ca37 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Mon, 29 May 2017 15:51:22 +0200 Subject: [PATCH] Code cleanup --- .../breathing/TileEntityAirGenerator.java | 18 ++++++++++-------- .../collection/TileEntityLaserTreeFarm.java | 1 + .../collection/TileEntityMiningLaser.java | 1 + .../block/detection/TileEntitySiren.java | 1 + .../energy/TileEntityEnanReactorLaser.java | 8 ++++---- .../cr0s/warpdrive/compat/CompatSGCraft.java | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java b/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java index c1e72fbe..4d1d82b0 100644 --- a/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java +++ b/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java @@ -17,6 +17,7 @@ import cpw.mods.fml.common.Optional; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityAirGenerator extends TileEntityAbstractEnergy { + private int cooldownTicks = 0; private boolean isEnabled = true; private static final int START_CONCENTRATION_VALUE = 15; @@ -99,15 +100,15 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy { } @Override - public void readFromNBT(NBTTagCompound tag) { - super.readFromNBT(tag); - isEnabled = tag.getBoolean("isEnabled"); + public void readFromNBT(final NBTTagCompound tagCompound) { + super.readFromNBT(tagCompound); + isEnabled = tagCompound.getBoolean("isEnabled"); } @Override - public void writeToNBT(NBTTagCompound tag) { - super.writeToNBT(tag); - tag.setBoolean("isEnabled", isEnabled); + public void writeToNBT(final NBTTagCompound tagCompound) { + super.writeToNBT(tagCompound); + tagCompound.setBoolean("isEnabled", isEnabled); } @Override @@ -128,6 +129,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy { xCoord, yCoord, zCoord); } + // Common OC/CC methods public Object[] enable(Object[] arguments) { if (arguments.length == 1) { isEnabled = Commons.toBool(arguments[0]); @@ -149,8 +151,8 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy { String methodName = getMethodName(method); switch (methodName) { - case "enable": - return enable(arguments); + case "enable": + return enable(arguments); } return super.callMethod(computer, context, method, arguments); diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java index ccdeebc3..f5f95aa5 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java @@ -29,6 +29,7 @@ import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { + private boolean breakLeaves = false; private boolean tapTrees = false; diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java index 479ee85a..fcc5bbed 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java @@ -25,6 +25,7 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; public class TileEntityMiningLaser extends TileEntityAbstractMiner { + private final boolean canSilktouch = (WarpDriveConfig.MINING_LASER_SILKTOUCH_DEUTERIUM_L <= 0 || FluidRegistry.isFluidRegistered("deuterium")); private boolean isActive() { diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java index 5b7c71ac..efbdac3d 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntitySiren.java @@ -11,6 +11,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class TileEntitySiren extends TileEntityAbstractBase { + public enum SirenState { STARTING, STARTED, STOPPING, STOPPED } diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java index fabd51fa..e0ce26ba 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorLaser.java @@ -134,13 +134,13 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser { } @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); + public void writeToNBT(final NBTTagCompound tagCompound) { + super.writeToNBT(tagCompound); } @Override - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); + public void readFromNBT(final NBTTagCompound tagCompound) { + super.readFromNBT(tagCompound); } // OpenComputers callback methods diff --git a/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java b/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java index dbab84dd..067b9eab 100644 --- a/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java +++ b/src/main/java/cr0s/warpdrive/compat/CompatSGCraft.java @@ -47,7 +47,7 @@ public class CompatSGCraft implements IBlockTransformer { Object object = methodSGBaseTE_sgStateDescription.invoke(tileEntity); String state = (String)object; if (!state.equalsIgnoreCase("Idle")) { - reason.append("Stargate is active (" + state + ")!"); + reason.append(String.format("Stargate is active (%s)!", state)); return false; } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {