Code cleanup
This commit is contained in:
parent
26f4cc34d5
commit
9414f773bb
2 changed files with 15 additions and 14 deletions
|
@ -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<Ticket> 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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue