diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java deleted file mode 100644 index 47396c799..000000000 --- a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.jaquadro.minecraft.storagedrawers.api.inventory; - -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; - -public interface IDrawerInventory extends ISidedInventory -{ - /** - * Gets a drawer's group slot index from an IInventory slot index. - * - * @param inventorySlot An IInventory slot index returned from getInventorySlot. - */ - int getDrawerSlot (int inventorySlot); - - /** - * Gets an IInventory slot index suitable for operations for the given type. - * - * @param drawerSlot The index of the drawer within its group. - * @param type The type of IInventory slot to return an index for. - */ - int getInventorySlot (int drawerSlot, SlotType type); - - /** - * Gets the type associated with a given IInventory slot index. - * - * @param inventorySlot An IInventory slot index returned from getInventorySlot. - */ - SlotType getInventorySlotType (int inventorySlot); - - boolean canInsertItem (int slot, ItemStack stack); - - boolean canExtractItem (int slot, ItemStack stack); - - boolean syncInventoryIfNeeded (); -} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java deleted file mode 100644 index dbb002ed8..000000000 --- a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.jaquadro.minecraft.storagedrawers.api.inventory; - -/** - * Classifies different IInventory slots according to how they should be used. - */ -public enum SlotType -{ - /** An inventory slot for input-only operations; stack sizes artificially held low. */ - INPUT, - - /** An inventory slot for output-only operations; stack sizes artificially held high. */ - OUTPUT; - - public static final SlotType[] values = values(); -} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java deleted file mode 100644 index 9afb8b20f..000000000 --- a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.jaquadro.minecraft.storagedrawers.api.storage; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public interface IDrawer -{ - /** - * Gets an ItemStack of size 1 representing the type, metadata, and tags of the stored items. - * The returned ItemStack should not be modified for any reason. Make a copy if you need to store or modify it. - */ - ItemStack getStoredItemPrototype (); - - /** - * Gets an ItemStack initialized to the number of items stored in this drawer. - * The returned ItemStack is guaranteed to be a new copy and can be used for any purpose. Does not affect drawer contents. - */ - ItemStack getStoredItemCopy (); - - /** - * Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced. - * - * @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store. - * @param amount The amount to initialize the stored item count to. - */ - void setStoredItem (ItemStack itemPrototype, int amount); - - /** - * Gets the number of items stored in this drawer. - */ - int getStoredItemCount (); - - /** - * Sets the number of items stored in this drawer. Triggers syncing of inventories and client data. - * Setting a drawer's count to 0 may also result in the item type being cleared, depending in implementation. - * - * @param amount The new amount of items stored in this drawer. - */ - void setStoredItemCount (int amount); - - /** - * Gets the maximum number of items that can be stored in this drawer. - * This value will vary depending on the max stack size of the stored item type. - */ - int getMaxCapacity (); - - /** - * Gets the maximum number of items that could be stored in this drawer if it held the given item. - * - * @param itemPrototype The item type to query. - */ - int getMaxCapacity (ItemStack itemPrototype); - - /** - * Gets the number of items that could still be added to this drawer before it is full. - */ - int getRemainingCapacity (); - - /** - * Gets the max stack size of the item type stored in this drawer. Convenience method. - */ - int getStoredItemStackSize (); - - /** - * Gets whether or not an item of the given type and data can be stored in this drawer. - * - * Stack size and available capacity are not considered. For drawers that are not empty, this - * method can allow ore-dictionary compatible items to be accepted into the drawer, as defined by what - * the drawer considers to be an equivalent item. - * For drawers that are empty, locking status is considered. - * - * @param itemPrototype An ItemStack representing the type, metadata, and tags of an item. - */ - boolean canItemBeStored (ItemStack itemPrototype); - - /** - * Gets whether or not an item of the given type and data can be extracted from this drawer. - * - * This is intended to allow outbound ore-dictionary conversions of compatible items, as defined by what - * the drawer considers to be an equivalent item. - * - * @param itemPrototype An ItemStack representing the type, metadata, and tags of an item. - */ - boolean canItemBeExtracted (ItemStack itemPrototype); - - /** - * Gets whether or not the drawer has items. - * A drawer set with an item type and 0 count is not considered empty. - */ - boolean isEmpty (); - - /** - * Gets auxiliary data that has been associated with this drawer. - * - * @param key The key used to identify the data. - * @return An opaque object that was previously stored. - */ - Object getExtendedData (String key); - - /** - * Stores auxiliary data with this drawer, mainly for use in integration. - * @param key The key to identify the data with. - * @param data The data to store. - */ - void setExtendedData (String key, Object data); - - void writeToNBT (NBTTagCompound tag); - - void readFromNBT (NBTTagCompound tag); -} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java deleted file mode 100644 index 1f1eefef9..000000000 --- a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.jaquadro.minecraft.storagedrawers.api.storage; - -import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory; - -public interface IDrawerGroup -{ - /** - * Gets the number of drawers contained within this group. - */ - int getDrawerCount (); - - /** - * Gets the drawer at the given slot within this group. - */ - IDrawer getDrawer (int slot); - - /** - * Gets whether the drawer in the given slot is usable. - */ - boolean isDrawerEnabled (int slot); - - IDrawerInventory getDrawerInventory (); - - boolean markDirtyIfNeeded (); -} diff --git a/src/main/java/vazkii/botania/common/Botania.java b/src/main/java/vazkii/botania/common/Botania.java index 597e15ce5..4d9194e65 100644 --- a/src/main/java/vazkii/botania/common/Botania.java +++ b/src/main/java/vazkii/botania/common/Botania.java @@ -103,7 +103,6 @@ public class Botania { public static boolean bloodMagicLoaded = false; public static boolean coloredLightsLoaded = false; public static boolean etFuturumLoaded = false; - public static boolean storageDrawersLoaded = false; @Instance(LibMisc.MOD_ID) public static Botania instance; @@ -122,7 +121,6 @@ public class Botania { bloodMagicLoaded = Loader.isModLoaded("bloodmagic"); // Psh, noob coloredLightsLoaded = Loader.isModLoaded("easycoloredlights"); etFuturumLoaded = Loader.isModLoaded("etfuturum"); - storageDrawersLoaded = Loader.isModLoaded("storagedrawers"); BotaniaAPI.internalHandler = new InternalMethodHandler(); diff --git a/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java b/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java index 67eb9a069..aa47166dc 100644 --- a/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java @@ -33,7 +33,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.items.IItemHandlerModifiable; -import net.minecraftforge.items.wrapper.InvWrapper; import vazkii.botania.api.BotaniaAPIClient; import vazkii.botania.api.corporea.CorporeaHelper; import vazkii.botania.api.corporea.ICorporeaSpark; @@ -56,13 +55,11 @@ import vazkii.botania.client.core.handler.BossBarHandler; import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.common.Botania; import vazkii.botania.common.block.BlockModFlower; -import vazkii.botania.common.block.BlockSpecialFlower; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.block.decor.BlockFloatingFlower; import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia; import vazkii.botania.common.integration.corporea.WrappedDeepStorage; import vazkii.botania.common.integration.corporea.WrappedIInventory; -import vazkii.botania.common.integration.corporea.WrappedStorageDrawers; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; import vazkii.botania.common.item.relic.ItemLokiRing; @@ -274,10 +271,6 @@ public class InternalMethodHandler extends DummyMethodHandler { for(InvWithLocation inv : inventories) { ICorporeaSpark spark = CorporeaHelper.getSparkForInventory(inv); IWrappedInventory wrapped = null; - // try StorageDrawers integration - if(Botania.storageDrawersLoaded) { - wrapped = WrappedStorageDrawers.wrap(inv, spark); - } // try DeepStorageUnit if(wrapped == null) { wrapped = WrappedDeepStorage.wrap(inv, spark); diff --git a/src/main/java/vazkii/botania/common/integration/corporea/WrappedStorageDrawers.java b/src/main/java/vazkii/botania/common/integration/corporea/WrappedStorageDrawers.java deleted file mode 100644 index 81f53f2ed..000000000 --- a/src/main/java/vazkii/botania/common/integration/corporea/WrappedStorageDrawers.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - */ -package vazkii.botania.common.integration.corporea; - -import java.util.ArrayList; -import java.util.List; - -import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; -import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraftforge.items.wrapper.InvWrapper; -import vazkii.botania.api.corporea.CorporeaRequest; -import vazkii.botania.api.corporea.ICorporeaSpark; -import vazkii.botania.api.corporea.IWrappedInventory; -import vazkii.botania.api.corporea.InvWithLocation; - -/** - * Wrapper for StorageDrawers compatibility. - * - */ -public class WrappedStorageDrawers extends WrappedInventoryBase { - - private final IDrawerGroup invRaw; - - private WrappedStorageDrawers(IDrawerGroup inv, ICorporeaSpark spark) { - invRaw = inv; - this.spark = spark; - } - - @Override - public InvWithLocation getWrappedObject() { - return new InvWithLocation(new InvWrapper((IInventory) invRaw), spark.getSparkInventory().world, spark.getSparkInventory().pos); - } - - @Override - public List countItems(CorporeaRequest request) { - return iterateOverStacks(request, false); - } - - @Override - public List extractItems(CorporeaRequest request) { - return iterateOverStacks(request, true); - } - - private List iterateOverStacks(CorporeaRequest request, boolean doit) { - List stacks = new ArrayList(); - boolean removedAny = false; - - for(int i = 0; i < invRaw.getDrawerCount(); i++) { - IDrawer drawer = invRaw.getDrawer(i); - if(drawer == null) { - continue; - } - ItemStack prototype = drawer.getStoredItemPrototype(); - int storedCount = drawer.getStoredItemCount(); - - // WARNING: this code is very similar in all implementations of - // IWrappedInventory - keep it synch - // also this code is near duplicate to WrappedDeepStorage - keep it - // synchronized - if(isMatchingItemStack(request.matcher, request.checkNBT, prototype)) { - int rem = Math.min(storedCount, request.count == -1 ? storedCount : request.count); - - if(rem > 0) { - ItemStack copy = prototype.copy(); - copy.setCount(rem); - if(doit) { - stacks.addAll(breakDownBigStack(copy)); - } else { - stacks.add(copy); - } - } - - request.foundItems += storedCount; - request.extractedItems += rem; - - if(doit && rem > 0) { - decreaseStoredCount(drawer, rem); - - removedAny = true; - if(spark != null) - spark.onItemExtracted(prototype); - } - if(request.count != -1) - request.count -= rem; - } - } - if(removedAny) { - invRaw.markDirtyIfNeeded(); - } - return stacks; - } - - private void decreaseStoredCount(IDrawer drawer, int rem) { - drawer.setStoredItemCount(drawer.getStoredItemCount() - rem); - } - - /** - * Creates {@link WrappedStorageDrawers} if specified inv can be wrapped. - * - * @return wrapped inventory or null if it has incompatible type. - */ - public static IWrappedInventory wrap(InvWithLocation inv, ICorporeaSpark spark) { - if(inv.world.getTileEntity(inv.pos) instanceof IDrawerGroup) { - return new WrappedStorageDrawers((IDrawerGroup) inv.world.getTileEntity(inv.pos), spark); - } else return null; - } -}