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.ForgeChunkManager.Type;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
import net.minecraftforge.common.util.EnumHelper;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
@ -458,15 +459,15 @@ public class WarpDrive implements LoadingCallback {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading te) {
|
public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading te) {
|
||||||
return registerChunkLoadTE(te, true);
|
return registerChunkLoadTE(te, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ticket getTicket(TileEntityAbstractChunkLoading te) {
|
public Ticket getTicket(TileEntityAbstractChunkLoading te) {
|
||||||
return registerChunkLoadTE(te, false);
|
return registerChunkLoadTE(te, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ticketsLoaded(List<Ticket> tickets, World world) {
|
public void ticketsLoaded(List<Ticket> tickets, World world) {
|
||||||
for (Ticket ticket : tickets) {
|
for (Ticket ticket : tickets) {
|
||||||
|
@ -491,11 +492,11 @@ public class WarpDrive implements LoadingCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ForgeChunkManager.releaseTicket(ticket);
|
ForgeChunkManager.releaseTicket(ticket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addChatMessage(final ICommandSender sender, final String message) {
|
public static void addChatMessage(final ICommandSender sender, final String message) {
|
||||||
String[] lines = message.split("\n");
|
String[] lines = message.split("\n");
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import cr0s.warpdrive.config.WarpDriveConfig;
|
||||||
|
|
||||||
public class TileEntityLaserMedium extends TileEntityAbstractEnergy {
|
public class TileEntityLaserMedium extends TileEntityAbstractEnergy {
|
||||||
private int ticks = 0;
|
private int ticks = 0;
|
||||||
|
|
||||||
public TileEntityLaserMedium() {
|
public TileEntityLaserMedium() {
|
||||||
peripheralName = "warpdriveLaserMedium";
|
peripheralName = "warpdriveLaserMedium";
|
||||||
}
|
}
|
||||||
|
@ -15,38 +15,38 @@ public class TileEntityLaserMedium extends TileEntityAbstractEnergy {
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
if (ticks > 20) {
|
if (ticks > 20) {
|
||||||
ticks = 0;
|
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) {
|
if (getBlockMetadata() != metadata) {
|
||||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 3);
|
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
super.readFromNBT(tag);
|
super.readFromNBT(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound tag) {
|
public void writeToNBT(NBTTagCompound tag) {
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IEnergySink methods implementation
|
// IEnergySink methods implementation
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergyStored() {
|
public int getMaxEnergyStored() {
|
||||||
return WarpDriveConfig.LASER_MEDIUM_MAX_ENERGY_STORED;
|
return WarpDriveConfig.LASER_MEDIUM_MAX_ENERGY_STORED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInputEnergy(ForgeDirection from) {
|
public boolean canInputEnergy(ForgeDirection from) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue