Add limited debug logging option

This commit is contained in:
Justin Aquadro committed 2015-02-27 23:17:37 -05:00
1 parent b5c4b8a294
commit 328630fc9c
4 files changed
+29 -4

No files matched your search

+2 -2
View File
@@ -17,12 +17,12 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-1.2.3"
version = "1.7.10-1.2.4"
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StorageDrawers"
minecraft {
version = "1.7.10-10.13.2.1291"
version = "1.7.10-10.13.2.1307-1.7.10"
assetDir = "runtime/assets"
replace '@VERSION@', project.version
@@ -98,6 +98,10 @@ storageDrawers.config.prop.enableSidedInput=Enable Sided Input
storageDrawers.config.prop.enableSidedInput.tooltip=Other blocks can insert items into drawers.
storageDrawers.config.prop.enableSidedOutput=Enable Sided Output
storageDrawers.config.prop.enableSidedOutput.tooltip=Other blocks can extract items from drawers.
storageDrawers.config.prop.invertShift=Invert Shift
storageDrawers.config.prop.invertShift.tooltip=Inverts click and shift+click behavior.
storageDrawers.config.prop.enableDebugLogging=Enable Debug Logging
storageDrawers.config.prop.enableDebugLogging.tooltip=Prints extra information to the logs.
storageDrawers.config.integration=Integration
storageDrawers.config.integration.tooltip=Configure integration with other mods.
@@ -9,6 +9,7 @@ import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.core.ModItems;
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -34,6 +35,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.apache.logging.log4j.Level;
import java.util.List;
import java.util.Random;
@@ -178,6 +180,11 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
TileEntityDrawers tileDrawers = getTileEntitySafe(world, x, y, z);
ItemStack item = player.inventory.getCurrentItem();
if (StorageDrawers.config.cache.debugTrace) {
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "BlockDrawers.onBlockActivated");
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, (item == null) ? " null item" : " " + item.toString());
}
if (item != null && item.getItem() != null) {
if (item.getItem() == ModItems.upgrade && item.getItemDamage() != tileDrawers.getStorageLevel()) {
tileDrawers.setStorageLevel(item.getItemDamage());
@@ -274,11 +281,17 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
float hitZ = (float)(posn.hitVec.zCoord - posn.blockZ);
StorageDrawers.network.sendToServer(new BlockClickMessage(x, y, z, posn.sideHit, hitX, hitY, hitZ));
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "BlockDrawers.onBlockClicked with " + posn.toString());
}
}
@Override
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "IExtendedBlockClickHandler.onBlockClicked");
TileEntityDrawers tileDrawers = getTileEntitySafe(world, x, y, z);
if (tileDrawers.getDirection() != side)
return;
@@ -293,6 +306,9 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
else
item = tileDrawers.takeItemsFromSlot(slot, 1);
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, (item == null) ? " null item" : " " + item.toString());
if (item != null && item.stackSize > 0) {
dropItemStack(world, x, y, z, player, item);
world.markBlockForUpdate(x, y, z);
@@ -62,6 +62,7 @@ public class ConfigManager
public boolean enableWailaIntegration;
public boolean enableAE2Integration;
public boolean invertShift;
public boolean debugTrace;
public int level2Mult;
public int level3Mult;
@@ -119,8 +120,12 @@ public class ConfigManager
cache.enableSidedInput = config.get(Configuration.CATEGORY_GENERAL, "enableSidedInput", true).setLanguageKey(LANG_PREFIX + "prop.enableSidedInput").getBoolean();
cache.enableSidedOutput = config.get(Configuration.CATEGORY_GENERAL, "enableSidedOutput", true).setLanguageKey(LANG_PREFIX + "prop.enableSidedOutput").getBoolean();
cache.invertShift = config.get(Configuration.CATEGORY_GENERAL, "invertShift", false,
"Inverts how shift works with drawers. If this is true, shifting will only give one item, where regular clicks will give a full stack. Leave false for default behavior.").getBoolean();
"Inverts how shift works with drawers. If this is true, shifting will only give one item, where regular clicks will give a full stack. Leave false for default behavior.")
.setLanguageKey(LANG_PREFIX + "prop.invertShift").getBoolean();
cache.debugTrace = config.get(Configuration.CATEGORY_GENERAL, "enableDebugLogging", false,
"Writes additional log messages while using the mod. Mainly for debug purposes. Should be kept disabled unless instructed otherwise.")
.setLanguageKey(LANG_PREFIX + "prop.enableDebugLogging").getBoolean();
cache.enableAE2Integration = config.get(sectionIntegration.getQualifiedName(), "enableAE2", true).setLanguageKey(LANG_PREFIX + "integration.enableAE2").setRequiresMcRestart(true).getBoolean();
cache.enableWailaIntegration = config.get(sectionIntegration.getQualifiedName(), "enableWaila", true).setLanguageKey(LANG_PREFIX + "integration.enableWaila").setRequiresMcRestart(true).getBoolean();