Re-added debug logs from comments

This commit is contained in:
LemADEC 2015-08-14 02:09:00 +02:00
parent 399cf8b6a2
commit 63dcfc5f7e
10 changed files with 62 additions and 34 deletions

View file

@ -302,7 +302,7 @@ public class EntityJump extends Entity {
if (entitiesOnShip == null) {
reactor.messageToAllPlayersOnShip(msg);
} else {
WarpDrive.logger.info("" + this + " messageToAllPlayersOnShip: " + msg);
WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + msg);
for (MovingEntity me : entitiesOnShip) {
if (me.entity instanceof EntityPlayer) {
WarpDrive.addChatMessage((EntityPlayer) me.entity, "["
@ -1161,19 +1161,19 @@ public class EntityJump extends Entity {
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
WarpDrive.logger.error("" + this + " readEntityFromNBT()");
WarpDrive.logger.error(this + " readEntityFromNBT()");
}
@Override
protected void entityInit() {
if (WarpDriveConfig.LOGGING_JUMP) {
WarpDrive.logger.warn("" + this + " entityInit()");
WarpDrive.logger.warn(this + " entityInit()");
}
}
@Override
protected void writeEntityToNBT(NBTTagCompound var1) {
WarpDrive.logger.error("" + this + " writeEntityToNBT()");
WarpDrive.logger.error(this + " writeEntityToNBT()");
}
private void FixASTurbines() {

View file

@ -189,7 +189,7 @@ public class WCClassTransformer implements net.minecraft.launchwrapper.IClassTra
ClassWriter writer = new ClassWriter(1);
node.accept(writer);
bytes = writer.toByteArray();
System.out.println("[WDCore] WarpDrive successfully injected bytecode into: " + node.name + " (" + injectionCount + " / " + operationCount + ")");
System.out.println("Successfully injected bytecode into: " + node.name + " (" + injectionCount + " / " + operationCount + ")");
return bytes;
}
}

View file

@ -201,7 +201,9 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
// Computer abstraction methods
protected void sendEvent(String eventName, Object[] arguments) {
// WarpDrive.debugPrint("" + this + " Sending event '" + eventName + "'");
if (WarpDriveConfig.LOGGING_LUA) {
WarpDrive.logger.info(this + " Sending event '" + eventName + "'");
}
if (WarpDriveConfig.isComputerCraftLoaded) {
Set<Integer> keys = connectedComputers.keySet();
for(Integer key:keys) {

View file

@ -206,7 +206,9 @@ public class TileEntityMiningLaser extends TileEntityAbstractInterfaced {
}
private void stop() {
// WarpDrive.debugPrint("" + this + " Stop requested");
if (WarpDriveConfig.LOGGING_COLLECTION) {
WarpDrive.logger.info(this + " Stop requested");
}
currentState = STATE_IDLE;
updateMetadata(BlockMiningLaser.ICON_IDLE);
}
@ -232,7 +234,9 @@ public class TileEntityMiningLaser extends TileEntityAbstractInterfaced {
if (block.getExplosionResistance(null) <= Blocks.obsidian.getExplosionResistance(null)) {
return true;
}
// WarpDrive.debugPrint("" + this + " Rejecting " + blockID + " at (" + x + ", " + y + ", " + z + ")");
if (WarpDriveConfig.LOGGING_COLLECTION) {
WarpDrive.logger.info(this + " Rejecting " + block + " at (" + x + ", " + y + ", " + z + ")");
}
return false;
}
@ -472,7 +476,9 @@ public class TileEntityMiningLaser extends TileEntityAbstractInterfaced {
}
}
// System.out.println("" + this + " Found " + valuablesInLayer.size() + " valuables");
if (WarpDriveConfig.LOGGING_COLLECTION) {
WarpDrive.logger.info(this + " Found " + valuablesInLayer.size() + " valuables");
}
}
private int getEnergyLevel() {

View file

@ -46,7 +46,9 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced {
registryUpdateTicks--;
if (registryUpdateTicks <= 0) {
registryUpdateTicks = REGISTRY_UPDATE_INTERVAL_TICKS;
// WarpDrive.debugPrint("" + this + " Updating registry (" + frequency + ")");
if (WarpDriveConfig.LOGGING_FREQUENCY) {
WarpDrive.logger.info(this + " Updating registry (" + frequency + ")");
}
WarpDrive.instance.cameras.updateInRegistry(worldObj, new ChunkPosition(xCoord, yCoord, zCoord), frequency, 0);
}
}
@ -70,14 +72,18 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced {
@Override
public void invalidate() {
// WarpDrive.debugPrint("" + this + " invalidated");
if (WarpDriveConfig.LOGGING_FREQUENCY) {
WarpDrive.logger.info(this + " invalidated");
}
WarpDrive.instance.cameras.removeFromRegistry(worldObj, new ChunkPosition(xCoord, yCoord, zCoord));
super.invalidate();
}
@Override
public void onChunkUnload() {
// WarpDrive.debugPrint("" + this + " onChunkUnload");
if (WarpDriveConfig.LOGGING_FREQUENCY) {
WarpDrive.logger.info(this + " onChunkUnload");
}
WarpDrive.instance.cameras.removeFromRegistry(worldObj, new ChunkPosition(xCoord, yCoord, zCoord));
super.onChunkUnload();
}
@ -86,14 +92,18 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced {
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
frequency = tag.getInteger("frequency");
// WarpDrive.debugPrint("" + this + " readFromNBT");
if (WarpDriveConfig.LOGGING_FREQUENCY) {
WarpDrive.logger.info(this + " readFromNBT");
}
}
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setInteger("frequency", frequency);
// WarpDrive.debugPrint("" + this + " writeToNBT");
if (WarpDriveConfig.LOGGING_FREQUENCY) {
WarpDrive.logger.info(this + " writeToNBT");
}
}
// OpenComputer callback methods

View file

@ -83,7 +83,9 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
updateTicks--;
if (updateTicks <= 0) {
WarpDrive.logger.info("" + this + " Updating cloaking state...");
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info(this + " Updating cloaking state...");
}
updateTicks = ((tier == 1) ? 20 : (tier == 2) ? 10 : 20) * WarpDriveConfig.CD_FIELD_REFRESH_INTERVAL_SECONDS; // resetting timer
isValid = validateAssembly();
@ -91,7 +93,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
if (!isEnabled) {// disabled
if (isCloaking) {// disabled, cloaking => stop cloaking
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info("" + this + " Disabled, cloak field going down...");
WarpDrive.logger.info(this + " Disabled, cloak field going down...");
}
disableCloakingField();
} else {// disabled, no cloaking
@ -125,7 +127,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
} else {// enabled & cloaked
if (!isValid) {// enabled, cloaking but invalid
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info("" + this + " Coil(s) lost, cloak field is collapsing...");
WarpDrive.logger.info(this + " Coil(s) lost, cloak field is collapsing...");
}
consumeAllEnergy();
disableCloakingField();
@ -144,7 +146,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
setCoilsState(true);
} else {// loosing power
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info("" + this + " Low power, cloak field is collapsing...");
WarpDrive.logger.info(this + " Low power, cloak field is collapsing...");
}
disableCloakingField();
}
@ -275,7 +277,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
energyToConsume = volume * WarpDriveConfig.CD_ENERGY_PER_BLOCK_TIER2;
}
//System.out.println("" + this + " Consuming " + energyToConsume + " eU for " + blocksCount + " blocks");
// WarpDrive.logger.info(this + " Consuming " + energyToConsume + " eU for " + blocksCount + " blocks");
return consumeEnergy(energyToConsume, false);
}

View file

@ -49,7 +49,9 @@ public class TileEntityRadar extends TileEntityAbstractEnergy {
cooldownTime++;
if (cooldownTime > (20 * ((scanRadius / 1000) + 1))) {
results = WarpDrive.shipCores.searchWarpCoresInRadius(xCoord, yCoord, zCoord, scanRadius);
// WarpDrive.debugPrint("" + this + " Scan found " + results.size() + " results in " + scanRadius + " radius...");
if (WarpDriveConfig.LOGGING_RADAR) {
WarpDrive.logger.info(this + " Scan found " + results.size() + " results in " + scanRadius + " radius...");
}
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
cooldownTime = 0;
}

View file

@ -122,7 +122,9 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
} else {
this.direction = dir;
}
// WarpDrive.print("" + this + " Direction set to " + this.direction);
if (WarpDriveConfig.LOGGING_JUMP) {
WarpDrive.logger.info(this + " Direction set to " + this.direction);
}
}
private void doJump() {

View file

@ -90,6 +90,8 @@ public class WarpDriveConfig {
public static boolean LOGGING_BUILDING = false;
public static boolean LOGGING_COLLECTION = false;
public static boolean LOGGING_TRANSPORTER = false;
public static boolean LOGGING_LUA = false;
public static boolean LOGGING_RADAR = false;
// Transition planes
public static TransitionPlane[] G_TRANSITIONPLANES = null;
@ -276,7 +278,9 @@ public class WarpDriveConfig {
LOGGING_BUILDING = config.get("Logging", "enable_building_logs", LOGGING_BUILDING, "Detailled building logs to help debug the mod, enable it before reporting a bug").getBoolean(false);
LOGGING_COLLECTION = config.get("Logging", "enable_collection_logs", LOGGING_COLLECTION, "Detailled collection logs to help debug the mod, enable it before reporting a bug").getBoolean(false);
LOGGING_TRANSPORTER = config.get("Logging", "enable_transporter_logs", LOGGING_TRANSPORTER, "Detailled transporter logs to help debug the mod, enable it before reporting a bug").getBoolean(false);
LOGGING_LUA = config.get("Logging", "enable_LUA_logs", LOGGING_LUA, "Detailled LUA logs to help debug the mod, enable it before reporting a bug").getBoolean(false);
LOGGING_RADAR = config.get("Logging", "enable_LUA_logs", LOGGING_RADAR, "Detailled radar logs to help debug the mod, enable it before reporting a bug").getBoolean(false);
// TransitionPlane
config.addCustomCategoryComment("TransitionPlane",
"Transition planes defines which region in space allows to go to other dimensions, default is overworld with 100k radius.\n"

View file

@ -24,9 +24,6 @@ public class CloakedArea {
public boolean isPlayerListedInArea(String username) {
for (String playerInArea : playersInArea) {
// WarpDrive.debugPrint("" + this + " Checking player: " +
// p.username + "(" + p.entityId + ")" + " =? " + player.username +
// " (" + p.entityId + ")");
if (playerInArea.equals(username)) {
return true;
}
@ -120,8 +117,9 @@ public class CloakedArea {
public void updatePlayer(EntityPlayer player) {
if (isEntityWithinArea(player)) {
if (!isPlayerListedInArea(player.getCommandSenderName())) {
// WarpDrive.debugPrint("" + this + " Player " + player.username
// + " has entered");
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info(this + " Player " + player.getCommandSenderName() + " has entered");
}
addPlayer(player.getCommandSenderName());
revealChunksToPlayer(player);
revealEntityToPlayer(player);
@ -129,8 +127,9 @@ public class CloakedArea {
}
} else {
if (isPlayerListedInArea(player.getCommandSenderName())) {
// WarpDrive.debugPrint("" + this + " Player " + player.username
// + " has left");
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info(this + " Player " + player.getCommandSenderName() + " has left");
}
removePlayer(player.getCommandSenderName());
MinecraftServer
.getServer()
@ -142,16 +141,17 @@ public class CloakedArea {
}
}
public void revealChunksToPlayer(EntityPlayer p) {
// WarpDrive.debugPrint("" + this +
// " Revealing cloaked blocks to player " + p.username);
public void revealChunksToPlayer(EntityPlayer player) {
if (WarpDriveConfig.LOGGING_CLOAKING) {
WarpDrive.logger.info(this + " Revealing cloaked blocks to player " + player.getCommandSenderName());
}
int minY = (int) Math.max(0, aabb.minY);
int maxY = (int) Math.min(255, aabb.maxY);
for (int x = (int) aabb.minX; x <= (int) aabb.maxX; x++) {
for (int z = (int) aabb.minZ; z <= (int) aabb.maxZ; z++) {
for (int y = minY; y <= maxY; y++) {
if (!p.worldObj.getBlock(x, y, z).isAssociatedBlock(Blocks.air)) {
p.worldObj.markBlockForUpdate(x, y, z);
if (!player.worldObj.getBlock(x, y, z).isAssociatedBlock(Blocks.air)) {
player.worldObj.markBlockForUpdate(x, y, z);
}
}
}