Code cleanup

This commit is contained in:
Unknown 2018-02-04 22:38:46 +01:00
parent 535da4c617
commit 8621d2911a
96 changed files with 211 additions and 210 deletions

View file

@ -18,7 +18,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.io.File;
import java.io.FileInputStream;
@ -37,6 +36,7 @@ import java.util.Random;
import java.util.Set;
import cpw.mods.fml.common.Optional;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Common static methods
@ -166,15 +166,15 @@ public class Commons {
fieldToReturn = clazz.getDeclaredField(obfuscatedName);
} catch (Exception exception2) {
exception2.printStackTrace();
String map = "";
StringBuilder map = new StringBuilder();
for (Field fieldDeclared : clazz.getDeclaredFields()) {
if (!map.isEmpty()) {
map += ", ";
if (map.length() > 0) {
map.append(", ");
}
map += fieldDeclared.getName();
map.append(fieldDeclared.getName());
}
WarpDrive.logger.error(String.format("Unable to find %1$s field in %2$s class. Available fields are: %3$s",
deobfuscatedName, clazz.toString(), map));
deobfuscatedName, clazz.toString(), map.toString()));
}
}
if (fieldToReturn != null) {
@ -255,8 +255,7 @@ public class Commons {
toIgnore.addAll(Arrays.asList(ignore));
}
Set<VectorI> toIterate = new HashSet<>();
toIterate.addAll(start);
Set<VectorI> toIterate = new HashSet<>(start);
Set<VectorI> toIterateNext;

View file

@ -19,9 +19,9 @@ public class BlockLaser extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
private IIcon[] iconBuffer;
private static final int ICON_SIDE = 0;
public BlockLaser() {
super(Material.iron);
setHardness(50.0F);
@ -31,44 +31,35 @@ public class BlockLaser extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = iconRegister.registerIcon("warpdrive:laserSide");
iconBuffer[ICON_SIDE] = iconRegister.registerIcon("warpdrive:laser-side");
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(final int side, final int metadata) {
return iconBuffer[ICON_SIDE];
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityLaser();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
public int quantityDropped(final Random random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
public Item getItemDropped(final int metadata, final Random random, final int fortune) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer entityPlayer,
final int side, final float hitX, final float hitY, final float hitZ) {
if (world.isRemote) {
return false;
}

View file

@ -14,6 +14,8 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockLaserMedium extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
private IIcon[] iconBuffer;
public BlockLaserMedium() {
@ -23,22 +25,22 @@ public class BlockLaserMedium extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[9];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:laserMediumSide0");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:laserMediumSide1");
iconBuffer[2] = iconRegister.registerIcon("warpdrive:laserMediumSide2");
iconBuffer[3] = iconRegister.registerIcon("warpdrive:laserMediumSide3");
iconBuffer[4] = iconRegister.registerIcon("warpdrive:laserMediumSide4");
iconBuffer[5] = iconRegister.registerIcon("warpdrive:laserMediumSide5");
iconBuffer[6] = iconRegister.registerIcon("warpdrive:laserMediumSide6");
iconBuffer[7] = iconRegister.registerIcon("warpdrive:laserMediumSide7");
iconBuffer[8] = iconRegister.registerIcon("warpdrive:laserMediumTopBottom");
iconBuffer[0] = iconRegister.registerIcon("warpdrive:laser_medium-side0");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:laser_medium-side1");
iconBuffer[2] = iconRegister.registerIcon("warpdrive:laser_medium-side2");
iconBuffer[3] = iconRegister.registerIcon("warpdrive:laser_medium-side3");
iconBuffer[4] = iconRegister.registerIcon("warpdrive:laser_medium-side4");
iconBuffer[5] = iconRegister.registerIcon("warpdrive:laser_medium-side5");
iconBuffer[6] = iconRegister.registerIcon("warpdrive:laser_medium-side6");
iconBuffer[7] = iconRegister.registerIcon("warpdrive:laser_medium-side7");
iconBuffer[8] = iconRegister.registerIcon("warpdrive:laser_medium-top_bottom");
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
public IIcon getIcon(final IBlockAccess blockAccess, final int x, final int y, final int z, final int side) {
final int metadata = blockAccess.getBlockMetadata(x, y, z);
if (side == 0 || side == 1) {
return iconBuffer[8];
@ -49,7 +51,7 @@ public class BlockLaserMedium extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(final int side, final int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[8];
}
@ -58,21 +60,19 @@ public class BlockLaserMedium extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityLaserMedium();
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer entityPlayer,
final int side, final float hitX, final float hitY, final float hitZ) {
if (world.isRemote) {
return false;
}
if (entityPlayer.getHeldItem() == null) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityLaserMedium) {
Commons.addChatMessage(entityPlayer, ((TileEntityLaserMedium) tileEntity).getStatus());
return true;

View file

@ -306,21 +306,25 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
return mapResult;
}
public int getValidUpgradeCount(final Object upgrade) {
return Math.min(getUpgradeMaxCount(upgrade), getUpgradeCount(upgrade));
}
public int getUpgradeCount(final Object upgrade) {
Integer value = installedUpgrades.get(upgrade);
final Integer value = installedUpgrades.get(upgrade);
return value == null ? 0 : value;
}
public int getUpgradeMaxCount(final Object upgrade) {
Integer value = maxUpgrades.get(upgrade);
final Integer value = maxUpgrades.get(upgrade);
return value == null ? 0 : value;
}
protected String getUpgradesAsString() {
String message = "";
final StringBuilder message = new StringBuilder();
for (final Entry<Object, Integer> entry : installedUpgrades.entrySet()) {
if (!message.isEmpty()) {
message += ", ";
if (message.length() > 0) {
message.append(", ");
}
final Object key = entry.getKey();
String keyName = key.toString();
@ -330,12 +334,12 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
keyName = ((Block) key).getUnlocalizedName();
}
if (entry.getValue() == 1) {
message += keyName;
message.append(keyName);
} else {
message += entry.getValue() + " x " + keyName;
message.append(entry.getValue()).append(" x ").append(keyName);
}
}
return message;
return message.toString();
}
protected void setUpgradeMaxCount(final Object upgrade, final int value) {
@ -356,7 +360,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
}
public boolean dismountUpgrade(final Object upgrade) {
int count = getUpgradeCount(upgrade);
final int count = getUpgradeCount(upgrade);
if (count > 1) {
installedUpgrades.put(upgrade, count - 1);
markDirty();

View file

@ -675,7 +675,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
return String.format("%s Beam \'%d\' @ %s (%d %d %d)",
getClass().getSimpleName(),
beamFrequency,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -25,7 +25,7 @@ public class BlockAcceleratorControlPoint extends BlockAbstractAccelerator imple
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[2];
icons[0] = iconRegister.registerIcon(getTextureName() + "-off");
@ -57,7 +57,7 @@ public class BlockAcceleratorControlPoint extends BlockAbstractAccelerator imple
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityAcceleratorControlPoint();
}
}

View file

@ -28,7 +28,7 @@ public class BlockAcceleratorController extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[2];
icons[0] = iconRegister.registerIcon(getTextureName() + "-off");
@ -64,7 +64,7 @@ public class BlockAcceleratorController extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityAcceleratorController();
}
}

View file

@ -32,7 +32,7 @@ public class BlockChiller extends BlockAbstractAccelerator {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[2];
icons[0] = iconRegister.registerIcon(getTextureName() + "-off");

View file

@ -17,7 +17,7 @@ public class BlockElectromagnetGlass extends BlockElectromagnetPlain {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconSide = iconRegister.registerIcon("warpdrive:atomic/electromagnet" + tier + "_glass-side");
iconTop = iconRegister.registerIcon("warpdrive:atomic/electromagnet" + tier + "_glass-top");
}

View file

@ -20,7 +20,7 @@ public class BlockElectromagnetPlain extends BlockAbstractAccelerator {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconSide = iconRegister.registerIcon("warpdrive:atomic/electromagnet" + tier + "_plain-side");
iconTop = iconRegister.registerIcon("warpdrive:atomic/electromagnet" + tier + "_plain-top");
}

View file

@ -21,7 +21,7 @@ public class BlockParticlesInjector extends BlockAcceleratorControlPoint {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[2];
icons[0] = iconRegister.registerIcon(getTextureName() + "-off");
@ -35,7 +35,7 @@ public class BlockParticlesInjector extends BlockAcceleratorControlPoint {
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityParticlesInjector();
}
}

View file

@ -58,7 +58,9 @@ public class TileEntityAcceleratorController extends TileEntityAbstractEnergy im
@Override
public String toString() {
return String.format("%s @ \'%s\' (%d %d %d)", getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(), xCoord, yCoord, zCoord);
return String.format("%s @ \'%s\' (%d %d %d)",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -82,7 +82,7 @@ public abstract class BlockAbstractAir extends BlockAbstractBase {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
if (WarpDriveConfig.BREATHING_AIR_BLOCK_DEBUG) {
iconBuffer = new IIcon[16];
iconBuffer[ 0] = iconRegister.registerIcon("warpdrive:breathing/air0");

View file

@ -38,7 +38,7 @@ public class BlockAirGenerator extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[ICON_INACTIVE_SIDE] = iconRegister.registerIcon("warpdrive:breathing/air_generator-side_inactive");
iconBuffer[ICON_BOTTOM] = iconRegister.registerIcon("warpdrive:breathing/air_generator-connection");
@ -77,7 +77,7 @@ public class BlockAirGenerator extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityAirGenerator();
}

View file

@ -42,7 +42,7 @@ public class BlockAirGeneratorTiered extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[ICON_INACTIVE_SIDE] = iconRegister.registerIcon("warpdrive:breathing/air_generator-side_inactive");
iconBuffer[ICON_BOTTOM] = iconRegister.registerIcon("warpdrive:breathing/air_generator-connection");
@ -75,7 +75,7 @@ public class BlockAirGeneratorTiered extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityAirGeneratorTiered();
}

View file

@ -126,7 +126,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
public String toString() {
return String.format("%s @ %s (%d %d %d)",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}

View file

@ -148,7 +148,7 @@ public class TileEntityAirGeneratorTiered extends TileEntityAbstractEnergy {
public String toString() {
return String.format("%s @ %s (%d %d %d)",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}

View file

@ -38,7 +38,7 @@ public class BlockShipScanner extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ICON_BOTTOM ] = iconRegister.registerIcon("warpdrive:building/shipScannerBottom");
iconBuffer[ICON_TOP ] = iconRegister.registerIcon("warpdrive:building/shipScannerTop");
@ -111,7 +111,7 @@ public class BlockShipScanner extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityShipScanner();
}

View file

@ -775,7 +775,7 @@ public class TileEntityShipScanner extends TileEntityAbstractInterfaced implemen
public String toString() {
return String.format("%s @ %s (%d %d %d)",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -38,7 +38,7 @@ public class BlockLaserTreeFarm extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ICON_IDLE ] = iconRegister.registerIcon("warpdrive:collection/laserTreeFarmSide_idle");
iconBuffer[ICON_FARMING_LOW_POWER ] = iconRegister.registerIcon("warpdrive:collection/laserTreeFarmSide_farmingLowPower");
@ -80,7 +80,7 @@ public class BlockLaserTreeFarm extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityLaserTreeFarm();
}

View file

@ -36,7 +36,7 @@ public class BlockMiningLaser extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ICON_IDLE ] = iconRegister.registerIcon("warpdrive:collection/miningLaserSide_idle");
iconBuffer[ICON_MINING_LOW_POWER ] = iconRegister.registerIcon("warpdrive:collection/miningLaserSide_miningLowPower");
@ -76,7 +76,7 @@ public class BlockMiningLaser extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityMiningLaser();
}

View file

@ -556,6 +556,8 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
@Override
public String toString() {
return String.format("%s @ \'%s\' %d, %d, %d",
getClass().getSimpleName(), worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(), xCoord, yCoord, zCoord);
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -31,7 +31,7 @@ public class BlockCamera extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = iconRegister.registerIcon("warpdrive:detection/cameraSide");
@ -49,7 +49,7 @@ public class BlockCamera extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityCamera();
}

View file

@ -38,7 +38,7 @@ public class BlockCloakingCoil extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[4];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:detection/cloaking_coil-channeling_inactive");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:detection/cloaking_coil-projecting_inactive");

View file

@ -32,7 +32,7 @@ public class BlockCloakingCore extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[2];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:detection/cloakingCoreInactive");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:detection/cloakingCoreActive");
@ -56,7 +56,7 @@ public class BlockCloakingCore extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityCloakingCore();
}

View file

@ -33,7 +33,7 @@ public class BlockMonitor extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconFront = iconRegister.registerIcon("warpdrive:detection/monitorFront");
iconSide = iconRegister.registerIcon("warpdrive:detection/monitorSide");
}
@ -85,7 +85,7 @@ public class BlockMonitor extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityMonitor();
}
}

View file

@ -36,7 +36,7 @@ public class BlockRadar extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[16];
iconBuffer[ICON_SIDE_INACTIVE ] = iconRegister.registerIcon("warpdrive:detection/radarSideInactive");
iconBuffer[ICON_BOTTOM ] = iconRegister.registerIcon("warpdrive:detection/radarBottom");
@ -80,7 +80,7 @@ public class BlockRadar extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityRadar();
}

View file

@ -42,7 +42,7 @@ public class BlockSiren extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[4];
// Solid textures
iconBuffer[ICON_INDUSTRIAL] = iconRegister.registerIcon("warpdrive:detection/siren_industrial");
@ -75,7 +75,7 @@ public class BlockSiren extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntitySiren();
}

View file

@ -28,7 +28,7 @@ public class BlockWarpIsolation extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[1];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:detection/warpIsolation");
}

View file

@ -190,9 +190,9 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced implements IV
@Override
public String toString() {
return String.format("%s %d @ %s (%d %d %d)",
getClass().getSimpleName(),
videoChannel,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
xCoord, yCoord, zCoord);
getClass().getSimpleName(),
videoChannel,
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -148,10 +148,10 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I
@Override
public String toString() {
return String.format("%s %d @ %s (%d %d %d)",
getClass().getSimpleName(),
videoChannel,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
xCoord, yCoord, zCoord);
return String.format("%s %d @ %s (%d %d %d)",
getClass().getSimpleName(),
videoChannel,
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -109,7 +109,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy {
Vector3 vec3Position = StarMapRegistry.getUniversalCoordinates(celestialObject, xCoord, yCoord, zCoord);
return new Object[] { xCoord, yCoord, zCoord, celestialObject.getDisplayName(), vec3Position.x, vec3Position.y, vec3Position.z };
} else {
String name = worldObj.getWorldInfo().getWorldName();
String name = worldObj.provider.getDimensionName();
if (name == null || name.isEmpty()) {
name = "DIM" + worldObj.provider.dimensionId;
}

View file

@ -32,7 +32,7 @@ public class BlockEnanReactorCore extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[17];
iconBuffer[16] = iconRegister.registerIcon("warpdrive:energy/enan_reactor_core-top_bottom");
iconBuffer[ 0] = iconRegister.registerIcon("warpdrive:energy/enan_reactor_core-side00");

View file

@ -25,13 +25,13 @@ public class BlockEnanReactorLaser extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityEnanReactorLaser();
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:energy/enan_reactor_laser-top_bottom");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:energy/enan_reactor_laser-side_inactive");

View file

@ -39,18 +39,18 @@ public class BlockEnergyBank extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityEnergyBank((byte)(metadata % 4));
}
@Override
public int damageDropped(int metadata) {
public int damageDropped(final int metadata) {
return metadata;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTab, List list) {
public void getSubBlocks(final Item item, final CreativeTabs creativeTab, final List list) {
for (byte tier = 0; tier < 4; tier++) {
ItemStack itemStack = new ItemStack(item, 1, tier);
list.add(itemStack);
@ -67,7 +67,7 @@ public class BlockEnergyBank extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[12];
icons[ 0] = iconRegister.registerIcon("warpdrive:energy/energy_bank_creative-disabled");
icons[ 1] = iconRegister.registerIcon("warpdrive:energy/energy_bank_creative-input");
@ -119,21 +119,22 @@ public class BlockEnergyBank extends BlockAbstractContainer {
return false;
}
TileEntity tileEntity = world.getTileEntity(x, y, z);
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if (!(tileEntity instanceof TileEntityEnergyBank)) {
return false;
}
TileEntityEnergyBank tileEntityEnergyBank = (TileEntityEnergyBank) tileEntity;
ItemStack itemStackHeld = entityPlayer.getHeldItem();
EnumFacing facing = EnumFacing.getFront(side);
final TileEntityEnergyBank tileEntityEnergyBank = (TileEntityEnergyBank) tileEntity;
final ItemStack itemStackHeld = entityPlayer.getHeldItem();
final EnumFacing facing = EnumFacing.getFront(side);
if (itemStackHeld != null && itemStackHeld.getItem() instanceof IWarpTool) {
if ( itemStackHeld != null
&& itemStackHeld.getItem() instanceof IWarpTool ) {
if (entityPlayer.isSneaking()) {
tileEntityEnergyBank.setMode(facing, (byte)((tileEntityEnergyBank.getMode(facing) + 2) % 3));
} else {
tileEntityEnergyBank.setMode(facing, (byte)((tileEntityEnergyBank.getMode(facing) + 1) % 3));
}
ItemStack itemStack = new ItemStack(Item.getItemFromBlock(this), 1, world.getBlockMetadata(x, y, z));
final ItemStack itemStack = new ItemStack(Item.getItemFromBlock(this), 1, world.getBlockMetadata(x, y, z));
switch (tileEntityEnergyBank.getMode(facing)) {
case TileEntityEnergyBank.MODE_INPUT:
Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.guide.prefix",
@ -155,17 +156,20 @@ public class BlockEnergyBank extends BlockAbstractContainer {
}
EnumComponentType enumComponentType = null;
if (itemStackHeld != null && itemStackHeld.getItem() instanceof ItemComponent) {
if ( itemStackHeld != null
&& itemStackHeld.getItem() instanceof ItemComponent ) {
enumComponentType = EnumComponentType.get(itemStackHeld.getItemDamage());
}
// sneaking with an empty hand or an upgrade item in hand to dismount current upgrade
if (entityPlayer.isSneaking()) {
// using an upgrade item or an empty means dismount upgrade
if (itemStackHeld == null || enumComponentType != null) {
// using an upgrade item or an empty hand means dismount upgrade
if ( itemStackHeld == null
|| enumComponentType != null ) {
// find a valid upgrade to dismount
if (itemStackHeld == null || !tileEntityEnergyBank.hasUpgrade(enumComponentType)) {
enumComponentType = (EnumComponentType)tileEntityEnergyBank.getFirstUpgradeOfType(EnumComponentType.class, null);
if ( itemStackHeld == null
|| !tileEntityEnergyBank.hasUpgrade(enumComponentType) ) {
enumComponentType = (EnumComponentType) tileEntityEnergyBank.getFirstUpgradeOfType(EnumComponentType.class, null);
}
if (enumComponentType == null) {
@ -176,8 +180,8 @@ public class BlockEnergyBank extends BlockAbstractContainer {
if (!entityPlayer.capabilities.isCreativeMode) {
// dismount the current upgrade item
ItemStack itemStackDrop = ItemComponent.getItemStackNoCache(enumComponentType, 1);
EntityItem entityItem = new EntityItem(world, entityPlayer.posX, entityPlayer.posY + 0.5D, entityPlayer.posZ, itemStackDrop);
final ItemStack itemStackDrop = ItemComponent.getItemStackNoCache(enumComponentType, 1);
final EntityItem entityItem = new EntityItem(world, entityPlayer.posX, entityPlayer.posY + 0.5D, entityPlayer.posZ, itemStackDrop);
entityItem.delayBeforeCanPickup = 0;
world.spawnEntityInWorld(entityItem);
}
@ -186,7 +190,6 @@ public class BlockEnergyBank extends BlockAbstractContainer {
// upgrade dismounted
Commons.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.upgrade.result.dismounted", enumComponentType.name()));
return false;
}
} else if (itemStackHeld == null) {// no sneaking and no item in hand => show status

View file

@ -31,13 +31,13 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityIC2reactorLaserMonitor();
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[5];
icons[ICON_DISCONNECTED] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-invalid");
icons[ICON_HEAD_VALID ] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-head-valid");

View file

@ -738,10 +738,10 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
@Override
public String toString() {
return String.format("%s %s @ %s (%d %d %d)",
getClass().getSimpleName(),
connectedComputers == null ? "~NULL~" : connectedComputers,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
xCoord, yCoord, zCoord);
return String.format("%s %s @ %s (%d %d %d)",
getClass().getSimpleName(),
connectedComputers == null ? "~NULL~" : connectedComputers,
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -1,6 +1,5 @@
package cr0s.warpdrive.block.energy;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
import cr0s.warpdrive.config.WarpDriveConfig;
import cr0s.warpdrive.data.EnumComponentType;
@ -49,7 +48,7 @@ public class TileEntityEnergyBank extends TileEntityAbstractEnergy {
}
private double getEfficiency() {
int upgradeCount = Commons.clamp(0, getUpgradeMaxCount(EnumComponentType.SUPERCONDUCTOR), getUpgradeCount(EnumComponentType.SUPERCONDUCTOR));
final int upgradeCount = getValidUpgradeCount(EnumComponentType.SUPERCONDUCTOR);
return WarpDriveConfig.ENERGY_BANK_EFFICIENCY_PER_UPGRADE[upgradeCount];
}
@ -173,10 +172,10 @@ public class TileEntityEnergyBank extends TileEntityAbstractEnergy {
@Override
public String toString() {
return String.format("%s @ %s (%d %d %d) %8d",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
xCoord, yCoord, zCoord,
energy_getEnergyStored());
return String.format("%s @ %s (%d %d %d) %8d",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord,
energy_getEnergyStored());
}
}

View file

@ -55,7 +55,7 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityForceField();
}
@ -96,7 +96,7 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[16];
for (int i = 0; i < 16; ++i) {

View file

@ -40,7 +40,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[11];
icons[ 0] = iconRegister.registerIcon("warpdrive:forcefield/projectorSide_notConnected");
icons[ 1] = iconRegister.registerIcon("warpdrive:forcefield/projectorSide_connectedNotPowered");
@ -258,7 +258,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityForceFieldProjector();
}
}

View file

@ -157,7 +157,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityForceFieldRelay();
}
}

View file

@ -217,7 +217,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple
return String.format("%s Beam \'%d\' @ %s (%d %d %d)",
getClass().getSimpleName(),
beamFrequency,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -129,8 +129,9 @@ public class TileEntityForceField extends TileEntityAbstractBase {
// projector is disabled or out of power
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
if (WarpDriveConfig.LOGGING_FORCEFIELD) {
WarpDrive.logger.info("Removed a force field from an offline projector at "
+ (worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName()) + " " + xCoord + " " + yCoord + " " + zCoord);
WarpDrive.logger.info(String.format("Removed a force field from an offline projector @ %s (%d %d %d)",
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord));
}
}
}
@ -142,8 +143,9 @@ public class TileEntityForceField extends TileEntityAbstractBase {
if (gracePeriod_calls < 0) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
if (WarpDriveConfig.LOGGING_FORCEFIELD) {
WarpDrive.logger.info("Removed a force field with no projector defined at "
+ (worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName()) + " " + xCoord + " " + yCoord + " " + zCoord);
WarpDrive.logger.info(String.format("Removed a force field with no projector defined @ %s (%d %d %d)",
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord));
}
}
}

View file

@ -71,7 +71,7 @@ public class BlockHullOmnipanel extends BlockAbstractOmnipanel implements IDamag
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[16];
for (int i = 0; i < 16; i++) {

View file

@ -72,7 +72,7 @@ public class BlockHullPlain extends BlockAbstractBase implements IDamageReceiver
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[16];
for (int i = 0; i < 16; ++i) {

View file

@ -29,7 +29,7 @@ public class BlockLift extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[6];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:movement/liftSideOffline");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:movement/liftSideUp");
@ -79,7 +79,7 @@ public class BlockLift extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityLift();
}

View file

@ -34,7 +34,7 @@ public class BlockShipController extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[11];
// Solid textures
iconBuffer[ICON_INACTIVE_SIDE] = iconRegister.registerIcon("warpdrive:movement/ship_controller-side_inactive");
@ -85,7 +85,7 @@ public class BlockShipController extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityShipController();
}

View file

@ -47,7 +47,7 @@ public class BlockShipCore extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[18];
iconBuffer[ICON_TOP_BOTTOM ] = iconRegister.registerIcon("warpdrive:movement/ship_core-top-bottom");
iconBuffer[ICON_LEFT_OFFLINE ] = iconRegister.registerIcon("warpdrive:movement/ship_core-left_offline");
@ -131,7 +131,7 @@ public class BlockShipCore extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityShipCore();
}

View file

@ -24,13 +24,13 @@ public class BlockTransporter extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityTransporter();
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[3];
// Solid textures
iconBuffer[0] = iconRegister.registerIcon("warpdrive:movement/transporterBottom");

View file

@ -799,7 +799,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
return String.format("%s \'%s\' @ %s (%d %d %d)",
getClass().getSimpleName(),
tileEntityShipCore == null ? "-NULL-" : tileEntityShipCore.shipName,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -1232,11 +1232,10 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta
@Override
public String toString() {
return String.format(
"%s \'%s\' @ %s (%d %d %d)",
getClass().getSimpleName(),
shipName,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
xCoord, yCoord, zCoord);
return String.format("%s \'%s\' @ %s (%d %d %d)",
getClass().getSimpleName(),
shipName,
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -503,8 +503,8 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy {
@Override
public int energy_getMaxStorage() {
int energyUgrades = getUpgradeCount(ItemUpgrade.getItemStack(UpgradeType.Energy));
int max = (int) Math.floor(WarpDriveConfig.TRANSPORTER_MAX_ENERGY_STORED * Math.pow(1.2, energyUgrades));
int energyUpgrades = getUpgradeCount(ItemUpgrade.getItemStack(UpgradeType.Energy));
int max = (int) Math.floor(WarpDriveConfig.TRANSPORTER_MAX_ENERGY_STORED * Math.pow(1.2, energyUpgrades));
return max;
}

View file

@ -55,7 +55,7 @@ public class BlockBedrockGlass extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icon = iconRegister.registerIcon("warpdrive:decoration/bedrock_glass");
}

View file

@ -42,7 +42,7 @@ public class BlockDecorative extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
icons = new IIcon[EnumDecorativeType.length];
for (final EnumDecorativeType enumDecorativeType : EnumDecorativeType.values()) {
icons[enumDecorativeType.ordinal()] = iconRegister.registerIcon("warpdrive:decoration/decorative-" + enumDecorativeType.unlocalizedName);

View file

@ -76,7 +76,7 @@ public class BlockGas extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[12];
iconBuffer[0] = iconRegister.registerIcon("warpdrive:decoration/gas-blue");
iconBuffer[1] = iconRegister.registerIcon("warpdrive:decoration/gas-red");

View file

@ -24,7 +24,7 @@ public class BlockHighlyAdvancedMachine extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("warpdrive:passive/highlyAdvancedMachineSide");
}

View file

@ -25,7 +25,7 @@ public class BlockIridium extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("warpdrive:passive/iridiumSide");
}

View file

@ -29,7 +29,7 @@ public class BlockTransportBeacon extends Block {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("warpdrive:passive/transportBeacon");
}

View file

@ -36,7 +36,7 @@ public class BlockLaserCamera extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[1];
// Solid textures
iconBuffer[ICON_SIDE] = iconRegister.registerIcon("warpdrive:weapon/laserCameraSide");
@ -54,7 +54,7 @@ public class BlockLaserCamera extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityLaserCamera();
}

View file

@ -36,7 +36,7 @@ public class BlockWeaponController extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
public void registerBlockIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[3];
iconBuffer[ICON_TOP] = iconRegister.registerIcon("warpdrive:movement/ship_controller-top");
iconBuffer[ICON_BOTTOM] = iconRegister.registerIcon("warpdrive:movement/ship_controller-bottom");
@ -55,7 +55,7 @@ public class BlockWeaponController extends BlockAbstractContainer {
}
@Override
public TileEntity createNewTileEntity(World parWorld, int i) {
public TileEntity createNewTileEntity(final World world, final int metadata) {
return new TileEntityWeaponController();
}

View file

@ -187,7 +187,7 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan
getClass().getSimpleName(),
beamFrequency,
videoChannel,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -36,7 +36,7 @@ public class TileEntityWeaponController extends TileEntityAbstractInterfaced {
public String toString() {
return String.format("%s @ %s (%d %d %d)",
getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
xCoord, yCoord, zCoord);
}
}

View file

@ -167,11 +167,11 @@ public class CommandSpace extends CommandBase {
}
// inform player
String message = "§aTeleporting player " + entityPlayerMP.getCommandSenderName() + " to dimension " + dimensionIdTarget + "..."; // + ":" + worldTarget.getWorldInfo().getWorldName();
String message = "§aTeleporting player " + entityPlayerMP.getCommandSenderName() + " to dimension " + dimensionIdTarget + "..."; // + ":" + worldTarget.provider.getDimensionName();
Commons.addChatMessage(commandSender, message);
WarpDrive.logger.info(message);
if (commandSender != entityPlayerMP) {
Commons.addChatMessage(entityPlayerMP, commandSender.getCommandSenderName() + " is teleporting you to dimension " + dimensionIdTarget); // + ":" + worldTarget.getWorldInfo().getWorldName());
Commons.addChatMessage(entityPlayerMP, commandSender.getCommandSenderName() + " is teleporting you to dimension " + dimensionIdTarget); // + ":" + worldTarget.provider.getDimensionName());
}
// find a good spot

View file

@ -229,7 +229,7 @@ public class JumpShip {
return String.format("%s/%d \'%s\' @ %s (%d %d %d)",
getClass().getSimpleName(), hashCode(),
shipCore == null ? "~NULL~" : (shipCore.uuid + ":" + shipCore.shipName),
worldObj == null || worldObj.getWorldInfo() == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
coreX, coreY, coreZ);
}

View file

@ -36,7 +36,7 @@ public class EntityParticleBunch extends Entity {
public EntityParticleBunch(World world) {
super(world);
if (WarpDriveConfig.LOGGING_ACCELERATOR) {
WarpDrive.logger.info(this + " created in dimension '" + worldObj.getWorldInfo().getWorldName() + "'");
WarpDrive.logger.info(this + " created in dimension " + worldObj.provider.getDimensionName());
}
}
@ -171,7 +171,7 @@ public class EntityParticleBunch extends Entity {
return String.format("%s/%d @ \'%s\' %.2f %.2f %.2f",
getClass().getSimpleName(),
getEntityId(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
worldObj == null ? "~NULL~" : worldObj.provider.getDimensionName(),
posX, posY, posZ);
}
}

View file

@ -315,7 +315,7 @@ public class JumpSequencer extends AbstractSequencer {
sourceWorldTicket = ForgeChunkManager.requestTicket(WarpDrive.instance, sourceWorld, Type.NORMAL);
if (sourceWorldTicket == null) {
reason.append(String.format("Chunkloading rejected in source world %s. Aborting.",
sourceWorld.getWorldInfo().getWorldName()));
sourceWorld.provider.getDimensionName()));
return false;
}
@ -347,7 +347,7 @@ public class JumpSequencer extends AbstractSequencer {
targetWorldTicket = ForgeChunkManager.requestTicket(WarpDrive.instance, targetWorld, Type.NORMAL);
if (targetWorldTicket == null) {
reason.append(String.format("Chunkloading rejected in target world %s. Aborting.",
targetWorld.getWorldInfo().getWorldName()));
targetWorld.provider.getDimensionName()));
return false;
}
@ -1561,7 +1561,7 @@ public class JumpSequencer extends AbstractSequencer {
return String.format("%s/%d \'%s\' @ %s (%d %d %d) #%d",
getClass().getSimpleName(), hashCode(),
(ship == null || ship.shipCore == null) ? "~NULL~" : (ship.shipCore.uuid + ":" + ship.shipCore.shipName),
sourceWorld == null ? "~NULL~" : sourceWorld.getWorldInfo().getWorldName(),
sourceWorld == null ? "~NULL~" : sourceWorld.provider.getDimensionName(),
ship == null ? -1 : ship.coreX, ship == null ? -1 : ship.coreY, ship == null ? -1 : ship.coreZ,
ticks);
}

View file

@ -33,7 +33,7 @@ public class ItemAirTank extends Item implements IAirContainerItem {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[24];
icons[ 0] = iconRegister.registerIcon("warpdrive:breathing/air_canister");
icons[ 1] = iconRegister.registerIcon("warpdrive:breathing/air_canister");

View file

@ -54,7 +54,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[EnumComponentType.length];
for (final EnumComponentType enumComponentType : EnumComponentType.values()) {
icons[enumComponentType.ordinal()] = iconRegister.registerIcon("warpdrive:component/" + enumComponentType.unlocalizedName);
@ -62,7 +62,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
public String getUnlocalizedName(final ItemStack itemStack) {
int damage = itemStack.getItemDamage();
if (damage >= 0 && damage < EnumComponentType.length) {
return "item.warpdrive.crafting." + EnumComponentType.get(damage).unlocalizedName;
@ -71,7 +71,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public IIcon getIconFromDamage(int damage) {
public IIcon getIconFromDamage(final int damage) {
if (damage >= 0 && damage < EnumComponentType.length) {
return icons[damage];
}
@ -79,7 +79,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
public void getSubItems(final Item item, final CreativeTabs creativeTab, final List list) {
for (final EnumComponentType enumComponentType : EnumComponentType.values()) {
list.add(new ItemStack(item, 1, enumComponentType.ordinal()));
}
@ -87,12 +87,12 @@ public class ItemComponent extends Item implements IAirContainerItem {
// IAirContainerItem overrides for empty air canister
@Override
public boolean canContainAir(ItemStack itemStack) {
public boolean canContainAir(final ItemStack itemStack) {
return (itemStack.getItem() instanceof ItemComponent && itemStack.getItemDamage() == EnumComponentType.AIR_CANISTER.ordinal());
}
@Override
public int getMaxAirStorage(ItemStack itemStack) {
public int getMaxAirStorage(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getMaxAirStorage(itemStack);
} else {
@ -101,18 +101,18 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public int getCurrentAirStorage(ItemStack itemStack) {
public int getCurrentAirStorage(final ItemStack itemStack) {
return 0;
}
@Override
public ItemStack consumeAir(ItemStack itemStack) {
public ItemStack consumeAir(final ItemStack itemStack) {
WarpDrive.logger.error(this + " consumeAir() with itemStack " + itemStack);
throw new RuntimeException("Invalid call to consumeAir() on non or empty container");
}
@Override
public int getAirTicksPerConsumption(ItemStack itemStack) {
public int getAirTicksPerConsumption(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getAirTicksPerConsumption(itemStack);
} else {
@ -121,7 +121,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public ItemStack getFullAirContainer(ItemStack itemStack) {
public ItemStack getFullAirContainer(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getFullAirContainer(itemStack);
}
@ -129,7 +129,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public ItemStack getEmptyAirContainer(ItemStack itemStack) {
public ItemStack getEmptyAirContainer(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getEmptyAirContainer(itemStack);
}
@ -145,7 +145,7 @@ public class ItemComponent extends Item implements IAirContainerItem {
}
@Override
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean advancedItemTooltips) {
public void addInformation(final ItemStack itemStack, final EntityPlayer entityPlayer, final List list, final boolean advancedItemTooltips) {
super.addInformation(itemStack, entityPlayer, list, advancedItemTooltips);
String tooltip = "";

View file

@ -43,7 +43,7 @@ public class ItemElectromagneticCell extends ItemAbstractBase implements IPartic
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[31];
icons[ 0] = iconRegister.registerIcon("warpdrive:atomic/electromagnetic_cell-empty");
icons[ 1] = iconRegister.registerIcon("warpdrive:atomic/electromagnetic_cell-blue-20");

View file

@ -54,7 +54,7 @@ public class ItemForceFieldUpgrade extends Item {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[EnumForceFieldUpgrade.length];
for (final EnumForceFieldUpgrade enumForceFieldUpgrade : EnumForceFieldUpgrade.values()) {
icons[enumForceFieldUpgrade.ordinal()] = iconRegister.registerIcon("warpdrive:forcefield/upgrade_" + enumForceFieldUpgrade.unlocalizedName);

View file

@ -57,7 +57,7 @@ public class ItemShipToken extends Item {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[VALID_METADATAS.length];
for (int index = 0; index < VALID_METADATAS.length; index++) {
icons[index] = iconRegister.registerIcon("warpdrive:tool/ship_token-" + VALID_METADATAS[index]);

View file

@ -49,7 +49,7 @@ public class ItemTuningDriver extends Item implements IWarpTool {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[3];
icons[MODE_VIDEO_CHANNEL ] = iconRegister.registerIcon("warpdrive:tool/tuning_driver-cyan");

View file

@ -43,7 +43,7 @@ public class ItemTuningFork extends Item implements IWarpTool {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
public void registerIcons(final IIconRegister iconRegister) {
icons = new IIcon[16];
for (int i = 0; i < 16; ++i) {

View file

@ -92,10 +92,10 @@ public class ItemUpgrade extends Item {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister ir) {
public void registerIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[UpgradeType.values().length];
for (UpgradeType val : UpgradeType.values()) {
iconBuffer[val.ordinal()] = ir.registerIcon("warpdrive:upgrade" + val);
iconBuffer[val.ordinal()] = iconRegister.registerIcon("warpdrive:upgrade" + val);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB