This commit is contained in:
ZLOFENIX 2014-07-20 23:02:20 +04:00
parent c135e46691
commit 21756cb26e
7 changed files with 4 additions and 99 deletions

View file

@ -79,7 +79,6 @@ public class TileEntityCloakingDeviceCore extends TileEntity implements IEnergyS
}
if (--this.updateTicks <= 0) {
//System.out.println("[CloakDev] Updating cloaking state...");
this.updateTicks = ((this.tier == 1) ? 20 : (tier == 2) ? 10 : 20) * WarpDriveConfig.i.CD_FIELD_REFRESH_INTERVAL_SECONDS; // resetting timer
if (validateAssembly() && isEnabled) {
@ -101,13 +100,11 @@ public class TileEntityCloakingDeviceCore extends TileEntity implements IEnergyS
area.sendCloakPacketToPlayersEx(false); // recloak field
}
} else {
System.out.println("[CloakDev] Low power, cloak field collapsing...");
currentEnergyValue = 0;
setCoilsState(false);
disableCloakingField();
}
} else if (!validateAssembly() && isEnabled) {
System.out.println("[CloakDev] Device lost coils, field collapsing");
currentEnergyValue = 0;
setCoilsState(false);
disableCloakingField();
@ -225,7 +222,6 @@ public class TileEntityCloakingDeviceCore extends TileEntity implements IEnergyS
blocksCount++;
int energyToConsume = blocksCount * ((this.tier == 1) ? WarpDriveConfig.i.CD_ENERGY_PER_BLOCK_TIER1 : WarpDriveConfig.i.CD_ENERGY_PER_BLOCK_TIER2);
//System.out.println("[CloakDev] Consuming " + energyToConsume + " eU for " + blocksCount + " blocks");
this.currentEnergyValue -= energyToConsume;
}

View file

@ -97,14 +97,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral
public void addBeamEnergy(int amount)
{
if (isEmitting)
{
energyFromOtherBeams += amount;
System.out.println("[LE] Added energy: " + amount);
}
else
{
System.out.println("[LE] Ignored energy: " + amount);
}
}
private int collectEnergyFromBoosters()
@ -139,7 +132,6 @@ public class TileEntityLaser extends TileEntity implements IPeripheral
{
// Beam power calculations
int beamLengthBlocks = energy / WarpDriveConfig.i.LE_BEAM_LENGTH_PER_ENERGY_DIVIDER;
System.out.println("Energy: " + energy + " | beamLengthBlocks: " + beamLengthBlocks);
if (energy == 0 || beamLengthBlocks < 1 || frequency > 65000 || frequency <= 0)
{
@ -147,7 +139,6 @@ public class TileEntityLaser extends TileEntity implements IPeripheral
}
Vector3 beamVector = new Vector3(this).add(0.5);
System.out.println("beamVector: " + beamVector);
float yawz = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
float yawx = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
float pitchhorizontal = -MathHelper.cos(-pitch * 0.017453292F);
@ -157,9 +148,6 @@ public class TileEntityLaser extends TileEntity implements IPeripheral
Vector3 lookVector = new Vector3((double) directionx, (double) pitchvertical, (double) directionz);
Vector3.translate(beamVector, lookVector);
Vector3 reachPoint = beamVector.clone().translate(beamVector.clone(), beamVector.clone().scale(lookVector.clone(), beamLengthBlocks));
System.out.println("Look vector: " + lookVector);
System.out.println("reachPoint: " + reachPoint);
System.out.println("translatedBeamVector: " + beamVector);
Vector3 endPoint = reachPoint.clone();
playSoundCorrespondsEnergy(energy);
@ -185,15 +173,6 @@ public class TileEntityLaser extends TileEntity implements IPeripheral
// FIXME entity ray-tracing
MovingObjectPosition entityHit = raytraceEntities(beamVector.clone(), lookVector.clone(), true, beamLengthBlocks);
if (entityHit == null)
{
System.out.println("Entity hit is null.");
}
else
{
System.out.println("Entity hit: " + entityHit);
}
if (entityHit != null && entityHit.entityHit instanceof EntityLivingBase)
{
EntityLivingBase e = (EntityLivingBase)entityHit.entityHit;

View file

@ -338,7 +338,6 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
private void scanLayer()
{
//System.out.println("Scanning layer");
valuablesInLayer.clear();
int xmax, zmax, x1, x2, z1, z2;
int xmin, zmin;
@ -371,9 +370,6 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
zmax = z1;
}
//System.out.println("Layer: xmax: " + xmax + ", xmin: " + xmin);
//System.out.println("Layer: zmax: " + zmax + ", zmin: " + zmin);
// Search for valuable blocks
for (int x = xmin; x <= xmax; x++)
for (int z = zmin; z <= zmax; z++)
@ -391,7 +387,6 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
}
valuableIndex = 0;
//System.out.println("[ML] Found " + valuablesInLayer.size() + " valuables");
}
private boolean collectEnergyPacketFromBooster(int packet, boolean test)

View file

@ -84,13 +84,11 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
private void setJumpDistance(int distance)
{
System.out.println("Setting jump distance: " + distance);
this.distance = distance;
}
private void setMode(int mode)
{
// System.out.println("Setting mode: " + mode);
this.mode = mode;
}
@ -109,7 +107,6 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
dir = 270;
}
System.out.println("Setting direction: " + dir);
this.direction = dir;
}
@ -433,7 +430,6 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
*/
public void setBeaconFrequency(String beaconFrequency)
{
//System.out.println("Setting beacon freqency: " + beaconFrequency);
this.beaconFrequency = beaconFrequency;
}
@ -473,7 +469,6 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
{
//System.out.println("[ProtoBlock] Method " + method + " " + methodsArray[method] + " called!");
switch (method)
{
case 0: // dim_getp ()
@ -483,14 +478,13 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
( ( (Double)arguments[0] ).intValue() < 0 ||
( (Double)arguments[1] ).intValue() < 0 ||
( (Double)arguments[2] ).intValue() < 0 ||
( (Double)arguments[0] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
( (Double)arguments[1] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
( (Double)arguments[2] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
( (Double)arguments[3] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ) )
( (Double)arguments[2] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ) )
{
return new Integer[] { -1 };
}
System.out.println("Setting positive gabarits: f: " + ((Double)arguments[0]).intValue() + " r: " + ((Double)arguments[1]).intValue() + " u: " + ((Double)arguments[2]).intValue());
setFront(((Double)arguments[0]).intValue());
setRight(((Double)arguments[1]).intValue());
setUp(((Double)arguments[2]).intValue());
@ -504,14 +498,13 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
( ( (Double)arguments[0] ).intValue() < 0 ||
( (Double)arguments[1] ).intValue() < 0 ||
( (Double)arguments[2] ).intValue() < 0 ||
( (Double)arguments[0] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
( (Double)arguments[1] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
( (Double)arguments[2] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ||
( (Double)arguments[3] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ) )
( (Double)arguments[2] ).intValue() > WarpDriveConfig.i.WC_MAX_SHIP_SIDE ) )
{
return new Integer[] { -1 };
}
System.out.println("Setting negative gabarits: b: " + ((Double)arguments[0]).intValue() + " l: " + ((Double)arguments[1]).intValue() + " d: " + ((Double)arguments[2]).intValue());
setBack(((Double)arguments[0]).intValue());
setLeft(((Double)arguments[1]).intValue());
setDown(((Double)arguments[2]).intValue());

View file

@ -69,7 +69,6 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
{
if (cooldownTime++ > (20 * ((scanRadius / 1000) + 1)))
{
//System.out.println("Scanning...");
WarpDrive.instance.registry.removeDeadCores();
results = WarpDrive.instance.registry.searchWarpCoresInRadius(xCoord, yCoord, zCoord, scanRadius);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
@ -138,7 +137,6 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
else
{
results = null;
System.out.println("Radius: " + radius + " | Enough energy: " + isEnergyEnoughForScanRadiusW(radius));
return new Boolean[] { false };
}
}

View file

@ -201,7 +201,6 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
return;
}
System.out.println("ZLO5");
if (WarpDrive.instance.registry.isWarpCoreIntersectsWithOthers(this))
{
this.controller.setJumpFlag(false);
@ -209,7 +208,6 @@ System.out.println("ZLO5");
return;
}
System.out.println("ZLO6");
if (WarpDrive.instance.cloaks.isInCloak(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, false))
{
this.controller.setJumpFlag(false);
@ -217,8 +215,6 @@ System.out.println("ZLO6");
return;
}
System.out.println("ZLO7");
System.out.println("[W-C] Jumping!");
doJump();
controller.setJumpFlag(false);
}
@ -243,7 +239,6 @@ System.out.println("ZLO7");
continue;
}
System.out.println(msg);
((EntityPlayer)o).addChatMessage("[WarpCore] " + msg);
}
}
@ -499,7 +494,6 @@ System.out.println("ZLO7");
{
if (currentEnergyValue - calculateRequiredEnergy(shipVolume, distance) < 0)
{
System.out.println("[WP-TE] Insufficient energy to jump");
this.controller.setJumpFlag(false);
return;
}
@ -539,7 +533,6 @@ System.out.println("ZLO7");
{
// Consume all energy
currentEnergyValue -= calculateRequiredEnergy(shipVolume, distance);
System.out.println("[TE-WC] Moving ship to a beacon (" + beaconX + "; " + yCoord + "; " + beaconZ + ")");
EntityJump jump = new EntityJump(worldObj, xCoord, yCoord, zCoord, 1, 0, dx, dz, this);
jump.maxX = maxX;
jump.minX = minX;
@ -565,16 +558,11 @@ System.out.println("ZLO7");
worldObj.spawnEntityInWorld(jump);
coreState = "";
}
else
{
System.out.println("[TE-WC] Beacon not found.");
}
}
private boolean isShipInJumpgate(JumpGate jg)
{
AxisAlignedBB aabb = jg.getGateAABB();
System.out.println("Gate AABB: " + aabb);
int numBlocks = 0;
if (aabb.isVecInside(worldObj.getWorldVec3Pool().getVecFromPool(maxX - minX, maxY - minY, maxZ - minZ)))
@ -601,12 +589,9 @@ System.out.println("ZLO7");
if (numBlocks == 0)
{
System.out.println("[GATE] Is 0 blocks inside gate.");
return false;
}
System.out.println("[GATE] Ship volume: " + shipVolume + ", blocks in gate: " + numBlocks + ". Percentage: " + ((shipVolume / numBlocks) * 100));
// At least 80% of ship must be inside jumpgate
if (shipVolume / numBlocks > 0.8F)
{
@ -657,7 +642,6 @@ System.out.println("ZLO7");
{
if (currentEnergyValue - calculateRequiredEnergy(shipVolume, distance) < 0)
{
System.out.println("[WP-TE] Insufficient energy to jump");
this.controller.setJumpFlag(false);
return;
}
@ -717,12 +701,10 @@ System.out.println("ZLO7");
return;
}
System.out.println("[GATE] Place found over " + (10 - numTries) + " tries.");
}
// Consume energy
currentEnergyValue -= calculateRequiredEnergy(shipVolume, distance);
System.out.println("[TE-WC] Moving ship to a place around gate '" + jg.name + "' (" + destX + "; " + destY + "; " + destZ + ")");
EntityJump jump = new EntityJump(worldObj, xCoord, yCoord, zCoord, 1, 0, dx, dz, this);
jump.maxX = maxX;
jump.minX = minX;
@ -764,14 +746,12 @@ System.out.println("ZLO7");
return;
}
System.out.println("[TE-WC] Performing gate jump...");
doGateJump();
return;
}
if (currentMode == this.MODE_BEACON_JUMP)
{
System.out.println("[TE-WC] Performing beacon jump...");
doBeaconJump();
return;
}
@ -799,23 +779,14 @@ System.out.println("ZLO7");
if (currentMode == this.MODE_BASIC_JUMP || currentMode == this.MODE_LONG_JUMP || currentMode == MODE_HYPERSPACE)
{
System.out.println("[WP-TE] Energy: " + currentEnergyValue + " eU");
System.out.println("[WP-TE] Need to jump: " + calculateRequiredEnergy(shipVolume, distance) + " eU");
if (this.currentEnergyValue - calculateRequiredEnergy(shipVolume, distance) < 0)
{
System.out.println("[WP-TE] Insufficient energy to jump");
messageToAllPlayersOnShip("Insufficient energy to jump!");
this.controller.setJumpFlag(false);
return;
}
this.currentEnergyValue -= calculateRequiredEnergy(shipVolume, distance);
System.out.println((new StringBuilder()).append("Jump params: X ").append(minX).append(" -> ").append(maxX).append(" blocks").toString());
System.out.println((new StringBuilder()).append("Jump params: Y ").append(minY).append(" -> ").append(maxY).append(" blocks").toString());
System.out.println((new StringBuilder()).append("Jump params: Z ").append(minZ).append(" -> ").append(maxZ).append(" blocks").toString());
//System.out.println("[WC-TE] Distance: " + distance + "; shipSize: " + shipSize);
if (this.currentMode == this.MODE_BASIC_JUMP)
{
distance += shipSize;
@ -829,7 +800,6 @@ System.out.println("ZLO7");
}
}
System.out.println((new StringBuilder()).append("[JUMP] Totally moving ").append((new StringBuilder()).append(shipVolume).append(" blocks to length ").append(distance).append(" blocks, direction: ").append(direction).toString()).toString());
EntityJump jump = new EntityJump(worldObj, xCoord, yCoord, zCoord, distance, direction, dx, dz, this);
jump.maxX = maxX;
jump.minX = minX;
@ -850,7 +820,6 @@ System.out.println("ZLO7");
{
jump.toHyperSpace = (worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID);
jump.fromHyperSpace = (worldObj.provider.dimensionId == WarpDrive.instance.hyperSpaceDimID);
System.out.println("[JUMP] From HS: " + jump.fromHyperSpace + " | To HS: " + jump.fromHyperSpace);
}
jump.xCoord = xCoord;
@ -941,7 +910,6 @@ System.out.println("ZLO7");
if (checkPlayerInventory(chest, player))
{
System.out.println("[P] Summoning " + player.username);
summonPlayer(player, xCoord, yCoord + 2, zCoord);
}
}
@ -977,7 +945,6 @@ System.out.println("ZLO7");
if (keyLength < MIN_KEY_LENGTH)
{
System.out.println("[ChestCode] Key is too short: " + keyLength + " < " + MIN_KEY_LENGTH);
return false;
}

View file

@ -167,7 +167,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
deployDelayTicks = 0;
int blocks = Math.min(BLOCK_TO_DEPLOY_PER_TICK, blocksToDeployCount - currentDeployIndex);
// System.out.println("[ShipScanner] Deploying ship part: " + currentDeployIndex + "/" + blocksToDeployCount + " [remains: " + blocks + "]");
if (blocks == 0) {
isDeploying = false;
@ -337,14 +336,12 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
schematic.setShort("Length", length);
schematic.setShort("Height", height);
// System.out.println("[ShipScanner] Ship parameters: w: " + width + ", l: " + length + ", h:" + height);
int size = width * length * height;
// Consume energy
currentEnergyValue = Math.abs(currentEnergyValue - size * EU_PER_BLOCK_SCAN);
// System.out.println("[ShipScanner] Size: " + size);
byte localBlocks[] = new byte[size];
byte localMetadata[] = new byte[size];
@ -419,7 +416,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
}
private void writeNBTToFile(String fileName, NBTTagCompound nbttagcompound) {
// System.out.println("[ShipScanner] Filename: " + fileName);
try {
File file = new File(fileName);
@ -485,7 +481,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
NBTTagCompound schematic = readNBTFromFile(SCHEMATICS_DIR + "/" + fileName);
if (schematic == null) {
// System.out.println("[ShipScanner] Schematic is null!");
return new Object[] { -1, "Unknow error. Schematic NBT is null" };
}
@ -507,11 +502,9 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
int size = width* height * length;
// System.out.println("[ShipScanner] Deploying ship: (size: " + size + ", h: " + height + ", w: " + width + ", l: " + length + ")");
// Check energy level
if (!isEnoughEnergyForDeploy(size)) {
// System.out.println("[ShipScanner] Not enough energy! Need at least " + (Math.abs(size * EU_PER_BLOCK_DEPLOY - currentEnergyValue)) + " Eu");
return new Object[] { 1, "Not enough energy! Need at least " + (Math.abs(size * EU_PER_BLOCK_DEPLOY - currentEnergyValue)) + " Eu" };
}
@ -528,7 +521,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
}
if (occupiedBlockCount > 0) {
// System.out.println("[ShipScanner] Deploying area occupied with " + occupiedBlockCount + " blocks. Can't deploy ship.");
return new Object[] { 2, "Deploying area occupied with " + occupiedBlockCount + " blocks. Can't deploy ship." };
}
@ -545,11 +537,9 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
this.newY = targetY;
this.newZ = targetZ;
// System.out.println("[ShipScanner] Target to deploy: (" + targetX + ", " + targetY + ", " + targetZ + ")");
// Read blocks and TileEntities from NBT to internal storage array
// System.out.println("[ShipScanner] Loading blocks...");
byte localBlocks[] = schematic.getByteArray("Blocks");
byte localMetadata[] = schematic.getByteArray("Data");
@ -568,7 +558,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
}
// Load Tile Entities
// System.out.println("[ShipScanner] Loading TileEntities...");
NBTTagCompound[] tileEntities = new NBTTagCompound[size];
NBTTagList tileEntitiesList = schematic.getTagList("TileEntities");
@ -578,7 +567,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
int teY = teTag.getInteger("y");
int teZ = teTag.getInteger("z");
// System.out.println("[ShipScanner] Loaded TE: " + teTag.getString("id"));
tileEntities[teX + (teY * length + teZ) * width] = teTag;
}
@ -598,22 +586,12 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
jb.x = x;
jb.y = y;
jb.z = z;
/*
if (jb.blockID != 0 && Block.blocksList[jb.blockID] != null) {
System.out.print("[ShipScanner] Saving block: " + Block.blocksList[jb.blockID].getUnlocalizedName() + ", TE: ");
if (tileEntities[x + (y * length + z) * width] == null) {
System.out.println("null!");
} else
System.out.println(tileEntities[x + (y * length + z) * width].getString("id"));
}
*/
blocksToDeploy[x + (y * length + z) * width] = jb;
}
}
}
switchState(1);
// System.out.println("[ShipScanner] Ship deployed.");
return new Object[] { 3, "Ship deployed." };
}
@ -679,7 +657,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
return new Object[] { 0, "Specified .schematic file not found!" };
else
{
// System.out.println("[ShipScanner] Trying to deploy ship");
return deployShip(fileName, x, y, z);
}
} else