Implemented placement priority in jump sequencer
Added finer jump logs Improved LUA and StarMap logs
This commit is contained in:
parent
0d456ccc24
commit
345ee71997
5 changed files with 182 additions and 169 deletions
|
@ -165,7 +165,7 @@ public class EntityJump extends Entity {
|
|||
return;
|
||||
}
|
||||
|
||||
if (minY < 0 || maxY > 256) {
|
||||
if (minY < 0 || maxY > 255) {
|
||||
String msg = "Invalid Y coordinate(s), check ship dimensions...";
|
||||
messageToAllPlayersOnShip(msg);
|
||||
killEntity(msg);
|
||||
|
@ -174,9 +174,6 @@ public class EntityJump extends Entity {
|
|||
|
||||
ticks++;
|
||||
if (state == STATE_IDLE) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Preparing to jump...");
|
||||
}
|
||||
prepareToJump();
|
||||
if (on) {
|
||||
state = STATE_JUMPING;
|
||||
|
@ -328,9 +325,13 @@ public class EntityJump extends Entity {
|
|||
}
|
||||
|
||||
private void prepareToJump() {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Preparing to jump...");
|
||||
}
|
||||
LocalProfiler.start("EntityJump.prepareToJump");
|
||||
|
||||
StringBuilder reason = new StringBuilder();
|
||||
|
||||
LocalProfiler.start("EntityJump.prepareToJump");
|
||||
boolean isInSpace = (worldObj.provider.dimensionId == WarpDriveConfig.G_SPACE_DIMENSION_ID);
|
||||
boolean isInHyperSpace = (worldObj.provider.dimensionId == WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID);
|
||||
|
||||
|
@ -459,7 +460,7 @@ public class EntityJump extends Entity {
|
|||
}
|
||||
|
||||
if (betweenWorlds && WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Worlds: " + worldObj.provider.getDimensionName() + " -> " + targetWorld.provider.getDimensionName());
|
||||
WarpDrive.logger.info(this + " From world " + worldObj.provider.getDimensionName() + " to " + targetWorld.provider.getDimensionName());
|
||||
}
|
||||
|
||||
// Validate positions aren't overlapping
|
||||
|
@ -484,7 +485,7 @@ public class EntityJump extends Entity {
|
|||
LocalProfiler.stop();
|
||||
return;
|
||||
}
|
||||
// lockWorlds();
|
||||
|
||||
saveEntities();
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Saved " + entitiesOnShip.size() + " entities from ship");
|
||||
|
@ -519,70 +520,78 @@ public class EntityJump extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish jump: move entities, unlock worlds and delete self
|
||||
*/
|
||||
private void finishJump() {
|
||||
// FIXME TileEntity duplication workaround
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Jump done in " + ((System.currentTimeMillis() - msCounter) / 1000F) + " seconds and " + ticks + " ticks");
|
||||
WarpDrive.logger.info("Removing TE duplicates: tileEntities in target world after jump, before cleanup: " + targetWorld.loadedTileEntityList.size());
|
||||
}
|
||||
LocalProfiler.start("EntityJump.removeDuplicates()");
|
||||
private int getRealShipVolume_checkBedrock(StringBuilder reason) {
|
||||
LocalProfiler.start("EntityJump.getRealShipVolume_checkBedrock");
|
||||
int shipVolume = 0;
|
||||
|
||||
try {
|
||||
targetWorld.loadedTileEntityList = this.removeDuplicates(targetWorld.loadedTileEntityList);
|
||||
} catch (Exception exception) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("TE Duplicates removing exception: " + exception.getMessage());
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
|
||||
// Skipping vanilla air & ignored blocks
|
||||
if (block == Blocks.air || WarpDriveConfig.BLOCKS_LEFTBEHIND.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
shipVolume++;
|
||||
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Block(" + x + ", " + y + ", " + z + ") is " + block.getUnlocalizedName() + "@" + worldObj.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
// Stop on non-movable blocks
|
||||
if (WarpDriveConfig.BLOCKS_ANCHOR.contains(block)) {
|
||||
reason.append(block.getUnlocalizedName() + " detected onboard at " + x + ", " + y + ", " + z + ". Aborting.");
|
||||
LocalProfiler.stop();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doCollisionDamage(true);
|
||||
// Abort jump if blocks with TE are connecting to the ship (avoid crash when splitting multi-blocks)
|
||||
for (int x = minX - 1; x <= maxX + 1; x++) {
|
||||
boolean xBorder = (x == minX - 1) || (x == maxX + 1);
|
||||
for (int z = minZ - 1; z <= maxZ + 1; z++) {
|
||||
boolean zBorder = (z == minZ - 1) || (z == maxZ + 1);
|
||||
for (int y = minY - 1; y <= maxY + 1; y++) {
|
||||
boolean yBorder = (y == minY - 1) || (y == maxY + 1);
|
||||
if ((y < 0) || (y > 255)) {
|
||||
continue;
|
||||
}
|
||||
if (!(xBorder || yBorder || zBorder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
|
||||
// Skipping any air block & ignored blocks
|
||||
if (worldObj.isAirBlock(x, y, z) || WarpDriveConfig.BLOCKS_LEFTBEHIND.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skipping non-movable blocks
|
||||
if (WarpDriveConfig.BLOCKS_ANCHOR.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skipping blocks without tile entities
|
||||
TileEntity tileEntity = worldObj.getTileEntity(x, y, z);
|
||||
if (tileEntity == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
reason.append("Ship snagged by " + block.getLocalizedName() + " at " + x + ", " + y + ", " + z + ". Damage report pending...");
|
||||
worldObj.createExplosion((Entity) null, x, y, z, Math.min(4F * 30, 4F * (shipVolume / 50)), false);
|
||||
LocalProfiler.stop();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LocalProfiler.stop();
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("Removing TE duplicates: tileEntities in target world after jump, after cleanup: " + targetWorld.loadedTileEntityList.size());
|
||||
}
|
||||
killEntity("Jump done");
|
||||
}
|
||||
|
||||
/**
|
||||
* Removing ship from world
|
||||
*
|
||||
*/
|
||||
private void removeShip() {
|
||||
LocalProfiler.start("EntityJump.removeShip");
|
||||
int blocksToMove = Math.min(WarpDriveConfig.G_BLOCKS_PER_TICK, ship.length - currentIndexInShip);
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Removing ship blocks " + currentIndexInShip + " to " + (currentIndexInShip + blocksToMove - 1) + " / " + (ship.length - 1));
|
||||
}
|
||||
for (int index = 0; index < blocksToMove; index++) {
|
||||
if (currentIndexInShip >= ship.length) {
|
||||
break;
|
||||
}
|
||||
JumpBlock jb = ship[ship.length - currentIndexInShip - 1];
|
||||
if (jb == null) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Removing ship part: unexpected null found at ship[" + currentIndexInShip + "]");
|
||||
}
|
||||
currentIndexInShip++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (jb.blockTileEntity != null) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("Removing tile entity at " + jb.x + ", " + jb.y + ", " + jb.z);
|
||||
}
|
||||
worldObj.removeTileEntity(jb.x, jb.y, jb.z);
|
||||
}
|
||||
worldObj.setBlock(jb.x, jb.y, jb.z, Blocks.air, 0, 2);
|
||||
|
||||
JumpBlock.refreshBlockStateOnClient(targetWorld, jb.x + moveX, jb.y + moveY, jb.z + moveZ);
|
||||
|
||||
currentIndexInShip++;
|
||||
}
|
||||
LocalProfiler.stop();
|
||||
return shipVolume;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -624,9 +633,13 @@ public class EntityJump extends Entity {
|
|||
JumpBlock jumpBlock = new JumpBlock(block, blockMeta, tileEntity, x, y, z);
|
||||
|
||||
// default priority is 2 for block, 3 for tile entities
|
||||
int placeTime = 2;
|
||||
if (tileEntity != null) {
|
||||
placeTime = 3;
|
||||
Integer placeTime = WarpDriveConfig.BLOCKS_PLACE.get(block);
|
||||
if (placeTime == null) {
|
||||
if (tileEntity == null) {
|
||||
placeTime = 2;
|
||||
} else {
|
||||
placeTime = 3;
|
||||
}
|
||||
}
|
||||
|
||||
placeTimeJumpBlocks[placeTime][placeTimeIndexes[placeTime]] = jumpBlock;
|
||||
|
@ -675,8 +688,10 @@ public class EntityJump extends Entity {
|
|||
|
||||
JumpBlock jb = ship[currentIndexInShip];
|
||||
if (jb != null) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Deploying from " + jb.x + ", " + jb.y + ", " + jb.z + " of " + jb.block + "@" + jb.blockMeta);
|
||||
}
|
||||
jb.deploy(targetWorld, moveX, moveY, moveZ);
|
||||
// 1.6.4 required to keep tile entities for CC_peripheral:2 or :4
|
||||
worldObj.removeTileEntity(jb.x, jb.y, jb.z);
|
||||
}
|
||||
currentIndexInShip++;
|
||||
|
@ -685,6 +700,77 @@ public class EntityJump extends Entity {
|
|||
LocalProfiler.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removing ship from world
|
||||
*/
|
||||
private void removeShip() {
|
||||
LocalProfiler.start("EntityJump.removeShip");
|
||||
int blocksToMove = Math.min(WarpDriveConfig.G_BLOCKS_PER_TICK, ship.length - currentIndexInShip);
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Removing ship blocks " + currentIndexInShip + " to " + (currentIndexInShip + blocksToMove - 1) + " / " + (ship.length - 1));
|
||||
}
|
||||
for (int index = 0; index < blocksToMove; index++) {
|
||||
if (currentIndexInShip >= ship.length) {
|
||||
break;
|
||||
}
|
||||
JumpBlock jb = ship[ship.length - currentIndexInShip - 1];
|
||||
if (jb == null) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Removing ship part: unexpected null found at ship[" + currentIndexInShip + "]");
|
||||
}
|
||||
currentIndexInShip++;
|
||||
continue;
|
||||
}
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Removing block " + jb.block + "@" + jb.blockMeta + " at " + jb.x + ", " + jb.y + ", " + jb.z);
|
||||
}
|
||||
|
||||
if (jb.blockTileEntity != null) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Removing tile entity at " + jb.x + ", " + jb.y + ", " + jb.z);
|
||||
}
|
||||
worldObj.removeTileEntity(jb.x, jb.y, jb.z);
|
||||
}
|
||||
worldObj.setBlock(jb.x, jb.y, jb.z, Blocks.air, 0, 2);
|
||||
|
||||
JumpBlock.refreshBlockStateOnClient(targetWorld, jb.x + moveX, jb.y + moveY, jb.z + moveZ);
|
||||
|
||||
currentIndexInShip++;
|
||||
}
|
||||
LocalProfiler.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish jump: move entities, unlock worlds and delete self
|
||||
*/
|
||||
private void finishJump() {
|
||||
// FIXME TileEntity duplication workaround
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Jump done in " + ((System.currentTimeMillis() - msCounter) / 1000F) + " seconds and " + ticks + " ticks");
|
||||
}
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Removing TE duplicates: tileEntities in target world after jump, before cleanup: " + targetWorld.loadedTileEntityList.size());
|
||||
}
|
||||
LocalProfiler.start("EntityJump.removeDuplicates()");
|
||||
|
||||
try {
|
||||
targetWorld.loadedTileEntityList = this.removeDuplicates(targetWorld.loadedTileEntityList);
|
||||
} catch (Exception exception) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("TE Duplicates removing exception: " + exception.getMessage());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
doCollisionDamage(true);
|
||||
|
||||
LocalProfiler.stop();
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Removing TE duplicates: tileEntities in target world after jump, after cleanup: " + targetWorld.loadedTileEntityList.size());
|
||||
}
|
||||
killEntity("Jump done");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking jump possibility
|
||||
*
|
||||
|
@ -810,80 +896,6 @@ public class EntityJump extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
private int getRealShipVolume_checkBedrock(StringBuilder reason) {
|
||||
LocalProfiler.start("EntityJump.getRealShipVolume_checkBedrock");
|
||||
int shipVolume = 0;
|
||||
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
|
||||
// Skipping vanilla air & ignored blocks
|
||||
if (block == Blocks.air || WarpDriveConfig.BLOCKS_LEFTBEHIND.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
shipVolume++;
|
||||
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("Block(" + x + ", " + y + ", " + z + ") is " + block.getUnlocalizedName() + "@" + worldObj.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
// Stop on non-movable blocks
|
||||
if (WarpDriveConfig.BLOCKS_ANCHOR.contains(block)) {
|
||||
reason.append(block.getUnlocalizedName() + " detected onboard at " + x + ", " + y + ", " + z + ". Aborting.");
|
||||
LocalProfiler.stop();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Abort jump if blocks with TE are connecting to the ship (avoid crash when splitting multi-blocks)
|
||||
for (int x = minX - 1; x <= maxX + 1; x++) {
|
||||
boolean xBorder = (x == minX - 1) || (x == maxX + 1);
|
||||
for (int z = minZ - 1; z <= maxZ + 1; z++) {
|
||||
boolean zBorder = (z == minZ - 1) || (z == maxZ + 1);
|
||||
for (int y = minY - 1; y <= maxY + 1; y++) {
|
||||
boolean yBorder = (y == minY - 1) || (y == maxY + 1);
|
||||
if ((y < 0) || (y > 255)) {
|
||||
continue;
|
||||
}
|
||||
if (!(xBorder || yBorder || zBorder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
|
||||
// Skipping any air block & ignored blocks
|
||||
if (worldObj.isAirBlock(x, y, z) || WarpDriveConfig.BLOCKS_LEFTBEHIND.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skipping non-movable blocks
|
||||
if (WarpDriveConfig.BLOCKS_ANCHOR.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skipping blocks without tile entities
|
||||
TileEntity tileEntity = worldObj.getTileEntity(x, y, z);
|
||||
if (tileEntity == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
reason.append("Ship snagged by " + block.getLocalizedName() + " at " + x + ", " + y + ", " + z + ". Damage report pending...");
|
||||
worldObj.createExplosion((Entity) null, x, y, z, Math.min(4F * 30, 4F * (shipVolume / 50)), false);
|
||||
LocalProfiler.stop();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LocalProfiler.stop();
|
||||
return shipVolume;
|
||||
}
|
||||
|
||||
private void saveEntities() {
|
||||
entitiesOnShip = new ArrayList<MovingEntity>();
|
||||
|
||||
|
@ -1034,7 +1046,7 @@ public class EntityJump extends Entity {
|
|||
atTarget.add(new Vector3(tx, ty, tz));
|
||||
isCollision = isCollision || pisCollision;
|
||||
reason = preason;
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("CheckMovementResult " + sx + ", " + sy + ", " + sz + " -> " + tx + ", " + ty + ", " + tz + " " + isCollision + " '" + reason + "'");
|
||||
}
|
||||
}
|
||||
|
@ -1110,7 +1122,7 @@ public class EntityJump extends Entity {
|
|||
@Override
|
||||
public int compare(TileEntity o1, TileEntity o2) {
|
||||
if (o1.xCoord == o2.xCoord && o1.yCoord == o2.yCoord && o1.zCoord == o2.zCoord) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Removed duplicated TE: " + o1 + ", " + o2);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1151,10 +1163,11 @@ public class EntityJump extends Entity {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s/%d \'%s\' @ \'%s\' %.2f, %.2f, %.2f", new Object[] {
|
||||
return String.format("%s/%d \'%s\' @ \'%s\' %.2f, %.2f, %.2f #%d", new Object[] {
|
||||
getClass().getSimpleName(), Integer.valueOf(getEntityId()),
|
||||
shipCore == null ? "~NULL~" : (shipCore.uuid + ":" + shipCore.shipName),
|
||||
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
|
||||
Double.valueOf(posX), Double.valueOf(posY), Double.valueOf(posZ) });
|
||||
Double.valueOf(posX), Double.valueOf(posY), Double.valueOf(posZ),
|
||||
Integer.valueOf(ticks)});
|
||||
}
|
||||
}
|
|
@ -132,7 +132,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
|
|||
this.direction = dir;
|
||||
}
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info(this + " Direction set to " + this.direction);
|
||||
WarpDrive.logger.info(this + " Direction set to " + direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
|
|||
return new Integer[] { getFront(), getRight(), getUp() };
|
||||
}
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("Setting positive gabarits: f: " + argInt0 + " r: " + argInt1 + " u: " + argInt2);
|
||||
WarpDrive.logger.info(this + " Positive dimensions set to front " + argInt0 + ", right " + argInt1 + ", up " + argInt2);
|
||||
}
|
||||
setFront(argInt0);
|
||||
setRight(argInt1);
|
||||
|
@ -613,7 +613,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
|
|||
return new Integer[] { getBack(), getLeft(), getDown() };
|
||||
}
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.logger.info("Setting negative gabarits: b: " + argInt0 + " l: " + argInt1 + " d: " + argInt2);
|
||||
WarpDrive.logger.info(this + " Negative dimensions set to back " + argInt0 + ", left " + argInt1 + ", down " + argInt2);
|
||||
}
|
||||
setBack(argInt0);
|
||||
setLeft(argInt1);
|
||||
|
@ -718,7 +718,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
|
|||
}
|
||||
return new Object[] { core.shipMass };
|
||||
} catch (Exception exception) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {// disabled by default to avoid console spam as ship size is checked quite frequently
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {// disabled by default to avoid console spam as ship size is checked quite frequently
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -148,10 +148,9 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
if (uuid == null || (uuid.getMostSignificantBits() == 0 && uuid.getLeastSignificantBits() == 0)) {
|
||||
uuid = UUID.randomUUID();
|
||||
}
|
||||
// recovery registration, shouldn't be need, in theory...
|
||||
// recovery registration, shouldn't be needed, in theory...
|
||||
WarpDrive.starMap.updateInRegistry(new StarMapEntry(this));
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
WarpDrive.starMap.printRegistry();
|
||||
WarpDrive.logger.info(this + " controller is " + controller + ", warmupTime " + warmupTime + ", currentMode " + currentMode + ", jumpFlag "
|
||||
+ (controller == null ? "NA" : controller.isJumpFlag()) + ", cooldownTime " + cooldownTime);
|
||||
}
|
||||
|
@ -378,32 +377,31 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
isolationBlocksCount = newCount;
|
||||
if (isolationBlocksCount >= WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS) {
|
||||
isolationRate = WarpDriveConfig.RADAR_MIN_ISOLATION_EFFECT
|
||||
+ (isolationBlocksCount - WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS) // bonus
|
||||
// blocks
|
||||
+ (isolationBlocksCount - WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS) // bonus blocks
|
||||
* (WarpDriveConfig.RADAR_MAX_ISOLATION_EFFECT - WarpDriveConfig.RADAR_MIN_ISOLATION_EFFECT)
|
||||
/ (WarpDriveConfig.RADAR_MAX_ISOLATION_BLOCKS - WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS);
|
||||
} else {
|
||||
isolationRate = 0.0D;
|
||||
}
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info(this + " Isolation updated to " + isolationBlocksCount + " (" + String.format("%.1f", isolationRate * 100) + "%)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void makePlayersOnShipDrunk(int tickDuration) {
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ);
|
||||
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
|
||||
|
||||
|
||||
for (Object o : list) {
|
||||
if (o == null || !(o instanceof EntityPlayer)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Set "drunk" effect
|
||||
((EntityPlayer) o).addPotionEffect(new PotionEffect(Potion.confusion.id, tickDuration, 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void summonPlayers() {
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ);
|
||||
|
||||
|
@ -677,7 +675,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
}
|
||||
|
||||
private boolean isFreePlaceForShip(int destX, int destY, int destZ) {
|
||||
int newX, newY, newZ;
|
||||
int newX, newZ;
|
||||
|
||||
if (destY + shipUp > 255 || destY - shipDown < 5) {
|
||||
return false;
|
||||
|
@ -688,10 +686,12 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
int moveZ = destZ - zCoord;
|
||||
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
newX = moveX + x;
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
newZ = moveZ + z;
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
Block blockSource = worldObj.getBlock(x, y, z);
|
||||
Block blockTarget = worldObj.getBlock(moveX + x, moveY + y, moveZ + z);
|
||||
Block blockTarget = worldObj.getBlock(newX, moveY + y, newZ);
|
||||
|
||||
// not vanilla air nor ignored blocks at source
|
||||
// not vanilla air nor expandable blocks are target location
|
||||
|
|
|
@ -64,7 +64,7 @@ public class JumpBlock {
|
|||
oldnbt.setInteger("z", newZ);
|
||||
|
||||
if (oldnbt.hasKey("mainX") && oldnbt.hasKey("mainY") && oldnbt.hasKey("mainZ")) {// Mekanism 6.0.4.44
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info(this + " deploy: TileEntity has mainXYZ");
|
||||
}
|
||||
oldnbt.setInteger("mainX", oldnbt.getInteger("mainX") + offsetX);
|
||||
|
@ -76,7 +76,7 @@ public class JumpBlock {
|
|||
NBTTagCompound nbtScreenData = oldnbt.getCompoundTag("screenData");
|
||||
if ( nbtScreenData.hasKey("minX") && nbtScreenData.hasKey("minY") && nbtScreenData.hasKey("minZ")
|
||||
&& nbtScreenData.hasKey("maxX") && nbtScreenData.hasKey("maxY") && nbtScreenData.hasKey("maxZ")) {
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info(this + " deploy: TileEntity has screenData.min/maxXYZ");
|
||||
}
|
||||
nbtScreenData.setInteger("minX", nbtScreenData.getInteger("minX") + offsetX);
|
||||
|
@ -148,7 +148,7 @@ public class JumpBlock {
|
|||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
Class<?> teClass = tileEntity.getClass();
|
||||
if (WarpDriveConfig.LOGGING_JUMP) {
|
||||
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
|
||||
WarpDrive.logger.info("Tile at " + x + ", " + y + ", " + z + " is " + teClass + " derived from " + teClass.getSuperclass());
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class StarMapRegistry {
|
|||
registry.set(idx, entryKey);
|
||||
} else {
|
||||
registry.add(entryKey);
|
||||
printRegistry();
|
||||
printRegistry("added");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class StarMapRegistry {
|
|||
|
||||
if (idx != -1) {
|
||||
registry.remove(idx);
|
||||
printRegistry();
|
||||
printRegistry("removed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,8 @@ public class StarMapRegistry {
|
|||
return res;
|
||||
}
|
||||
|
||||
public void printRegistry() {
|
||||
WarpDrive.logger.info("Starmap registry (" + registry.size() + " entries):");
|
||||
public void printRegistry(final String trigger) {
|
||||
WarpDrive.logger.info("Starmap registry (" + registry.size() + " entries after " + trigger + "):");
|
||||
|
||||
for (StarMapEntry entry : registry) {
|
||||
WarpDrive.logger.info("- " + entry.type.toString() + " '" + entry.name + "' @ "
|
||||
|
|
Loading…
Reference in a new issue