Code cleanup

This commit is contained in:
LemADEC 2016-02-08 03:40:03 +01:00
parent edfc9bdf0c
commit 386bfd704b
2 changed files with 48 additions and 54 deletions

View file

@ -339,17 +339,17 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
public void messageToAllPlayersOnShip(String msg) {
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.minX, this.minY, this.minZ, this.maxX + 0.99D, this.maxY + 0.99D, this.maxZ + 0.99D);
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + msg);
for (Object object : list) {
if (object == null || !(object instanceof EntityPlayer)) {
if (!(object instanceof EntityPlayer)) {
continue;
}
WarpDrive.addChatMessage((EntityPlayer) object, "[" + (!shipName.isEmpty() ? shipName : "WarpCore") + "] " + msg);
WarpDrive.addChatMessage((EntityPlayer) object, "[" + (!shipName.isEmpty() ? shipName : "ShipCore") + "] " + msg);
}
}
private void updateIsolationState() {
// Search block in cube around core
int xmax, ymax, zmax;

View file

@ -3,54 +3,48 @@ package cr0s.warpdrive.data;
import net.minecraft.util.AxisAlignedBB;
import cr0s.warpdrive.world.JumpgateGenerator;
public class Jumpgate
{
public String name;
public int xCoord, yCoord, zCoord;
public Jumpgate(String name, int x, int y, int z)
{
this.name = name;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
}
public Jumpgate(String line)
{
String[] params = line.split(":");
if (params.length < 4)
{
return;
}
name = params[0];
xCoord = Integer.parseInt(params[1]);
yCoord = Integer.parseInt(params[2]);
zCoord = Integer.parseInt(params[3]);
}
public AxisAlignedBB getGateAABB()
{
int xmin, ymin, zmin;
int xmax, ymax, zmax;
xmin = xCoord - (JumpgateGenerator.GATE_LENGTH_HALF * 2);
xmax = xCoord + (JumpgateGenerator.GATE_LENGTH_HALF * 2);
ymin = yCoord - (JumpgateGenerator.GATE_SIZE_HALF);
ymax = yCoord + (JumpgateGenerator.GATE_SIZE_HALF);
zmin = zCoord - (JumpgateGenerator.GATE_SIZE_HALF);
zmax = zCoord + (JumpgateGenerator.GATE_SIZE_HALF);
return AxisAlignedBB.getBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax);
}
@Override
public String toString()
{
return name + ":" + xCoord + ":" + yCoord + ":" + zCoord;
}
public String toNiceString()
{
return name + " (" + xCoord + "; " + yCoord + "; " + zCoord + ")";
}
public class Jumpgate {
public String name;
public int xCoord, yCoord, zCoord;
public Jumpgate(final String name, final int x, final int y, final int z) {
this.name = name;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
}
public Jumpgate(final String line) {
String[] params = line.split(":");
if (params.length < 4) {
return;
}
name = params[0];
xCoord = Integer.parseInt(params[1]);
yCoord = Integer.parseInt(params[2]);
zCoord = Integer.parseInt(params[3]);
}
public AxisAlignedBB getGateAABB() {
int xmin, ymin, zmin;
int xmax, ymax, zmax;
xmin = xCoord - (JumpgateGenerator.GATE_LENGTH_HALF * 2);
xmax = xCoord + (JumpgateGenerator.GATE_LENGTH_HALF * 2);
ymin = yCoord - (JumpgateGenerator.GATE_SIZE_HALF);
ymax = yCoord + (JumpgateGenerator.GATE_SIZE_HALF);
zmin = zCoord - (JumpgateGenerator.GATE_SIZE_HALF);
zmax = zCoord + (JumpgateGenerator.GATE_SIZE_HALF);
return AxisAlignedBB.getBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax);
}
@Override
public String toString() {
return name + ":" + xCoord + ":" + yCoord + ":" + zCoord;
}
public String toNiceString() {
return name + " (" + xCoord + ", " + yCoord + ", " + zCoord + ")";
}
}