From 8ee43fdb284a4aa2fa3c25d6c7f6694b79ad391c Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Sat, 16 May 2020 22:35:15 +0300 Subject: Use logger instead of println in ValidatedSlot, improve ctor param names --- .../java/io/github/cottonmc/cotton/gui/ValidatedSlot.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java index 8a50a45..1e9ee3c 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java @@ -4,15 +4,18 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; import net.minecraft.screen.slot.Slot; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class ValidatedSlot extends Slot { + private static final Logger LOGGER = LogManager.getLogger(); private final int slotNumber; private boolean insertingAllowed = true; private boolean takingAllowed = true; - public ValidatedSlot(Inventory inventoryIn, int index, int xPosition, int yPosition) { - super(inventoryIn, index, xPosition, yPosition); - if (inventoryIn==null) throw new IllegalArgumentException("Can't make an itemslot from a null inventory!"); + public ValidatedSlot(Inventory inventory, int index, int x, int y) { + super(inventory, index, x, y); + if (inventory==null) throw new IllegalArgumentException("Can't make an itemslot from a null inventory!"); this.slotNumber = index; } @@ -29,13 +32,13 @@ public class ValidatedSlot extends Slot { @Override public ItemStack getStack() { if (inventory==null) { - System.out.println("Prevented null-inventory from WItemSlot with slot #: "+slotNumber); + LOGGER.warn("Prevented null-inventory from WItemSlot with slot #: {}", slotNumber); return ItemStack.EMPTY; } ItemStack result = super.getStack(); if (result==null) { - System.out.println("Prevented null-itemstack crash from: "+inventory.getClass().getCanonicalName()); + LOGGER.warn("Prevented null-itemstack crash from: {}", inventory.getClass().getCanonicalName()); return ItemStack.EMPTY; } -- cgit