mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-13 00:47:31 +00:00
Make AE2 respect updated lock semantics
This commit is contained in:
1 parent
f62d35c72d
commit
dad0a5bdc2
5 files changed
+49
-3
No files matched your search
@@ -431,7 +431,7 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
pooledCount = poolMax;
|
||||
|
||||
if (pooledCount != oldCount) {
|
||||
if (pooledCount != 0 || isLocked(LockAttribute.LOCK_POPULATED))
|
||||
if (pooledCount != 0 || TileEntityDrawersComp.this.isLocked(LockAttribute.LOCK_POPULATED))
|
||||
markAmountDirty();
|
||||
else {
|
||||
clear();
|
||||
@@ -502,6 +502,11 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocked (int slot, LockAttribute attr) {
|
||||
return TileEntityDrawersComp.this.isLocked(attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (int slot, NBTTagCompound tag) {
|
||||
ItemStack protoStack = getStoredItemPrototype(slot);
|
||||
|
||||
@@ -9,7 +9,9 @@ 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.ILockable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
|
||||
import com.jaquadro.minecraft.storagedrawers.storage.IUpgradeProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -45,8 +47,15 @@ public class DrawerMEInventory implements IMEInventory<IAEItemStack>
|
||||
if (!group.isDrawerEnabled(i))
|
||||
continue;
|
||||
|
||||
if (group instanceof ILockable && ((ILockable) group).isLocked(LockAttribute.LOCK_EMPTY))
|
||||
continue;
|
||||
|
||||
IDrawer drawer = group.getDrawer(i);
|
||||
ItemStack itemProto = drawer.getStoredItemPrototype();
|
||||
|
||||
if (itemProto == null && drawer instanceof ILockable && ((ILockable) drawer).isLocked(LockAttribute.LOCK_EMPTY))
|
||||
continue;
|
||||
|
||||
if (itemProto == null) {
|
||||
itemProto = input.getItemStack();
|
||||
if (drawer.canItemBeStored(itemProto)) {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.ILockable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IShroudable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CompDrawerData extends BaseDrawerData implements IVoidable, IShroudable
|
||||
public class CompDrawerData extends BaseDrawerData implements IVoidable, IShroudable, ILockable
|
||||
{
|
||||
private static final ItemStack nullStack = new ItemStack((Item)null);
|
||||
|
||||
@@ -114,4 +116,17 @@ public class CompDrawerData extends BaseDrawerData implements IVoidable, IShroud
|
||||
public boolean setIsShrouded (boolean state) {
|
||||
return central.setIsSlotShrouded(slot, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocked (LockAttribute attr) {
|
||||
return central.isLocked(slot, attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLock (LockAttribute attr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocked (LockAttribute attr, boolean isLocked) { }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.event.DrawerPopulatedEvent;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.ILockable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IShroudable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
|
||||
@@ -9,7 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class DrawerData extends BaseDrawerData implements IVoidable, IShroudable
|
||||
public class DrawerData extends BaseDrawerData implements IVoidable, IShroudable, ILockable
|
||||
{
|
||||
private static final ItemStack nullStack = new ItemStack((Item)null);
|
||||
|
||||
@@ -207,5 +208,18 @@ public class DrawerData extends BaseDrawerData implements IVoidable, IShroudable
|
||||
public boolean setIsShrouded (boolean state) {
|
||||
return storageProvider.setIsShrouded(slot, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocked (LockAttribute attr) {
|
||||
return storageProvider.isLocked(slot, attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLock (LockAttribute attr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocked (LockAttribute attr, boolean isLocked) { }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -29,6 +30,8 @@ public interface ICentralInventory
|
||||
|
||||
public boolean setIsSlotShrouded (int slot, boolean state);
|
||||
|
||||
public boolean isLocked (int slot, LockAttribute attr);
|
||||
|
||||
public void readFromNBT (int slot, NBTTagCompound tag);
|
||||
|
||||
public void writeToNBT (int slot, NBTTagCompound tag);
|
||||
|
||||
Reference in new issue
Block a user