Merge pull request #2 from GTNewHorizons/fix/debug-spam

Suppress debug log for outside of dev env
This commit is contained in:
Martin Robertz authored and GitHub committed 2022-10-16 12:36:45 +02:00
commit fb869643ba
3 files changed
+27 -16

No files matched your search

+2
View File
@@ -11,3 +11,5 @@ jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
with:
client-only: true
@@ -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);