mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-20 20:22:22 +00:00
Fix AE and void upgrades through controllers too.
This commit is contained in:
1 parent
0a36d486fb
commit
df65da0c53
7 files changed
+36
-15
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ buildscript {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.7.10-1.4.1"
|
||||
version = "1.7.10-1.4.2"
|
||||
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "StorageDrawers"
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
|
||||
|
||||
public interface IVoidable
|
||||
{
|
||||
/**
|
||||
* Gets whether or not the drawer has a voiding attribute.
|
||||
*/
|
||||
boolean isVoid ();
|
||||
}
|
||||
@@ -485,6 +485,11 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
return getMaxCapacity(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVoidSlot (int slot) {
|
||||
return isVoid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (int slot, NBTTagCompound tag) {
|
||||
ItemStack protoStack = getStoredItemPrototype(slot);
|
||||
|
||||
@@ -9,6 +9,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import com.jaquadro.minecraft.storagedrawers.storage.IUpgradeProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -32,6 +33,8 @@ public class DrawerMEInventory implements IMEInventory<IAEItemStack>
|
||||
if (itemProto != null) {
|
||||
if (drawer.canItemBeStored(input.getItemStack())) {
|
||||
itemsLeft = injectItemsIntoDrawer(drawer, itemsLeft, type);
|
||||
if (drawer instanceof IVoidable && ((IVoidable) drawer).isVoid())
|
||||
itemsLeft = 0;
|
||||
if (itemsLeft == 0)
|
||||
return null;
|
||||
}
|
||||
@@ -49,6 +52,8 @@ public class DrawerMEInventory implements IMEInventory<IAEItemStack>
|
||||
if (drawer.canItemBeStored(itemProto)) {
|
||||
drawer.setStoredItem(itemProto, 0);
|
||||
itemsLeft = injectItemsIntoDrawer(drawer, itemsLeft, type);
|
||||
if (drawer instanceof IVoidable && ((IVoidable) drawer).isVoid())
|
||||
itemsLeft = 0;
|
||||
if (itemsLeft == 0)
|
||||
return null;
|
||||
}
|
||||
@@ -56,9 +61,6 @@ public class DrawerMEInventory implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
if (itemsLeft > 0) {
|
||||
if (group instanceof IUpgradeProvider && ((IUpgradeProvider) group).isVoid())
|
||||
return null;
|
||||
|
||||
IAEItemStack overflow = AEApi.instance().storage().createItemStack(input.getItemStack());
|
||||
overflow.setStackSize(itemsLeft);
|
||||
return overflow;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CompDrawerData extends BaseDrawerData
|
||||
public class CompDrawerData extends BaseDrawerData implements IVoidable
|
||||
{
|
||||
private static final ItemStack nullStack = new ItemStack((Item)null);
|
||||
|
||||
@@ -97,4 +98,9 @@ public class CompDrawerData extends BaseDrawerData
|
||||
reset();
|
||||
refreshOreDictMatches();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVoid () {
|
||||
return central.isVoidSlot(slot);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,13 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.event.DrawerPopulatedEvent;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.inventory.IInventoryAdapter;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.inventory.SlotType;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.InventoryStack;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DrawerData extends BaseDrawerData
|
||||
public class DrawerData extends BaseDrawerData implements IVoidable
|
||||
{
|
||||
private static final ItemStack nullStack = new ItemStack((Item)null);
|
||||
|
||||
@@ -198,5 +190,10 @@ public class DrawerData extends BaseDrawerData
|
||||
DrawerPopulatedEvent event = new DrawerPopulatedEvent(this);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVoid () {
|
||||
return storageProvider.isVoid(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public interface ICentralInventory
|
||||
|
||||
public int getItemCapacityForInventoryStack (int slot);
|
||||
|
||||
public boolean isVoidSlot (int slot);
|
||||
|
||||
public void readFromNBT (int slot, NBTTagCompound tag);
|
||||
|
||||
public void writeToNBT (int slot, NBTTagCompound tag);
|
||||
|
||||
Reference in new issue
Block a user