From e0cbb632f71d6650e5b1840a5c88fa44baf5fab8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 19 Feb 2018 01:58:43 +0100 Subject: [PATCH] Code cleanup --- src/main/java/cr0s/warpdrive/Commons.java | 2 +- .../java/cr0s/warpdrive/block/TileEntityLaser.java | 10 +++++----- .../block/forcefield/TileEntityAbstractForceField.java | 9 ++++----- .../block/forcefield/TileEntityForceField.java | 5 +++-- src/main/java/cr0s/warpdrive/config/Dictionary.java | 3 ++- .../java/cr0s/warpdrive/data/CameraRegistryItem.java | 2 +- src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java | 1 + 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/Commons.java b/src/main/java/cr0s/warpdrive/Commons.java index be3b49f0..57e7ebb7 100644 --- a/src/main/java/cr0s/warpdrive/Commons.java +++ b/src/main/java/cr0s/warpdrive/Commons.java @@ -528,7 +528,7 @@ public class Commons { final List onlinePlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; for (final EntityPlayer onlinePlayer : onlinePlayers) { if (onlinePlayer.getCommandSenderName().equalsIgnoreCase(playerNameOrSelector) && onlinePlayer instanceof EntityPlayerMP) { - return new EntityPlayerMP[]{ (EntityPlayerMP)onlinePlayer }; + return new EntityPlayerMP[] { (EntityPlayerMP)onlinePlayer }; } } diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java index e5bfc012..4fe38c53 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java @@ -518,9 +518,9 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre beamFrequency = parBeamFrequency; } final Vector3 vRGB = IBeamFrequency.getBeamColor(beamFrequency); - r = (float)vRGB.x; - g = (float)vRGB.y; - b = (float)vRGB.z; + r = (float) vRGB.x; + g = (float) vRGB.y; + b = (float) vRGB.z; } private void playSoundCorrespondsEnergy(int energy) { @@ -634,13 +634,13 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre return emitBeam(arguments); case "position": - return new Integer[]{ xCoord, yCoord, zCoord }; + return new Integer[] { xCoord, yCoord, zCoord }; case "beamFrequency": if (arguments.length == 1) { setBeamFrequency(Commons.toInt(arguments[0])); } - return new Integer[]{ beamFrequency }; + return new Integer[] { beamFrequency }; case "getScanResult": return getScanResult(); diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java index d3b173b4..5f849d68 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java @@ -18,7 +18,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.StatCollector; import cpw.mods.fml.common.Optional; @@ -28,15 +27,15 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple protected byte tier = -1; protected int beamFrequency = -1; public boolean isEnabled = true; + protected boolean isConnected = false; // computed properties protected Vector3 vRGB; - protected boolean isConnected = false; public TileEntityAbstractForceField() { super(); - - addMethods(new String[]{ + + addMethods(new String[] { "enable", "beamFrequency" }); @@ -186,7 +185,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple if (arguments.length == 1) { setBeamFrequency(Commons.toInt(arguments[0])); } - return new Integer[]{ beamFrequency }; + return new Integer[] { beamFrequency }; } } catch (Exception exception) { exception.printStackTrace(); diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java index 304de505..f5b31f23 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceField.java @@ -16,8 +16,9 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileEntityForceField extends TileEntityAbstractBase { + private VectorI vProjector; - + // cache parameters used for rendering, force projector check for others private int cache_beamFrequency; public Block cache_blockCamouflage; @@ -154,7 +155,7 @@ public class TileEntityForceField extends TileEntityAbstractBase { } public ForceFieldSetup getForceFieldSetup() { - TileEntityForceFieldProjector tileEntityForceFieldProjector = getProjector(); + final TileEntityForceFieldProjector tileEntityForceFieldProjector = getProjector(); if (tileEntityForceFieldProjector == null) { return null; } diff --git a/src/main/java/cr0s/warpdrive/config/Dictionary.java b/src/main/java/cr0s/warpdrive/config/Dictionary.java index e79a0098..71ac9861 100644 --- a/src/main/java/cr0s/warpdrive/config/Dictionary.java +++ b/src/main/java/cr0s/warpdrive/config/Dictionary.java @@ -214,7 +214,8 @@ public class Dictionary { + "Tags shall be separated by at least one space, comma or tabulation.\n" + "Invalid tags will be ignored silently. Tags and block names are case sensitive.\n" + "In case of conflicts, the latest tag overwrite the previous ones.\n" + "- Anchor: ship can't move with this entity aboard (default: none).\n" + "- NoMass: this entity doesn't count when calculating ship volume/mass (default: Galacticraft air bubble).\n" - + "- LeftBehind: this entity won't move with your ship (default: Galacticraft air bubble).\n" + + "- LeftBehind: this entity won't move with your ship nor transporter (default: Galacticraft air bubble).\n" +// + "- NoTransport: this entity is ignored by the transporter (default: -none-).\n" + "- NonLivingTarget: this non-living entity can be targeted/removed by weapons (default: ItemFrame, Painting).\n" + "- LivingWithoutAir: this living entity doesn't need air to live (default: vanilla zombies and skeletons)."); diff --git a/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java b/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java index 74902bde..5626105d 100644 --- a/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java +++ b/src/main/java/cr0s/warpdrive/data/CameraRegistryItem.java @@ -26,6 +26,6 @@ public class CameraRegistryItem { && position.chunkPosX == tileEntity.xCoord && position.chunkPosY == tileEntity.yCoord && position.chunkPosZ == tileEntity.zCoord - && videoChannel == ((IVideoChannel)tileEntity).getVideoChannel(); + && videoChannel == ((IVideoChannel) tileEntity).getVideoChannel(); } } \ No newline at end of file diff --git a/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java b/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java index e928d7dd..5662d322 100644 --- a/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java +++ b/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java @@ -29,6 +29,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class ForceFieldSetup extends GlobalPosition { + private static final float FORCEFIELD_BASE_SCAN_SPEED_BLOCKS_PER_SECOND = 100; private static final float FORCEFIELD_BASE_PLACE_SPEED_BLOCKS_PER_SECOND = 20; private static final float FORCEFIELD_MAX_SCAN_SPEED_BLOCKS_PER_SECOND = 10000;