Implement using quantifier key on Drawer Controllers

This commit is contained in:
cargocats committed 2025-05-24 14:44:09 -04:00
1 parent 6fa0391b28
commit a9cbf8806e
5 files changed
+25 -8

No files matched your search

@@ -307,8 +307,13 @@ public class TileEntityController extends TileEntity
if (!SecurityManager.hasAccess(profile, (IProtectable) record.storage)) continue;
}
if (record.storage instanceof IQuantifiable) {
IQuantifiable quantifiableStorage = (IQuantifiable) storage;
for (int i = 0, n = record.storage.getDrawerCount(); i < n; i++) {
if (!record.storage.isDrawerEnabled(i)) continue;
IDrawer drawer = record.storage.getDrawer(i);
if (!(drawer instanceof IQuantifiable)) continue;
IQuantifiable quantifiableStorage = (IQuantifiable) drawer;
if (template == null) {
template = quantifiableStorage;
state = !template.isQuantified();
@@ -650,8 +650,14 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
}
@Override
public boolean isQuantified() {
return TileEntityDrawersComp.this.isQuantified();
public boolean isQuantifiedSlot(int slot) {
return isQuantified();
}
@Override
public boolean setIsSlotQuantifiable(int slot, boolean state) {
setIsQuantified(state);
return true;
}
@Override
@@ -142,11 +142,13 @@ public class CompDrawerData extends BaseDrawerData
@Override
public boolean isQuantified() {
return central.isQuantified();
return central.isQuantifiedSlot(slot);
}
@Override
public void setIsQuantified(boolean state) {};
public boolean setIsQuantified(boolean state) {
return central.setIsSlotQuantifiable(slot, state);
};
@Override
public boolean isLocked(LockAttribute attr) {
@@ -210,7 +210,9 @@ public class DrawerData extends BaseDrawerData implements IVoidable, IShroudable
}
@Override
public void setIsQuantified(boolean state) {}
public boolean setIsQuantified(boolean state) {
return storageProvider.setIsQuantified(slot, state);
}
@Override
public boolean isLocked(LockAttribute attr) {
@@ -38,7 +38,9 @@ public interface ICentralInventory {
public boolean setIsSlotShrouded(int slot, boolean state);
public boolean isQuantified();
public boolean isQuantifiedSlot(int slot);
public boolean setIsSlotQuantifiable(int slot, boolean state);
public boolean isLocked(int slot, LockAttribute attr);