Suppress debug log for outside of dev env

This commit is contained in:
miozune committed 2022-10-16 18:20:54 +09:00
1 parent d339d8db82
commit e23a98cb8d
2 files changed
+25 -16

No files matched your search

@@ -1,5 +1,6 @@
package yalter.mousetweaks;
import net.minecraft.launchwrapper.Launch;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -11,6 +12,8 @@ public class Constants {
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
public static final boolean DEV_ENV = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
// Inventory-related stuff
public static final int INVENTORY_SIZE = 36; // Size of the player inventory
+22 -16
View File
@@ -108,17 +108,19 @@ public class Main extends DeobfuscationLayer {
container = getContainerWithID(currentScreen);
disableForThisContainer = isDisabledForThisContainer(currentScreen);
Constants.LOGGER.debug(new StringBuilder()
.append("You have just opened a ")
.append(getGuiContainerNameFromID(currentScreen))
.append(" container (")
.append(currentScreen.getClass().getSimpleName())
.append((container == null) ? "" : "; ")
.append((container == null) ? "" : container.getClass().getSimpleName())
.append("), which has ")
.append(getSlotCountWithID(currentScreen))
.append(" slots!")
.toString());
if (Constants.DEV_ENV) {
Constants.LOGGER.debug(new StringBuilder()
.append("You have just opened a ")
.append(getGuiContainerNameFromID(currentScreen))
.append(" container (")
.append(currentScreen.getClass().getSimpleName())
.append((container == null) ? "" : "; ")
.append((container == null) ? "" : container.getClass().getSimpleName())
.append("), which has ")
.append(getSlotCountWithID(currentScreen))
.append(" slots!")
.toString());
}
disableWheelForThisContainer = isWheelDisabledForThisContainer(currentScreen);
}
@@ -185,10 +187,12 @@ public class Main extends DeobfuscationLayer {
return;
}
Constants.LOGGER.debug(new StringBuilder()
.append("You have selected a new slot, it's slot number is ")
.append(getSlotNumber(selectedSlot))
.toString());
if (Constants.DEV_ENV) {
Constants.LOGGER.debug(new StringBuilder()
.append("You have selected a new slot, it's slot number is ")
.append(getSlotNumber(selectedSlot))
.toString());
}
boolean shiftIsDown = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
@@ -248,7 +252,9 @@ public class Main extends DeobfuscationLayer {
if ((wheel != 0) && (selectedSlot != null)) {
int numItemsToMove = Math.abs(wheel);
Constants.LOGGER.debug("numItemsToMove: " + numItemsToMove);
if (Constants.DEV_ENV) {
Constants.LOGGER.debug("numItemsToMove: " + numItemsToMove);
}
if (slotCount > Constants.INVENTORY_SIZE) {
ItemStack originalStack = getSlotStack(selectedSlot);