From 689b97d948070efca9a93222a7bc1730d5d8e1c0 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 14 Aug 2015 00:54:27 -0700 Subject: [PATCH] Merge GuiUtil into Utils --- .../apiculture/BeeHousingInventory.java | 4 ++-- .../apiculture/gadgets/TileApiary.java | 4 ++-- .../forestry/core/gadgets/TileAnalyzer.java | 6 +++--- .../forestry/core/gadgets/TileEscritoire.java | 6 +++--- .../java/forestry/core/utils/GuiUtil.java | 19 ------------------- .../java/forestry/core/utils/SlotHelper.java | 2 +- src/main/java/forestry/core/utils/Utils.java | 6 +++++- .../forestry/energy/gadgets/EngineCopper.java | 4 ++-- .../factory/gadgets/MachineCarpenter.java | 3 +-- .../factory/gadgets/MachineCentrifuge.java | 4 ++-- .../factory/gadgets/MachineFabricator.java | 6 +++--- .../factory/gadgets/MachineMoistener.java | 5 ++--- .../factory/gadgets/TileWorktable.java | 4 ++-- .../farming/multiblock/FarmInventory.java | 12 ++++++------ src/main/java/forestry/mail/TradeStation.java | 10 +++++----- .../forestry/mail/gui/ContainerMailbox.java | 4 ++-- .../java/forestry/mail/items/ItemLetter.java | 6 +++--- 17 files changed, 44 insertions(+), 61 deletions(-) delete mode 100644 src/main/java/forestry/core/utils/GuiUtil.java diff --git a/src/main/java/forestry/apiculture/BeeHousingInventory.java b/src/main/java/forestry/apiculture/BeeHousingInventory.java index 18f2b8754..fd671977b 100644 --- a/src/main/java/forestry/apiculture/BeeHousingInventory.java +++ b/src/main/java/forestry/apiculture/BeeHousingInventory.java @@ -18,7 +18,7 @@ import forestry.api.apiculture.IBeeHousingInventory; import forestry.core.interfaces.IAccessHandler; import forestry.core.inventory.InvTools; import forestry.core.inventory.InventoryAdapterRestricted; -import forestry.core.utils.GuiUtil; +import forestry.core.utils.Utils; public class BeeHousingInventory extends InventoryAdapterRestricted implements IBeeHousingInventory { public static final int SLOT_QUEEN = 0; @@ -47,7 +47,7 @@ public class BeeHousingInventory extends InventoryAdapterRestricted implements I if (!super.canExtractItem(slotIndex, itemstack, side)) { return false; } - return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT); } @Override diff --git a/src/main/java/forestry/apiculture/gadgets/TileApiary.java b/src/main/java/forestry/apiculture/gadgets/TileApiary.java index 4e8649911..3258dbfa7 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileApiary.java +++ b/src/main/java/forestry/apiculture/gadgets/TileApiary.java @@ -40,7 +40,7 @@ import forestry.api.core.ForestryAPI; import forestry.apiculture.trigger.ApicultureTriggers; import forestry.core.inventory.wrappers.InventoryMapper; import forestry.core.network.GuiId; -import forestry.core.utils.GuiUtil; +import forestry.core.utils.Utils; import buildcraft.api.statements.ITriggerExternal; @@ -138,7 +138,7 @@ public class TileApiary extends TileBeeHousing { @Override public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { - if (GuiUtil.isIndexInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) { return itemStack.getItem() instanceof IHiveFrame; } diff --git a/src/main/java/forestry/core/gadgets/TileAnalyzer.java b/src/main/java/forestry/core/gadgets/TileAnalyzer.java index f0a2fd382..d9c8cb70f 100755 --- a/src/main/java/forestry/core/gadgets/TileAnalyzer.java +++ b/src/main/java/forestry/core/gadgets/TileAnalyzer.java @@ -50,7 +50,7 @@ import forestry.core.network.GuiId; import forestry.core.network.PacketItemStackDisplay; import forestry.core.proxy.Proxies; import forestry.core.utils.GeneticsUtil; -import forestry.core.utils.GuiUtil; +import forestry.core.utils.Utils; public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer, IItemStackDisplay { @@ -312,7 +312,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui @Override public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { - if (GuiUtil.isIndexInRange(slotIndex, SLOT_INPUT_1, SLOT_INPUT_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_INPUT_1, SLOT_INPUT_COUNT)) { return AlleleManager.alleleRegistry.isIndividual(itemStack) || GeneticsUtil.getGeneticEquivalent(itemStack) != null; } else if (slotIndex == SLOT_CAN) { Fluid fluid = FluidHelper.getFluidInContainer(itemStack); @@ -324,7 +324,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui @Override public boolean canExtractItem(int slotIndex, ItemStack stack, int side) { - return GuiUtil.isIndexInRange(slotIndex, SLOT_OUTPUT_1, SLOT_OUTPUT_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_OUTPUT_1, SLOT_OUTPUT_COUNT); } } } diff --git a/src/main/java/forestry/core/gadgets/TileEscritoire.java b/src/main/java/forestry/core/gadgets/TileEscritoire.java index 3e9ccf1f5..fab063813 100755 --- a/src/main/java/forestry/core/gadgets/TileEscritoire.java +++ b/src/main/java/forestry/core/gadgets/TileEscritoire.java @@ -33,7 +33,7 @@ import forestry.core.network.PacketTileStream; import forestry.core.proxy.Proxies; import forestry.core.utils.EnumTankLevel; import forestry.core.utils.GeneticsUtil; -import forestry.core.utils.GuiUtil; +import forestry.core.utils.Utils; public class TileEscritoire extends TileBase implements ISidedInventory, IRenderableMachine, ICrafter { @@ -188,7 +188,7 @@ public class TileEscritoire extends TileBase implements ISidedInventory, IRender return true; } - if (GuiUtil.isIndexInRange(slotIndex, SLOT_INPUT_1, SLOTS_INPUT_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_INPUT_1, SLOTS_INPUT_COUNT)) { if (slotIndex >= SLOT_INPUT_1 + tile.game.getSampleSize()) { return true; } @@ -199,7 +199,7 @@ public class TileEscritoire extends TileBase implements ISidedInventory, IRender @Override public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) { - return GuiUtil.isIndexInRange(slotIndex, SLOT_RESULTS_1, SLOTS_RESULTS_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_RESULTS_1, SLOTS_RESULTS_COUNT); } @Override diff --git a/src/main/java/forestry/core/utils/GuiUtil.java b/src/main/java/forestry/core/utils/GuiUtil.java deleted file mode 100644 index e5234b8a1..000000000 --- a/src/main/java/forestry/core/utils/GuiUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.utils; - -public class GuiUtil { - - public static boolean isIndexInRange(int index, int start, int count) { - return (index >= start) && (index < start + count); - } - -} diff --git a/src/main/java/forestry/core/utils/SlotHelper.java b/src/main/java/forestry/core/utils/SlotHelper.java index 5b63952eb..e84b345fc 100644 --- a/src/main/java/forestry/core/utils/SlotHelper.java +++ b/src/main/java/forestry/core/utils/SlotHelper.java @@ -192,7 +192,7 @@ public class SlotHelper { } private static boolean isInPlayerHotbar(int slotIndex) { - return GuiUtil.isIndexInRange(slotIndex, playerInventorySize - playerHotbarSize, playerInventorySize); + return Utils.isIndexInRange(slotIndex, playerInventorySize - playerHotbarSize, playerInventorySize); } private static boolean shiftToPlayerInventoryNoHotbar(List inventorySlots, ItemStack stackInSlot) { diff --git a/src/main/java/forestry/core/utils/Utils.java b/src/main/java/forestry/core/utils/Utils.java index e6c70aa94..bda1a526f 100755 --- a/src/main/java/forestry/core/utils/Utils.java +++ b/src/main/java/forestry/core/utils/Utils.java @@ -36,7 +36,7 @@ import forestry.core.proxy.Proxies; import buildcraft.api.tools.IToolWrench; -public class Utils { +public abstract class Utils { private static final int slabWoodId = OreDictionary.getOreID("slabWood"); private static final Random rand = new Random(); @@ -225,6 +225,10 @@ public class Utils { } } + public static boolean isIndexInRange(int index, int start, int count) { + return (index >= start) && (index < start + count); + } + public static int addRGBComponents(int colour, int r, int g, int b) { r = ((colour & 0xff0000) >> 16) + r; g = ((colour & 0xff00) >> 8) + g; diff --git a/src/main/java/forestry/energy/gadgets/EngineCopper.java b/src/main/java/forestry/energy/gadgets/EngineCopper.java index 9060aa529..23d1f4373 100755 --- a/src/main/java/forestry/energy/gadgets/EngineCopper.java +++ b/src/main/java/forestry/energy/gadgets/EngineCopper.java @@ -42,7 +42,7 @@ import forestry.core.inventory.InvTools; import forestry.core.inventory.TileInventoryAdapter; import forestry.core.inventory.wrappers.InventoryMapper; import forestry.core.network.GuiId; -import forestry.core.utils.GuiUtil; +import forestry.core.utils.Utils; import forestry.factory.triggers.FactoryTriggers; import buildcraft.api.statements.ITriggerExternal; @@ -366,7 +366,7 @@ public class EngineCopper extends Engine implements ISidedInventory { @Override public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) { - return GuiUtil.isIndexInRange(slotIndex, SLOT_WASTE_1, SLOT_WASTE_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_WASTE_1, SLOT_WASTE_COUNT); } } } diff --git a/src/main/java/forestry/factory/gadgets/MachineCarpenter.java b/src/main/java/forestry/factory/gadgets/MachineCarpenter.java index 2026e41d7..1478bb0d1 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCarpenter.java +++ b/src/main/java/forestry/factory/gadgets/MachineCarpenter.java @@ -58,7 +58,6 @@ import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.GuiId; import forestry.core.proxy.Proxies; import forestry.core.utils.EnumTankLevel; -import forestry.core.utils.GuiUtil; import forestry.core.utils.ShapedRecipeCustom; import forestry.core.utils.StackUtils; import forestry.core.utils.Utils; @@ -456,7 +455,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL return false; } - return GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT); } @Override diff --git a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java index 3486662a2..4941c1492 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java +++ b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java @@ -46,8 +46,8 @@ import forestry.core.inventory.IInventoryAdapter; import forestry.core.inventory.InvTools; import forestry.core.inventory.TileInventoryAdapter; import forestry.core.network.GuiId; -import forestry.core.utils.GuiUtil; import forestry.core.utils.StackUtils; +import forestry.core.utils.Utils; import forestry.factory.triggers.FactoryTriggers; import buildcraft.api.statements.ITriggerExternal; @@ -273,7 +273,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory { @Override public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) { - return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT); } } diff --git a/src/main/java/forestry/factory/gadgets/MachineFabricator.java b/src/main/java/forestry/factory/gadgets/MachineFabricator.java index 4ae1a9eab..45b644525 100755 --- a/src/main/java/forestry/factory/gadgets/MachineFabricator.java +++ b/src/main/java/forestry/factory/gadgets/MachineFabricator.java @@ -49,9 +49,9 @@ import forestry.core.inventory.TileInventoryAdapter; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.GuiId; -import forestry.core.utils.GuiUtil; import forestry.core.utils.ShapedRecipeCustom; import forestry.core.utils.StackUtils; +import forestry.core.utils.Utils; import forestry.factory.recipes.FabricatorRecipe; public class MachineFabricator extends TilePowered implements ICrafter, ILiquidTankContainer, ISidedInventory { @@ -426,14 +426,14 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT return RecipeManager.findMatchingSmelting(itemStack) != null; } else if (slotIndex == SLOT_PLAN) { return RecipeManager.isPlan(itemStack); - } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT)) { if (RecipeManager.isPlan(itemStack)) { return false; } else if (RecipeManager.findMatchingSmelting(itemStack) != null) { return false; } } - return GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT); } @Override diff --git a/src/main/java/forestry/factory/gadgets/MachineMoistener.java b/src/main/java/forestry/factory/gadgets/MachineMoistener.java index ad5a4c4c6..39f2cfb54 100755 --- a/src/main/java/forestry/factory/gadgets/MachineMoistener.java +++ b/src/main/java/forestry/factory/gadgets/MachineMoistener.java @@ -49,7 +49,6 @@ import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.GuiId; import forestry.core.utils.EnumTankLevel; -import forestry.core.utils.GuiUtil; import forestry.core.utils.StackUtils; import forestry.core.utils.Utils; @@ -635,7 +634,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu return RecipeManager.isResource(itemStack); } - if (GuiUtil.isIndexInRange(slotIndex, SLOT_STASH_1, SLOT_STASH_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_STASH_1, SLOT_STASH_COUNT)) { return FuelManager.moistenerResource.containsKey(itemStack); } @@ -653,7 +652,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu return true; } - if (GuiUtil.isIndexInRange(slotIndex, SLOT_STASH_1, (SLOT_STASH_COUNT + SLOT_RESERVOIR_COUNT))) { + if (Utils.isIndexInRange(slotIndex, SLOT_STASH_1, (SLOT_STASH_COUNT + SLOT_RESERVOIR_COUNT))) { return !FuelManager.moistenerResource.containsKey(itemstack); } diff --git a/src/main/java/forestry/factory/gadgets/TileWorktable.java b/src/main/java/forestry/factory/gadgets/TileWorktable.java index 107de6c63..aee5c056b 100755 --- a/src/main/java/forestry/factory/gadgets/TileWorktable.java +++ b/src/main/java/forestry/factory/gadgets/TileWorktable.java @@ -32,8 +32,8 @@ import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.GuiId; import forestry.core.proxy.Proxies; -import forestry.core.utils.GuiUtil; import forestry.core.utils.RecipeUtil; +import forestry.core.utils.Utils; import forestry.factory.recipes.RecipeMemory; public class TileWorktable extends TileBase implements ICrafterWorktable { @@ -242,7 +242,7 @@ public class TileWorktable extends TileBase implements ICrafterWorktable { @Override public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { - return GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT); } } } diff --git a/src/main/java/forestry/farming/multiblock/FarmInventory.java b/src/main/java/forestry/farming/multiblock/FarmInventory.java index 03f2d46fc..2c2b7c95d 100644 --- a/src/main/java/forestry/farming/multiblock/FarmInventory.java +++ b/src/main/java/forestry/farming/multiblock/FarmInventory.java @@ -28,8 +28,8 @@ import forestry.core.inventory.InvTools; import forestry.core.inventory.InventoryAdapterRestricted; import forestry.core.inventory.wrappers.InventoryMapper; import forestry.core.proxy.Proxies; -import forestry.core.utils.GuiUtil; import forestry.core.utils.StackUtils; +import forestry.core.utils.Utils; import forestry.plugins.PluginFarming; public class FarmInventory extends InventoryAdapterRestricted implements IFarmInventory { @@ -66,13 +66,13 @@ public class FarmInventory extends InventoryAdapterRestricted implements IFarmIn @Override public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { - if (GuiUtil.isIndexInRange(slotIndex, SLOT_FERTILIZER, SLOT_FERTILIZER_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_FERTILIZER, SLOT_FERTILIZER_COUNT)) { return acceptsAsFertilizer(itemStack); - } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_GERMLINGS_1, SLOT_GERMLINGS_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, SLOT_GERMLINGS_1, SLOT_GERMLINGS_COUNT)) { return acceptsAsGermling(itemStack); - } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_RESOURCES_1, SLOT_RESOURCES_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, SLOT_RESOURCES_1, SLOT_RESOURCES_COUNT)) { return acceptsAsResource(itemStack); - } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_CAN, SLOT_CAN_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, SLOT_CAN, SLOT_CAN_COUNT)) { Fluid fluid = FluidHelper.getFluidInContainer(itemStack); return farmController.getTankManager().accepts(fluid); } @@ -81,7 +81,7 @@ public class FarmInventory extends InventoryAdapterRestricted implements IFarmIn @Override public boolean canExtractItem(int slotIndex, ItemStack stack, int side) { - return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCTION_1, SLOT_PRODUCTION_COUNT); + return Utils.isIndexInRange(slotIndex, SLOT_PRODUCTION_1, SLOT_PRODUCTION_COUNT); } @Override diff --git a/src/main/java/forestry/mail/TradeStation.java b/src/main/java/forestry/mail/TradeStation.java index 479c763fd..ec3330b37 100755 --- a/src/main/java/forestry/mail/TradeStation.java +++ b/src/main/java/forestry/mail/TradeStation.java @@ -35,8 +35,8 @@ import forestry.core.config.ForestryItem; import forestry.core.inventory.IInventoryAdapter; import forestry.core.inventory.InvTools; import forestry.core.inventory.InventoryAdapter; -import forestry.core.utils.GuiUtil; import forestry.core.utils.StackUtils; +import forestry.core.utils.Utils; import forestry.mail.items.ItemLetter; public class TradeStation extends WorldSavedData implements ITradeStation, IInventoryAdapter { @@ -72,12 +72,12 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve @Override public boolean canExtractItem(int slot, ItemStack itemStack, int side) { - return GuiUtil.isIndexInRange(slot, SLOT_RECEIVE_BUFFER, SLOT_RECEIVE_BUFFER_COUNT); + return Utils.isIndexInRange(slot, SLOT_RECEIVE_BUFFER, SLOT_RECEIVE_BUFFER_COUNT); } @Override public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { - if (GuiUtil.isIndexInRange(slotIndex, SLOT_SEND_BUFFER, SLOT_SEND_BUFFER_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_SEND_BUFFER, SLOT_SEND_BUFFER_COUNT)) { for (int i = 0; i < SLOT_TRADEGOOD_COUNT; i++) { ItemStack tradeGood = getStackInSlot(SLOT_TRADEGOOD + i); if (StackUtils.isIdenticalItem(tradeGood, itemStack)) { @@ -85,10 +85,10 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve } } return false; - } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_LETTERS_1, SLOT_LETTERS_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, SLOT_LETTERS_1, SLOT_LETTERS_COUNT)) { Item item = itemStack.getItem(); return item == Items.paper; - } else if (GuiUtil.isIndexInRange(slotIndex, SLOT_STAMPS_1, SLOT_STAMPS_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, SLOT_STAMPS_1, SLOT_STAMPS_COUNT)) { Item item = itemStack.getItem(); return item instanceof IStamps; } diff --git a/src/main/java/forestry/mail/gui/ContainerMailbox.java b/src/main/java/forestry/mail/gui/ContainerMailbox.java index 1d1c6ed65..34ae86ee0 100755 --- a/src/main/java/forestry/mail/gui/ContainerMailbox.java +++ b/src/main/java/forestry/mail/gui/ContainerMailbox.java @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack; import forestry.core.gui.ContainerTile; import forestry.core.gui.slots.SlotOutput; import forestry.core.proxy.Proxies; -import forestry.core.utils.GuiUtil; +import forestry.core.utils.Utils; import forestry.mail.POBox; import forestry.mail.POBoxInfo; import forestry.mail.gadgets.MachineMailbox; @@ -52,7 +52,7 @@ public class ContainerMailbox extends ContainerTile { public ItemStack slotClick(int slotIndex, int button, int par3, EntityPlayer player) { ItemStack stack = super.slotClick(slotIndex, button, par3, player); - if (GuiUtil.isIndexInRange(slotIndex, SLOT_LETTERS, SLOT_LETTERS_COUNT)) { + if (Utils.isIndexInRange(slotIndex, SLOT_LETTERS, SLOT_LETTERS_COUNT)) { if (Proxies.common.isSimulating(player.worldObj) && mailInventory != null) { POBoxInfo info = mailInventory.getPOBoxInfo(); Proxies.net.sendToPlayer(new PacketPOBoxInfo(info), player); diff --git a/src/main/java/forestry/mail/items/ItemLetter.java b/src/main/java/forestry/mail/items/ItemLetter.java index 3275db199..21361ebc7 100755 --- a/src/main/java/forestry/mail/items/ItemLetter.java +++ b/src/main/java/forestry/mail/items/ItemLetter.java @@ -39,8 +39,8 @@ import forestry.core.items.ItemInventoried; import forestry.core.network.GuiId; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; -import forestry.core.utils.GuiUtil; import forestry.core.utils.StringUtil; +import forestry.core.utils.Utils; import forestry.mail.Letter; public class ItemLetter extends ItemInventoried { @@ -266,10 +266,10 @@ public class ItemLetter extends ItemInventoried { public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { if (letter.isProcessed()) { return false; - } else if (GuiUtil.isIndexInRange(slotIndex, Letter.SLOT_POSTAGE_1, Letter.SLOT_POSTAGE_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, Letter.SLOT_POSTAGE_1, Letter.SLOT_POSTAGE_COUNT)) { Item item = itemStack.getItem(); return item instanceof ItemStamps; - } else if (GuiUtil.isIndexInRange(slotIndex, Letter.SLOT_ATTACHMENT_1, Letter.SLOT_ATTACHMENT_COUNT)) { + } else if (Utils.isIndexInRange(slotIndex, Letter.SLOT_ATTACHMENT_1, Letter.SLOT_ATTACHMENT_COUNT)) { return !ForestryItem.letters.isItemEqual(itemStack); } return false;