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

View file

@ -189,7 +189,7 @@ public class WCClassTransformer implements net.minecraft.launchwrapper.IClassTra
ClassWriter writer = new ClassWriter(1); ClassWriter writer = new ClassWriter(1);
node.accept(writer); node.accept(writer);
bytes = writer.toByteArray(); 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; return bytes;
} }
} }

View file

@ -201,7 +201,9 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
// Computer abstraction methods // Computer abstraction methods
protected void sendEvent(String eventName, Object[] arguments) { 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) { if (WarpDriveConfig.isComputerCraftLoaded) {
Set<Integer> keys = connectedComputers.keySet(); Set<Integer> keys = connectedComputers.keySet();
for(Integer key:keys) { for(Integer key:keys) {

View file

@ -206,7 +206,9 @@ public class TileEntityMiningLaser extends TileEntityAbstractInterfaced {
} }
private void stop() { private void stop() {
// WarpDrive.debugPrint("" + this + " Stop requested"); if (WarpDriveConfig.LOGGING_COLLECTION) {
WarpDrive.logger.info(this + " Stop requested");
}
currentState = STATE_IDLE; currentState = STATE_IDLE;
updateMetadata(BlockMiningLaser.ICON_IDLE); updateMetadata(BlockMiningLaser.ICON_IDLE);
} }
@ -232,7 +234,9 @@ public class TileEntityMiningLaser extends TileEntityAbstractInterfaced {
if (block.getExplosionResistance(null) <= Blocks.obsidian.getExplosionResistance(null)) { if (block.getExplosionResistance(null) <= Blocks.obsidian.getExplosionResistance(null)) {
return true; 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; 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() { private int getEnergyLevel() {

View file

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

View file

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

View file

@ -49,7 +49,9 @@ public class TileEntityRadar extends TileEntityAbstractEnergy {
cooldownTime++; cooldownTime++;
if (cooldownTime > (20 * ((scanRadius / 1000) + 1))) { if (cooldownTime > (20 * ((scanRadius / 1000) + 1))) {
results = WarpDrive.shipCores.searchWarpCoresInRadius(xCoord, yCoord, zCoord, scanRadius); 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); worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
cooldownTime = 0; cooldownTime = 0;
} }

View file

@ -122,7 +122,9 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
} else { } else {
this.direction = dir; 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() { private void doJump() {

View file

@ -90,6 +90,8 @@ public class WarpDriveConfig {
public static boolean LOGGING_BUILDING = false; public static boolean LOGGING_BUILDING = false;
public static boolean LOGGING_COLLECTION = false; public static boolean LOGGING_COLLECTION = false;
public static boolean LOGGING_TRANSPORTER = false; public static boolean LOGGING_TRANSPORTER = false;
public static boolean LOGGING_LUA = false;
public static boolean LOGGING_RADAR = false;
// Transition planes // Transition planes
public static TransitionPlane[] G_TRANSITIONPLANES = null; public static TransitionPlane[] G_TRANSITIONPLANES = null;
@ -276,6 +278,8 @@ 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_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_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_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 // TransitionPlane
config.addCustomCategoryComment("TransitionPlane", config.addCustomCategoryComment("TransitionPlane",

View file

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