Code cleanup
This commit is contained in:
parent
7ee3252070
commit
625d422a36
10 changed files with 183 additions and 136 deletions
|
@ -1057,6 +1057,11 @@ public class EntityJump extends Entity {
|
|||
case 270:
|
||||
v[0] = -dz;
|
||||
v[2] = dx;
|
||||
break;
|
||||
|
||||
default:
|
||||
WarpDrive.logger.error(this + "Invalid direction " + i);
|
||||
break;
|
||||
}
|
||||
|
||||
return v;
|
||||
|
|
|
@ -126,10 +126,16 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
r = 1.0f;
|
||||
b = 0.5f;
|
||||
g = 0f;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PacketHandler.sendBeamPacket(worldObj, new Vector3(this).translate(0.5D), new Vector3(x, shipCore.maxY, randomZ).translate(0.5D), r, g, b, 15,
|
||||
0, 100);
|
||||
PacketHandler.sendBeamPacket(worldObj,
|
||||
new Vector3(this).translate(0.5D),
|
||||
new Vector3(x, shipCore.maxY, randomZ).translate(0.5D),
|
||||
r, g, b, 15, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +159,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
|
||||
for (int index = 0; index < blocks; index++) {
|
||||
if (currentDeployIndex >= blocksToDeployCount) {
|
||||
isDeploying = false;
|
||||
isDeploying = false;
|
||||
setActive(false); // disable scanner
|
||||
break;
|
||||
}
|
||||
|
@ -169,8 +175,10 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
if (worldObj.rand.nextInt(100) <= 10) {
|
||||
worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:lowlaser", 4F, 1F);
|
||||
|
||||
PacketHandler.sendBeamPacket(worldObj, new Vector3(this).translate(0.5D),
|
||||
new Vector3(targetX + jb.x, targetY + jb.y, targetZ + jb.z).translate(0.5D), 0f, 1f, 0f, 15, 0, 100);
|
||||
PacketHandler.sendBeamPacket(worldObj,
|
||||
new Vector3(this).translate(0.5D),
|
||||
new Vector3(targetX + jb.x, targetY + jb.y, targetZ + jb.z).translate(0.5D),
|
||||
0f, 1f, 0f, 15, 0, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +223,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
if (WarpDriveConfig.SS_ENERGY_PER_BLOCK_SCAN > 0) {
|
||||
return size * WarpDriveConfig.SS_ENERGY_PER_BLOCK_SCAN;
|
||||
} else {
|
||||
return WarpDriveConfig.SS_MAX_ENERGY_STORED;
|
||||
return WarpDriveConfig.SS_MAX_ENERGY_STORED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,8 +270,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
Block block = worldObj.getBlock(shipCore.minX + x, shipCore.minY + y, shipCore.minZ + z);
|
||||
|
||||
// Skip leftBehind and anchor blocks
|
||||
if ( WarpDriveConfig.BLOCKS_LEFTBEHIND.contains(block)
|
||||
|| WarpDriveConfig.BLOCKS_ANCHOR.contains(block)) {
|
||||
if (WarpDriveConfig.BLOCKS_LEFTBEHIND.contains(block) || WarpDriveConfig.BLOCKS_ANCHOR.contains(block)) {
|
||||
block = Blocks.air;
|
||||
}
|
||||
|
||||
|
@ -279,7 +286,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
te.writeToNBT(tileTag);
|
||||
|
||||
// Clear inventory.
|
||||
if (te instanceof IInventory) {
|
||||
if (te instanceof IInventory) {
|
||||
TileEntity tmp_te = TileEntity.createAndLoadEntity(tileTag);
|
||||
if (tmp_te instanceof IInventory) {
|
||||
for (int i = 0; i < ((IInventory) tmp_te).getSizeInventory(); i++) {
|
||||
|
@ -307,7 +314,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
|
||||
tileEntitiesList.appendTag(tileTag);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,6 +223,8 @@ public class TileEntityLift extends TileEntityAbstractEnergy {
|
|||
return new Object[] { "up" };
|
||||
case 2:
|
||||
return new Object[] { "down" };
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,9 @@ public class CommandDebug extends CommandBase
|
|||
te.updateContainingBlockInfo();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WarpDrive.logger.info("[" + getCommandName() + "] " + side + ": invalid step '" + ch + "'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -934,6 +934,9 @@ public class WarpDriveConfig {
|
|||
case "PlaceNormal" : BLOCKS_PLACE.put(block, 2); break;
|
||||
case "PlaceLater" : BLOCKS_PLACE.put(block, 3); break;
|
||||
case "PlaceLatest" : BLOCKS_PLACE.put(block, 4); break;
|
||||
default:
|
||||
WarpDrive.logger.error("Unsupported tag '" + tag + "' for block " + block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -968,6 +971,9 @@ public class WarpDriveConfig {
|
|||
case "NoMass" : ENTITIES_NOMASS.add(entityId); break;
|
||||
case "LeftBehind" : ENTITIES_LEFTBEHIND.add(entityId); break;
|
||||
case "NonLivingTarget" : ENTITIES_NONLIVINGTARGET.add(entityId); break;
|
||||
default:
|
||||
WarpDrive.logger.error("Unsupported tag '" + tag + "' for entity " + entityId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -993,6 +999,9 @@ public class WarpDriveConfig {
|
|||
case "FlyInSpace" : ITEMS_FLYINSPACE.add(item); break;
|
||||
case "NoFallDamage" : ITEMS_NOFALLDAMAGE.add(item); break;
|
||||
case "BreathingIC2" : ITEMS_BREATHINGIC2.add(item); break;
|
||||
default:
|
||||
WarpDrive.logger.error("Unsupported tag '" + tag + "' for item " + item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ public class StarMapRegistry {
|
|||
case STAR: break;
|
||||
case STRUCTURE: break;
|
||||
case WARPECHO: break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -233,6 +233,9 @@ public class Vector3 implements Cloneable {
|
|||
break;
|
||||
case EAST:
|
||||
x += amount;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -403,6 +406,9 @@ public class Vector3 implements Cloneable {
|
|||
case 5:
|
||||
this.x += amount;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -176,6 +176,9 @@ public class VectorI implements Cloneable {
|
|||
break;
|
||||
case EAST:
|
||||
x += amount;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -105,21 +105,28 @@ public final class EntitySphereGen extends Entity {
|
|||
return;
|
||||
}
|
||||
|
||||
switch (this.state) {
|
||||
switch (state) {
|
||||
case STATE_SAVING:
|
||||
tickScheduleBlocks();
|
||||
this.state = STATE_SETUP;
|
||||
break;
|
||||
|
||||
case STATE_SETUP:
|
||||
if (currentIndex >= blocks.size() - 1)
|
||||
this.state = STATE_DELETE;
|
||||
else
|
||||
tickPlaceBlocks();
|
||||
break;
|
||||
|
||||
case STATE_DELETE:
|
||||
currentIndex = 0;
|
||||
killEntity();
|
||||
break;
|
||||
|
||||
default:
|
||||
WarpDrive.logger.error(this + " Invalid state " + state + ". Killing entity...");
|
||||
killEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,9 @@ public class WorldGenSmallShip extends WorldGenerator {
|
|||
case 3:
|
||||
cableType.setItemDamage(9);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -627,7 +630,7 @@ public class WorldGenSmallShip extends WorldGenerator {
|
|||
|
||||
while (!isDone) {
|
||||
switch (rand.nextInt(14)) {
|
||||
case 0:// Mass fabricator
|
||||
case 0: // Mass fabricator
|
||||
res = WarpDriveConfig.getModItemStack("IC2", "blockMachine", -1);
|
||||
res.setItemDamage(14);
|
||||
res.stackSize = 1; // + rand.nextInt(2);
|
||||
|
@ -667,8 +670,7 @@ public class WorldGenSmallShip extends WorldGenerator {
|
|||
|
||||
case 9:
|
||||
case 10:
|
||||
// Rocket launcher platform Tier3
|
||||
case 11:
|
||||
case 11: // Rocket launcher platform Tier3
|
||||
if (WarpDriveConfig.isICBMLoaded) {
|
||||
// TODO: No 1.7 ICBM yet
|
||||
// res = new ItemStack(WarpDriveConfig.ICBM_Machine, 1 +
|
||||
|
@ -677,8 +679,8 @@ public class WorldGenSmallShip extends WorldGenerator {
|
|||
}
|
||||
break;
|
||||
|
||||
// Missles from conventional to hypersonic
|
||||
case 12:
|
||||
|
||||
case 12: // Missiles from conventional to hypersonic
|
||||
if (WarpDriveConfig.isICBMLoaded) {
|
||||
// TODO: No 1.7 ICBM yet
|
||||
// res = new ItemStack(WarpDriveConfig.ICBM_Missile, 2 +
|
||||
|
@ -687,13 +689,15 @@ public class WorldGenSmallShip extends WorldGenerator {
|
|||
}
|
||||
break;
|
||||
|
||||
// Advanced solar panels
|
||||
case 13:
|
||||
case 13: // Advanced solar panels
|
||||
if (WarpDriveConfig.isAdvancedSolarPanelLoaded) {
|
||||
res = new ItemStack(solarPanel_block, rand.nextInt(3), solarPanel_metadata);
|
||||
isDone = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue