From 9414f773bbc28ab86a09cf262a4fa1859731956d Mon Sep 17 00:00:00 2001 From: LemADEC Date: Sun, 4 Oct 2015 23:50:34 +0200 Subject: [PATCH] Code cleanup --- src/main/java/cr0s/warpdrive/WarpDrive.java | 11 ++++++----- .../warpdrive/block/TileEntityLaserMedium.java | 18 +++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/WarpDrive.java b/src/main/java/cr0s/warpdrive/WarpDrive.java index dd704dbe..5de26188 100644 --- a/src/main/java/cr0s/warpdrive/WarpDrive.java +++ b/src/main/java/cr0s/warpdrive/WarpDrive.java @@ -22,6 +22,7 @@ import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Type; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; + import org.apache.logging.log4j.Logger; import cpw.mods.fml.common.FMLCommonHandler; @@ -458,15 +459,15 @@ public class WarpDrive implements LoadingCallback { } return null; } - + public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading te) { return registerChunkLoadTE(te, true); } - + public Ticket getTicket(TileEntityAbstractChunkLoading te) { return registerChunkLoadTE(te, false); } - + @Override public void ticketsLoaded(List tickets, World world) { for (Ticket ticket : tickets) { @@ -491,11 +492,11 @@ public class WarpDrive implements LoadingCallback { } } } - + ForgeChunkManager.releaseTicket(ticket); } } - + public static void addChatMessage(final ICommandSender sender, final String message) { String[] lines = message.split("\n"); for (String line : lines) { diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java b/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java index ffc86a1d..442532c8 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityLaserMedium.java @@ -7,7 +7,7 @@ import cr0s.warpdrive.config.WarpDriveConfig; public class TileEntityLaserMedium extends TileEntityAbstractEnergy { private int ticks = 0; - + public TileEntityLaserMedium() { peripheralName = "warpdriveLaserMedium"; } @@ -15,38 +15,38 @@ public class TileEntityLaserMedium extends TileEntityAbstractEnergy { @Override public void updateEntity() { super.updateEntity(); - + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { return; } - + ticks++; if (ticks > 20) { ticks = 0; - - int metadata = Math.max(0, Math.min(10, Math.round((getEnergyStored() * 10) / getMaxEnergyStored()))); + + int metadata = Math.max(0, Math.min(7, Math.round((getEnergyStored() * 8) / getMaxEnergyStored()))); if (getBlockMetadata() != metadata) { worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 3); } } } - + @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); } - + @Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); } - + // IEnergySink methods implementation @Override public int getMaxEnergyStored() { return WarpDriveConfig.LASER_MEDIUM_MAX_ENERGY_STORED; } - + @Override public boolean canInputEnergy(ForgeDirection from) { return true;