Code cleanup

This commit is contained in:
LemADEC 2017-05-29 15:51:22 +02:00
parent a06b6a441b
commit 638787d140
6 changed files with 18 additions and 13 deletions

View file

@ -17,6 +17,7 @@ import cpw.mods.fml.common.Optional;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityAirGenerator extends TileEntityAbstractEnergy { public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
private int cooldownTicks = 0; private int cooldownTicks = 0;
private boolean isEnabled = true; private boolean isEnabled = true;
private static final int START_CONCENTRATION_VALUE = 15; private static final int START_CONCENTRATION_VALUE = 15;
@ -99,15 +100,15 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
} }
@Override @Override
public void readFromNBT(NBTTagCompound tag) { public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tag); super.readFromNBT(tagCompound);
isEnabled = tag.getBoolean("isEnabled"); isEnabled = tagCompound.getBoolean("isEnabled");
} }
@Override @Override
public void writeToNBT(NBTTagCompound tag) { public void writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tag); super.writeToNBT(tagCompound);
tag.setBoolean("isEnabled", isEnabled); tagCompound.setBoolean("isEnabled", isEnabled);
} }
@Override @Override
@ -128,6 +129,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
xCoord, yCoord, zCoord); xCoord, yCoord, zCoord);
} }
// Common OC/CC methods
public Object[] enable(Object[] arguments) { public Object[] enable(Object[] arguments) {
if (arguments.length == 1) { if (arguments.length == 1) {
isEnabled = Commons.toBool(arguments[0]); isEnabled = Commons.toBool(arguments[0]);
@ -149,8 +151,8 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
String methodName = getMethodName(method); String methodName = getMethodName(method);
switch (methodName) { switch (methodName) {
case "enable": case "enable":
return enable(arguments); return enable(arguments);
} }
return super.callMethod(computer, context, method, arguments); return super.callMethod(computer, context, method, arguments);

View file

@ -29,6 +29,7 @@ import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
private boolean breakLeaves = false; private boolean breakLeaves = false;
private boolean tapTrees = false; private boolean tapTrees = false;

View file

@ -25,6 +25,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
public class TileEntityMiningLaser extends TileEntityAbstractMiner { public class TileEntityMiningLaser extends TileEntityAbstractMiner {
private final boolean canSilktouch = (WarpDriveConfig.MINING_LASER_SILKTOUCH_DEUTERIUM_L <= 0 || FluidRegistry.isFluidRegistered("deuterium")); private final boolean canSilktouch = (WarpDriveConfig.MINING_LASER_SILKTOUCH_DEUTERIUM_L <= 0 || FluidRegistry.isFluidRegistered("deuterium"));
private boolean isActive() { private boolean isActive() {

View file

@ -11,6 +11,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class TileEntitySiren extends TileEntityAbstractBase { public class TileEntitySiren extends TileEntityAbstractBase {
public enum SirenState { public enum SirenState {
STARTING, STARTED, STOPPING, STOPPED STARTING, STARTED, STOPPING, STOPPED
} }

View file

@ -134,13 +134,13 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser {
} }
@Override @Override
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(nbt); super.writeToNBT(tagCompound);
} }
@Override @Override
public void readFromNBT(NBTTagCompound nbt) { public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(nbt); super.readFromNBT(tagCompound);
} }
// OpenComputers callback methods // OpenComputers callback methods

View file

@ -47,7 +47,7 @@ public class CompatSGCraft implements IBlockTransformer {
Object object = methodSGBaseTE_sgStateDescription.invoke(tileEntity); Object object = methodSGBaseTE_sgStateDescription.invoke(tileEntity);
String state = (String)object; String state = (String)object;
if (!state.equalsIgnoreCase("Idle")) { if (!state.equalsIgnoreCase("Idle")) {
reason.append("Stargate is active (" + state + ")!"); reason.append(String.format("Stargate is active (%s)!", state));
return false; return false;
} }
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {