Code cleanup

This commit is contained in:
LemADEC 2015-08-16 22:44:20 +02:00
parent 275e786347
commit f0c85aa421
2 changed files with 28 additions and 42 deletions

View file

@ -546,13 +546,13 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
private Object[] filename(Object[] arguments) {
if (isActive && !schematicFileName.isEmpty()) {
if (isDeploying) {
return new Object[] { "Deployment in progress. Please wait..." };
return new Object[] { false, "Deployment in progress. Please wait..." };
} else {
return new Object[] { "Scan in progress. Please wait..." };
return new Object[] { false, "Scan in progress. Please wait..." };
}
}
return new Object[] { schematicFileName };
return new Object[] { true, schematicFileName };
}
private Object[] deploy(Object[] arguments) {

View file

@ -60,10 +60,8 @@ public class TileEntityLift extends TileEntityAbstractEnergy {
tickCount = 0;
// Switching mode
if (computerMode == MODE_DOWN
|| (computerMode == MODE_REDSTONE && worldObj
.isBlockIndirectlyGettingPowered(xCoord, yCoord,
zCoord))) {
if ( computerMode == MODE_DOWN
|| (computerMode == MODE_REDSTONE && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))) {
mode = MODE_DOWN;
} else {
mode = MODE_UP;
@ -119,9 +117,9 @@ public class TileEntityLift extends TileEntityAbstractEnergy {
Block block = worldObj.getBlock(xCoord, yPosition, zCoord);
//TODO: Make configurable or less specific
return block.isAssociatedBlock(Blocks.air)
|| block.isAssociatedBlock(Blocks.wall_sign)
|| block.isAssociatedBlock(Blocks.standing_sign)
|| worldObj.isAirBlock(xCoord, yPosition, zCoord);
|| block.isAssociatedBlock(Blocks.wall_sign)
|| block.isAssociatedBlock(Blocks.standing_sign)
|| worldObj.isAirBlock(xCoord, yPosition, zCoord);
}
private void liftEntity() {
@ -136,48 +134,36 @@ public class TileEntityLift extends TileEntityAbstractEnergy {
// Lift up
if (mode == MODE_UP) {
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin,
firstUncoveredY, zmin, xmax, yCoord, zmax);
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null,
aabb);
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin, firstUncoveredY, zmin, xmax, yCoord, zmax);
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb);
if (list != null) {
for (Object o : list) {
if (o != null
&& o instanceof EntityLivingBase
&& consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY,
true)) {
((EntityLivingBase) o).setPositionAndUpdate(
xCoord + 0.5D, yCoord + 1.0D, zCoord + 0.5D);
PacketHandler.sendBeamPacket(worldObj, new Vector3(
xCoord + 0.5D, firstUncoveredY, zCoord + 0.5D),
new Vector3(xCoord + 0.5D, yCoord,
zCoord + 0.5D), 1F, 1F, 0F, 40, 0, 100);
worldObj.playSoundEffect(xCoord + 0.5D, yCoord,
zCoord + 0.5D, "warpdrive:hilaser", 4F, 1F);
if ( o != null
&& o instanceof EntityLivingBase
&& consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY, true)) {
((EntityLivingBase) o).setPositionAndUpdate(xCoord + 0.5D, yCoord + 1.0D, zCoord + 0.5D);
PacketHandler.sendBeamPacket(worldObj,
new Vector3(xCoord + 0.5D, firstUncoveredY, zCoord + 0.5D),
new Vector3(xCoord + 0.5D, yCoord, zCoord + 0.5D), 1F, 1F, 0F, 40, 0, 100);
worldObj.playSoundEffect(xCoord + 0.5D, yCoord, zCoord + 0.5D, "warpdrive:hilaser", 4F, 1F);
consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY, false);
}
}
}
} else if (mode == MODE_DOWN) {
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin,
Math.min(firstUncoveredY + 4.0D, yCoord), zmin, xmax,
yCoord + 2.0D, zmax);
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null,
aabb);
Math.min(firstUncoveredY + 4.0D, yCoord), zmin, xmax, yCoord + 2.0D, zmax);
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb);
if (list != null) {
for (Object o : list) {
if (o != null
&& o instanceof EntityLivingBase
&& consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY,
true)) {
((EntityLivingBase) o).setPositionAndUpdate(
xCoord + 0.5D, firstUncoveredY, zCoord + 0.5D);
PacketHandler.sendBeamPacket(worldObj, new Vector3(
xCoord + 0.5D, yCoord, zCoord + 0.5D),
new Vector3(xCoord + 0.5D, firstUncoveredY,
zCoord + 0.5D), 1F, 1F, 0F, 40, 0, 100);
worldObj.playSoundEffect(xCoord + 0.5D, yCoord,
zCoord + 0.5D, "warpdrive:hilaser", 4F, 1F);
if ( o != null
&& o instanceof EntityLivingBase
&& consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY, true)) {
((EntityLivingBase) o).setPositionAndUpdate(xCoord + 0.5D, firstUncoveredY, zCoord + 0.5D);
PacketHandler.sendBeamPacket(worldObj,
new Vector3(xCoord + 0.5D, yCoord, zCoord + 0.5D),
new Vector3(xCoord + 0.5D, firstUncoveredY, zCoord + 0.5D), 1F, 1F, 0F, 40, 0, 100);
worldObj.playSoundEffect(xCoord + 0.5D, yCoord, zCoord + 0.5D, "warpdrive:hilaser", 4F, 1F);
consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY, false);
}
}