Fixed logger
Fixed crash at boot trying to use logger before creating it Fixed log formating (moving to FML logger)
This commit is contained in:
parent
ad765b41c0
commit
eaac754e2e
9 changed files with 24 additions and 23 deletions
|
@ -156,7 +156,7 @@ public class EntityJump extends Entity {
|
|||
}
|
||||
|
||||
if (!on) {
|
||||
WarpDrive.logger.fine(this + " Removing from onUpdate...");
|
||||
WarpDrive.debugPrint(this + " Removing from onUpdate...");
|
||||
worldObj.removeEntity(this);
|
||||
return;
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ public class EntityJump extends Entity {
|
|||
+ " blowPoints with massCorrection of " + String.format("%.2f", massCorrection) + " => strength "
|
||||
+ String.format("%.2f", collisionStrength));
|
||||
} else {
|
||||
WarpDrive.logger.severe("WarpDrive error: unable to compute collision points, ignoring...");
|
||||
WarpDrive.logger.error("WarpDrive error: unable to compute collision points, ignoring...");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,6 @@ public class LocalProfiler {
|
|||
|
||||
long self = (dt - stackElement.internal) / 1000; // in microseconds
|
||||
long total = dt / 1000;
|
||||
WarpDrive.logger.fine("Profiling '" + stackElement.name + "': " + (self / 1000.0F) + " ms, total: " + (total / 1000.0F) + " ms");
|
||||
WarpDrive.logger.info("Profiling '" + stackElement.name + "': " + (self / 1000.0F) + " ms, total: " + (total / 1000.0F) + " ms");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package cr0s.warpdrive;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -191,26 +193,25 @@ public class WarpDrive implements LoadingCallback {
|
|||
public void preInit(FMLPreInitializationEvent event) {
|
||||
WarpDriveConfig.preInit(new Configuration(event.getSuggestedConfigurationFile()));
|
||||
|
||||
logger = event.getModLog();
|
||||
|
||||
if (FMLCommonHandler.instance().getSide().isClient()) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
normalFOV = mc.gameSettings.fovSetting;
|
||||
normalSensitivity = mc.gameSettings.mouseSensitivity;
|
||||
logger.info("[WarpDrive] FOV is " + normalFOV + " Sensitivity is " + normalSensitivity);
|
||||
logger.info("FOV is " + normalFOV + " Sensitivity is " + normalSensitivity);
|
||||
}
|
||||
|
||||
logger = Logger.getLogger(WarpDrive.MODID, (FMLCommonHandler.instance().getEffectiveSide().isClient() ? "Client " : "Server "));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// FIXME FMLInterModComms.sendMessage("Waila", "register",
|
||||
// "cr0s.warpdrive.client.WailaHandler.callbackRegister");
|
||||
// FIXME FMLInterModComms.sendMessage("Waila", "register", "cr0s.warpdrive.client.WailaHandler.callbackRegister");
|
||||
}
|
||||
|
||||
public static void debugPrint(String out) {
|
||||
if (WarpDriveConfig.G_DEBUGMODE) {
|
||||
logger.info(out);
|
||||
logger.debug(out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ public class TileEntityMiningLaser extends WarpInterfacedTE {
|
|||
return isBlock;
|
||||
} else {
|
||||
// TODO: implement fluid support through AE or tanks
|
||||
WarpDrive.logger.severe("Fluids aren't supported yet, ML_DEUTERIUM_MUL_SILKTOUCH should be 0");
|
||||
WarpDrive.logger.error("Fluids aren't supported yet, ML_DEUTERIUM_MUL_SILKTOUCH should be 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -762,7 +762,7 @@ public class TileEntityReactor extends WarpEnergyTE {
|
|||
if (shipVolume < WarpDriveConfig.WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE) {
|
||||
Jumpgate nearestGate = null;
|
||||
if (WarpDrive.jumpgates == null) {
|
||||
WarpDrive.logger.warning(this + " WarpDrive.instance.jumpGates is NULL!");
|
||||
WarpDrive.logger.warn(this + " WarpDrive.instance.jumpGates is NULL!");
|
||||
} else {
|
||||
nearestGate = WarpDrive.jumpgates.findNearestGate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class BeamEffectMessage implements IMessage, IMessageHandler<BeamEffectMe
|
|||
public IMessage onMessage(BeamEffectMessage beamEffectMessage, MessageContext context) {
|
||||
// skip in case player just logged in
|
||||
if (context.getServerHandler().playerEntity.worldObj == null) {
|
||||
WarpDrive.logger.severe("WorldObj is null, ignoring beam packet");
|
||||
WarpDrive.logger.error("WorldObj is null, ignoring beam packet");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class CloakMessage implements IMessage, IMessageHandler<CloakMessage, IMe
|
|||
public IMessage onMessage(CloakMessage cloakMessage, MessageContext context) {
|
||||
// skip in case player just logged in
|
||||
if (context.getServerHandler().playerEntity.worldObj == null) {
|
||||
WarpDrive.logger.severe("WorldObj is null, ignoring cloak packet");
|
||||
WarpDrive.logger.error("WorldObj is null, ignoring cloak packet");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,10 +64,10 @@ public class FrequencyMessage implements IMessage, IMessageHandler<FrequencyMess
|
|||
} else if (te instanceof TileEntityLaser) {
|
||||
((TileEntityLaser) te).setCameraFrequency(frequency);
|
||||
} else {
|
||||
WarpDrive.logger.warning("Received frequency packet: (" + x + ", " + y + ", " + z + ") is not a valid tile entity");
|
||||
WarpDrive.logger.warn("Received frequency packet: (" + x + ", " + y + ", " + z + ") is not a valid tile entity");
|
||||
}
|
||||
} else {
|
||||
WarpDrive.logger.warning("Received frequency packet: (" + x + ", " + y + ", " + z + ") has no tile entity");
|
||||
WarpDrive.logger.warn("Received frequency packet: (" + x + ", " + y + ", " + z + ") has no tile entity");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class FrequencyMessage implements IMessage, IMessageHandler<FrequencyMess
|
|||
public IMessage onMessage(FrequencyMessage frequencyMessage, MessageContext context) {
|
||||
// skip in case player just logged in
|
||||
if (context.getServerHandler().playerEntity.worldObj == null) {
|
||||
WarpDrive.logger.severe("WorldObj is null, ignoring frequency packet");
|
||||
WarpDrive.logger.error("WorldObj is null, ignoring frequency packet");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ public class ClientCameraUtils {
|
|||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (parPlayerEntity == null) {
|
||||
WarpDrive.logger.severe("setupViewpoint with null player => denied");
|
||||
WarpDrive.logger.error("setupViewpoint with null player => denied");
|
||||
return;
|
||||
}
|
||||
if (entityCamera == null) {
|
||||
WarpDrive.logger.severe("setupViewpoint with null camera => denied");
|
||||
WarpDrive.logger.error("setupViewpoint with null camera => denied");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class ClientCameraUtils {
|
|||
entityPlayer = null;
|
||||
WarpDrive.debugPrint("Resetting viewpoint");
|
||||
} else {
|
||||
WarpDrive.logger.severe("reseting viewpoint with invalid player entity ?!?");
|
||||
WarpDrive.logger.error("reseting viewpoint with invalid player entity ?!?");
|
||||
}
|
||||
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
|
@ -73,11 +73,11 @@ public class ClientCameraUtils {
|
|||
return false;
|
||||
}
|
||||
if (!worldObj.getBlock(check1_x, check1_y, check1_z).isAssociatedBlock(check1_blockId)) {
|
||||
WarpDrive.logger.severe("checking viewpoint, found invalid block1 at (" + check1_x + ", " + check1_y + ", " + check1_z + ")");
|
||||
WarpDrive.logger.error("checking viewpoint, found invalid block1 at (" + check1_x + ", " + check1_y + ", " + check1_z + ")");
|
||||
return false;
|
||||
}
|
||||
if (!worldObj.getBlock(check2_x, check2_y, check2_z).isAssociatedBlock(check2_blockId)) {
|
||||
WarpDrive.logger.severe("checking viewpoint, found invalid block2 at (" + check2_x + ", " + check2_y + ", " + check2_z + ")");
|
||||
WarpDrive.logger.error("checking viewpoint, found invalid block2 at (" + check2_x + ", " + check2_y + ", " + check2_z + ")");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue