Code cleanup

This commit is contained in:
Unknown 2018-02-03 15:59:01 +01:00
parent 7b821977d7
commit 00a35640db
15 changed files with 25 additions and 27 deletions

View file

@ -1,6 +1,5 @@
package cr0s.warpdrive.api;
public interface IBlockUpdateDetector
{
void updatedNeighbours();
public interface IBlockUpdateDetector {
void onBlockUpdateDetected();
}

View file

@ -45,7 +45,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
super.onBlockAdded(world, x, y, z);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof IBlockUpdateDetector) {
((IBlockUpdateDetector) tileEntity).updatedNeighbours();
((IBlockUpdateDetector) tileEntity).onBlockUpdateDetected();
}
}
@ -114,11 +114,11 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
super.onNeighborBlockChange(world, x, y, z, block);
TileEntity tileEntity = world.getTileEntity(x, y, z);
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof IBlockUpdateDetector) {
((IBlockUpdateDetector) tileEntity).updatedNeighbours();
((IBlockUpdateDetector) tileEntity).onBlockUpdateDetected();
}
}

View file

@ -48,7 +48,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
}
@Override
public void updatedNeighbours() {
public void onBlockUpdateDetected() {
}
protected void updateMetadata(int metadata) {

View file

@ -445,8 +445,8 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa
// WarpDrive overrides
@Override
public void updatedNeighbours() {
super.updatedNeighbours();
public void onBlockUpdateDetected() {
super.onBlockUpdateDetected();
if (WarpDriveConfig.isCoFHCoreLoaded) {
CoFH_scanForEnergyHandlers();

View file

@ -20,11 +20,10 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer {
private static IIcon[] icons;
private static final int ICON_DISCONNECTED = 0;
private static final int ICON_HEAD_CONNECTED = 1;
private static final int ICON_SIDE_CONNECTED = 2;
private static final int ICON_HEAD_VALID = 3;
private static final int ICON_SIDE_VALID = 4;
private static final int ICON_HEAD_VALID = 1;
private static final int ICON_SIDE_VALID = 2;
private static final int ICON_HEAD_POWERED = 3;
private static final int ICON_SIDE_POWERED = 4;
public BlockIC2reactorLaserMonitor() {
super(Material.iron);
@ -40,11 +39,11 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer {
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
icons = new IIcon[5];
icons[ICON_DISCONNECTED ] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-disconnected");
icons[ICON_HEAD_CONNECTED] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-head-connected");
icons[ICON_SIDE_CONNECTED] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-side-connected");
icons[ICON_HEAD_VALID ] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-head-valid");
icons[ICON_SIDE_VALID ] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-side-valid");
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");
icons[ICON_SIDE_VALID ] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-side-valid");
icons[ICON_HEAD_POWERED] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-head-powered");
icons[ICON_SIDE_POWERED] = iconRegister.registerIcon("warpdrive:energy/ic2_reactor_laser_cooler-side-powered");
}
@SideOnly(Side.CLIENT)
@ -61,9 +60,9 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer {
return icons[ICON_DISCONNECTED];
}
if ((metadata & 8) == 0) {
return icons[facing == side ? ICON_HEAD_CONNECTED : ICON_SIDE_CONNECTED];
} else {
return icons[facing == side ? ICON_HEAD_VALID : ICON_SIDE_VALID];
} else {
return icons[facing == side ? ICON_HEAD_POWERED : ICON_SIDE_POWERED];
}
}

View file

@ -44,7 +44,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple
@Override
protected void onFirstUpdateTick() {
Block block = getBlockType();
final Block block = getBlockType();
if (block instanceof BlockAbstractForceField) {
tier = ((BlockAbstractForceField) block).tier;
} else {

View file

@ -1154,7 +1154,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
try {
if ( projector != null
&& projector.isValid() ) {
ForceFieldSetup forceFieldSetup = projector.getForceFieldSetup();
final ForceFieldSetup forceFieldSetup = projector.getForceFieldSetup();
if (WarpDriveConfig.LOGGING_FORCEFIELD) {
WarpDrive.logger.debug(this + " Calculation started for " + projector);
}

View file

@ -132,13 +132,13 @@ public class ForceFieldSetup extends GlobalPosition {
}
private float getScaledUpgrade(final IForceFieldUpgradeEffector effector) {
Float scaledValue = upgrades.get(effector);
final Float scaledValue = upgrades.get(effector);
return scaledValue == null ? 0.0F : scaledValue;
}
private void refresh() {
Set<TileEntity> tileEntities = ForceFieldRegistry.getTileEntities(beamFrequency, getWorldServerIfLoaded(), x, y, z);
HashMap<IForceFieldUpgradeEffector, Float> upgradeValues = new HashMap<>(EnumForceFieldUpgrade.length);
final Set<TileEntity> tileEntities = ForceFieldRegistry.getTileEntities(beamFrequency, getWorldServerIfLoaded(), x, y, z);
final HashMap<IForceFieldUpgradeEffector, Float> upgradeValues = new HashMap<>(EnumForceFieldUpgrade.length);
Vector3 v3Min = new Vector3(-1.0D, -1.0D, -1.0D);
Vector3 v3Max = new Vector3( 1.0D, 1.0D, 1.0D);
Vector3 v3Translation = new Vector3(0.0D, 0.0D, 0.0D);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB