@@ -81,7 +81,11 @@ public enum Settings
|
|||||||
|
|
||||||
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
|
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) ),
|
||||||
|
|
||||||
|
STICKY_MODE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
private final EnumSet<? extends Enum<?>> values;
|
private final EnumSet<? extends Enum<?>> values;
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public enum Upgrades {
|
|||||||
REDSTONE(0),
|
REDSTONE(0),
|
||||||
CRAFTING(0),
|
CRAFTING(0),
|
||||||
MAGNET(0),
|
MAGNET(0),
|
||||||
|
STICKY(0),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diamond Tier Upgrades.
|
* Diamond Tier Upgrades.
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ public interface IMaterials {
|
|||||||
|
|
||||||
IItemDefinition cardCrafting();
|
IItemDefinition cardCrafting();
|
||||||
|
|
||||||
|
IItemDefinition cardSticky();
|
||||||
|
|
||||||
IItemDefinition enderDust();
|
IItemDefinition enderDust();
|
||||||
|
|
||||||
IItemDefinition flour();
|
IItemDefinition flour();
|
||||||
|
|||||||
@@ -89,4 +89,12 @@ public interface IMEInventoryHandler<T extends IAEStack<T>> extends IMEInventory
|
|||||||
* @return true, if this inventory is valid for this pass.
|
* @return true, if this inventory is valid for this pass.
|
||||||
*/
|
*/
|
||||||
boolean validForPass( int i );
|
boolean validForPass( int i );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether an inventory is "Sticky" i.e. only it and other sticky storages that have partitions with certain
|
||||||
|
* items are allowed to be put into sticky storages.
|
||||||
|
*/
|
||||||
|
default boolean isSticky() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ public class ContainerStorageBus extends ContainerUpgradeable {
|
|||||||
@GuiSync(4)
|
@GuiSync(4)
|
||||||
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
||||||
|
|
||||||
|
@GuiSync(7)
|
||||||
|
public YesNo stickyMode = YesNo.NO;
|
||||||
|
|
||||||
public ContainerStorageBus(final InventoryPlayer ip, final PartStorageBus te) {
|
public ContainerStorageBus(final InventoryPlayer ip, final PartStorageBus te) {
|
||||||
super(ip, te);
|
super(ip, te);
|
||||||
this.storageBus = te;
|
this.storageBus = te;
|
||||||
@@ -111,6 +114,7 @@ public class ContainerStorageBus extends ContainerUpgradeable {
|
|||||||
this.setFuzzyMode((FuzzyMode) this.getUpgradeable().getConfigManager().getSetting(Settings.FUZZY_MODE));
|
this.setFuzzyMode((FuzzyMode) this.getUpgradeable().getConfigManager().getSetting(Settings.FUZZY_MODE));
|
||||||
this.setReadWriteMode((AccessRestriction) this.getUpgradeable().getConfigManager().getSetting(Settings.ACCESS));
|
this.setReadWriteMode((AccessRestriction) this.getUpgradeable().getConfigManager().getSetting(Settings.ACCESS));
|
||||||
this.setStorageFilter((StorageFilter) this.getUpgradeable().getConfigManager().getSetting(Settings.STORAGE_FILTER));
|
this.setStorageFilter((StorageFilter) this.getUpgradeable().getConfigManager().getSetting(Settings.STORAGE_FILTER));
|
||||||
|
this.setStickyMode((YesNo) this.getUpgradeable().getConfigManager().getSetting(Settings.STICKY_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.standardDetectAndSendChanges();
|
this.standardDetectAndSendChanges();
|
||||||
@@ -168,4 +172,12 @@ public class ContainerStorageBus extends ContainerUpgradeable {
|
|||||||
private void setStorageFilter(final StorageFilter storageFilter) {
|
private void setStorageFilter(final StorageFilter storageFilter) {
|
||||||
this.storageFilter = storageFilter;
|
this.storageFilter = storageFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YesNo getStickyMode() {
|
||||||
|
return this.stickyMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setStickyMode(final YesNo stickyMode) {
|
||||||
|
this.stickyMode = stickyMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,15 +364,19 @@ final class Registration {
|
|||||||
// Storage Cells
|
// Storage Cells
|
||||||
Upgrades.FUZZY.registerItem(items.cell1k(), 1);
|
Upgrades.FUZZY.registerItem(items.cell1k(), 1);
|
||||||
Upgrades.INVERTER.registerItem(items.cell1k(), 1);
|
Upgrades.INVERTER.registerItem(items.cell1k(), 1);
|
||||||
|
Upgrades.STICKY.registerItem(items.cell1k(), 1);
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem(items.cell4k(), 1);
|
Upgrades.FUZZY.registerItem(items.cell4k(), 1);
|
||||||
Upgrades.INVERTER.registerItem(items.cell4k(), 1);
|
Upgrades.INVERTER.registerItem(items.cell4k(), 1);
|
||||||
|
Upgrades.STICKY.registerItem(items.cell4k(), 1);
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem(items.cell16k(), 1);
|
Upgrades.FUZZY.registerItem(items.cell16k(), 1);
|
||||||
Upgrades.INVERTER.registerItem(items.cell16k(), 1);
|
Upgrades.INVERTER.registerItem(items.cell16k(), 1);
|
||||||
|
Upgrades.STICKY.registerItem(items.cell16k(), 1);
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem(items.cell64k(), 1);
|
Upgrades.FUZZY.registerItem(items.cell64k(), 1);
|
||||||
Upgrades.INVERTER.registerItem(items.cell64k(), 1);
|
Upgrades.INVERTER.registerItem(items.cell64k(), 1);
|
||||||
|
Upgrades.STICKY.registerItem(items.cell64k(), 1);
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem(items.portableCell(), 1);
|
Upgrades.FUZZY.registerItem(items.portableCell(), 1);
|
||||||
Upgrades.INVERTER.registerItem(items.portableCell(), 1);
|
Upgrades.INVERTER.registerItem(items.portableCell(), 1);
|
||||||
@@ -387,10 +391,12 @@ final class Registration {
|
|||||||
Upgrades.FUZZY.registerItem(parts.storageBus(), 1);
|
Upgrades.FUZZY.registerItem(parts.storageBus(), 1);
|
||||||
Upgrades.INVERTER.registerItem(parts.storageBus(), 1);
|
Upgrades.INVERTER.registerItem(parts.storageBus(), 1);
|
||||||
Upgrades.CAPACITY.registerItem(parts.storageBus(), 5);
|
Upgrades.CAPACITY.registerItem(parts.storageBus(), 5);
|
||||||
|
Upgrades.STICKY.registerItem(parts.storageBus(), 1);
|
||||||
|
|
||||||
// Storage Bus Fluids
|
// Storage Bus Fluids
|
||||||
Upgrades.INVERTER.registerItem(parts.fluidStorageBus(), 1);
|
Upgrades.INVERTER.registerItem(parts.fluidStorageBus(), 1);
|
||||||
Upgrades.CAPACITY.registerItem(parts.fluidStorageBus(), 5);
|
Upgrades.CAPACITY.registerItem(parts.fluidStorageBus(), 5);
|
||||||
|
Upgrades.STICKY.registerItem(parts.fluidStorageBus(), 1);
|
||||||
|
|
||||||
// Formation Plane
|
// Formation Plane
|
||||||
Upgrades.FUZZY.registerItem(parts.formationPlane(), 1);
|
Upgrades.FUZZY.registerItem(parts.formationPlane(), 1);
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ public class ApiClientHelper implements IClientHelper {
|
|||||||
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Precise.getLocal());
|
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Precise.getLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handler.isSticky()) {
|
||||||
|
lines.add(GuiText.Sticky.getLocal());
|
||||||
|
}
|
||||||
|
|
||||||
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||||
IItemHandler inv = cellInventory.getConfigInventory();
|
IItemHandler inv = cellInventory.getConfigInventory();
|
||||||
cellInventory.getAvailableItems((IItemList) itemList);
|
cellInventory.getAvailableItems((IItemList) itemList);
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public final class ApiMaterials implements IMaterials {
|
|||||||
private final IItemDefinition cardFuzzy;
|
private final IItemDefinition cardFuzzy;
|
||||||
private final IItemDefinition cardInverter;
|
private final IItemDefinition cardInverter;
|
||||||
private final IItemDefinition cardCrafting;
|
private final IItemDefinition cardCrafting;
|
||||||
|
private final IItemDefinition cardSticky;
|
||||||
|
|
||||||
private final IItemDefinition enderDust;
|
private final IItemDefinition enderDust;
|
||||||
private final IItemDefinition flour;
|
private final IItemDefinition flour;
|
||||||
@@ -208,6 +209,7 @@ public final class ApiMaterials implements IMaterials {
|
|||||||
this.cardFuzzy = new DamagedItemDefinition("material.card.fuzzy", materials.createMaterial(MaterialType.CARD_FUZZY));
|
this.cardFuzzy = new DamagedItemDefinition("material.card.fuzzy", materials.createMaterial(MaterialType.CARD_FUZZY));
|
||||||
this.cardInverter = new DamagedItemDefinition("material.card.inverter", materials.createMaterial(MaterialType.CARD_INVERTER));
|
this.cardInverter = new DamagedItemDefinition("material.card.inverter", materials.createMaterial(MaterialType.CARD_INVERTER));
|
||||||
this.cardCrafting = new DamagedItemDefinition("material.card.crafting", materials.createMaterial(MaterialType.CARD_CRAFTING));
|
this.cardCrafting = new DamagedItemDefinition("material.card.crafting", materials.createMaterial(MaterialType.CARD_CRAFTING));
|
||||||
|
this.cardSticky = new DamagedItemDefinition("material.card.sticky", materials.createMaterial(MaterialType.CARD_STICKY));
|
||||||
|
|
||||||
this.enderDust = new DamagedItemDefinition("material.dust.ender", materials.createMaterial(MaterialType.ENDER_DUST));
|
this.enderDust = new DamagedItemDefinition("material.dust.ender", materials.createMaterial(MaterialType.ENDER_DUST));
|
||||||
this.flour = new DamagedItemDefinition("material.flour", materials.createMaterial(MaterialType.FLOUR));
|
this.flour = new DamagedItemDefinition("material.flour", materials.createMaterial(MaterialType.FLOUR));
|
||||||
@@ -425,6 +427,11 @@ public final class ApiMaterials implements IMaterials {
|
|||||||
return this.cardCrafting;
|
return this.cardCrafting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemDefinition cardSticky() {
|
||||||
|
return this.cardSticky;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemDefinition enderDust() {
|
public IItemDefinition enderDust() {
|
||||||
return this.enderDust;
|
return this.enderDust;
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ public enum GuiText {
|
|||||||
Partitioned,
|
Partitioned,
|
||||||
Precise,
|
Precise,
|
||||||
Fuzzy,
|
Fuzzy,
|
||||||
|
Sticky,
|
||||||
|
|
||||||
// Used in a terminal to indicate that an item is craftable
|
// Used in a terminal to indicate that an item is craftable
|
||||||
SmallFontCraft,
|
SmallFontCraft,
|
||||||
|
|||||||
@@ -437,6 +437,10 @@ public class PartFluidStorageBus extends PartUpgradeable implements IGridTickabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getInstalledUpgrades(Upgrades.STICKY) > 0) {
|
||||||
|
this.handler.setSticky(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
||||||
this.handler.setPartitionList(new FuzzyPriorityList<IAEFluidStack>(priorityList, (FuzzyMode) this.getConfigManager().getSetting(Settings.FUZZY_MODE)));
|
this.handler.setPartitionList(new FuzzyPriorityList<IAEFluidStack>(priorityList, (FuzzyMode) this.getConfigManager().getSetting(Settings.FUZZY_MODE)));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
|||||||
return Upgrades.MAGNET;
|
return Upgrades.MAGNET;
|
||||||
case CARD_QUANTUM_LINK:
|
case CARD_QUANTUM_LINK:
|
||||||
return Upgrades.QUANTUM_LINK;
|
return Upgrades.QUANTUM_LINK;
|
||||||
|
case CARD_STICKY:
|
||||||
|
return Upgrades.STICKY;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,9 @@ public enum MaterialType {
|
|||||||
|
|
||||||
CARD_PATTERN_EXPANSION(58, "material_card_pattern_expansion", EnumSet.of(AEFeature.ADVANCED_CARDS)),
|
CARD_PATTERN_EXPANSION(58, "material_card_pattern_expansion", EnumSet.of(AEFeature.ADVANCED_CARDS)),
|
||||||
CARD_QUANTUM_LINK(59, "material_card_quantum_link", EnumSet.of(AEFeature.ADVANCED_CARDS, AEFeature.QUANTUM_LINKING_CARD)),
|
CARD_QUANTUM_LINK(59, "material_card_quantum_link", EnumSet.of(AEFeature.ADVANCED_CARDS, AEFeature.QUANTUM_LINKING_CARD)),
|
||||||
CARD_MAGNET(60, "material_card_magnet", EnumSet.of(AEFeature.BASIC_CARDS));
|
CARD_MAGNET(60, "material_card_magnet", EnumSet.of(AEFeature.BASIC_CARDS)),
|
||||||
|
CARD_STICKY(61, "material_card_sticky", EnumSet.of(AEFeature.BASIC_CARDS)),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
private final Set<AEFeature> features;
|
private final Set<AEFeature> features;
|
||||||
|
|||||||
@@ -160,4 +160,8 @@ public class MEMonitorHandler<T extends IAEStack<T>> implements IMEMonitor<T> {
|
|||||||
return this.getHandler().validForPass(i);
|
return this.getHandler().validForPass(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSticky() {
|
||||||
|
return this.internalHandler.isSticky();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class BasicCellInventoryHandler<T extends IAEStack<T>> extends MEInventor
|
|||||||
|
|
||||||
boolean hasInverter = false;
|
boolean hasInverter = false;
|
||||||
boolean hasFuzzy = false;
|
boolean hasFuzzy = false;
|
||||||
|
boolean hasSticky = false;
|
||||||
|
|
||||||
for (int x = 0; x < upgrades.getSlots(); x++) {
|
for (int x = 0; x < upgrades.getSlots(); x++) {
|
||||||
final ItemStack is = upgrades.getStackInSlot(x);
|
final ItemStack is = upgrades.getStackInSlot(x);
|
||||||
@@ -69,6 +70,9 @@ public class BasicCellInventoryHandler<T extends IAEStack<T>> extends MEInventor
|
|||||||
case INVERTER:
|
case INVERTER:
|
||||||
hasInverter = true;
|
hasInverter = true;
|
||||||
break;
|
break;
|
||||||
|
case STICKY:
|
||||||
|
hasSticky = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,6 +91,10 @@ public class BasicCellInventoryHandler<T extends IAEStack<T>> extends MEInventor
|
|||||||
|
|
||||||
this.setWhitelist(hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST);
|
this.setWhitelist(hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST);
|
||||||
|
|
||||||
|
if (hasSticky) {
|
||||||
|
setSticky(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!priorityList.isEmpty()) {
|
if (!priorityList.isEmpty()) {
|
||||||
if (hasFuzzy) {
|
if (hasFuzzy) {
|
||||||
this.setPartitionList(new FuzzyPriorityList<>(priorityList, fzMode));
|
this.setPartitionList(new FuzzyPriorityList<>(priorityList, fzMode));
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> {
|
|||||||
private final ICellHandler handler;
|
private final ICellHandler handler;
|
||||||
private final TileDrive drive;
|
private final TileDrive drive;
|
||||||
private final IActionSource source;
|
private final IActionSource source;
|
||||||
|
|
||||||
public DriveWatcher(final ICellInventoryHandler<T> i, final ItemStack is, final ICellHandler han, final TileDrive drive) {
|
public DriveWatcher(final ICellInventoryHandler<T> i, final ItemStack is, final ICellHandler han, final TileDrive drive) {
|
||||||
super(i, i.getChannel());
|
super(i, i.getChannel());
|
||||||
this.is = is;
|
this.is = is;
|
||||||
@@ -100,4 +99,13 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> {
|
|||||||
|
|
||||||
return extractable;
|
return extractable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSticky() {
|
||||||
|
if (this.getInternal() instanceof ICellInventoryHandler<?> cellInventoryHandler) {
|
||||||
|
return cellInventoryHandler.isSticky();
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.isSticky();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
private AccessRestriction cachedAccessRestriction;
|
private AccessRestriction cachedAccessRestriction;
|
||||||
private boolean hasReadAccess;
|
private boolean hasReadAccess;
|
||||||
private boolean hasWriteAccess;
|
private boolean hasWriteAccess;
|
||||||
|
private boolean isSticky;
|
||||||
|
|
||||||
public MEInventoryHandler(final IMEInventory<T> i, final IStorageChannel<T> channel) {
|
public MEInventoryHandler(final IMEInventory<T> i, final IStorageChannel<T> channel) {
|
||||||
if (i instanceof IMEInventoryHandler) {
|
if (i instanceof IMEInventoryHandler) {
|
||||||
@@ -166,4 +167,13 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
public IMEInventory<T> getInternal() {
|
public IMEInventory<T> getInternal() {
|
||||||
return this.internal;
|
return this.internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSticky() {
|
||||||
|
return isSticky;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSticky(boolean isSticky) {
|
||||||
|
this.isSticky = isSticky;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.me.cache.SecurityCache;
|
import appeng.me.cache.SecurityCache;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -45,19 +46,24 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
|||||||
private final IStorageChannel<T> myChannel;
|
private final IStorageChannel<T> myChannel;
|
||||||
private final SecurityCache security;
|
private final SecurityCache security;
|
||||||
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> priorityInventory;
|
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> priorityInventory;
|
||||||
|
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> stickyPriorityInventory;
|
||||||
private int myPass = 0;
|
private int myPass = 0;
|
||||||
|
|
||||||
public NetworkInventoryHandler(final IStorageChannel<T> chan, final SecurityCache security) {
|
public NetworkInventoryHandler(final IStorageChannel<T> chan, final SecurityCache security) {
|
||||||
this.myChannel = chan;
|
this.myChannel = chan;
|
||||||
this.security = security;
|
this.security = security;
|
||||||
this.priorityInventory = new TreeMap<>(PRIORITY_SORTER);
|
this.priorityInventory = new TreeMap<>(PRIORITY_SORTER);
|
||||||
|
this.stickyPriorityInventory = new TreeMap<>(PRIORITY_SORTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNewStorage(final IMEInventoryHandler<T> h) {
|
public void addNewStorage(final IMEInventoryHandler<T> h) {
|
||||||
final int priority = h.getPriority();
|
final int priority = h.getPriority();
|
||||||
List<IMEInventoryHandler<T>> list = this.priorityInventory.get(priority);
|
|
||||||
if (list == null) {
|
final List<IMEInventoryHandler<T>> list;
|
||||||
this.priorityInventory.put(priority, list = new ArrayList<>());
|
if (h.isSticky()) {
|
||||||
|
list = this.stickyPriorityInventory.computeIfAbsent(priority, $ -> new ArrayList<>());
|
||||||
|
} else {
|
||||||
|
list = this.priorityInventory.computeIfAbsent(priority, $ -> new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add(h);
|
list.add(h);
|
||||||
@@ -74,6 +80,25 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean stickyInventoryFound = false;
|
||||||
|
// For this pass we do return input if the item is able to go into a sticky inventory. We NEVER want to try and
|
||||||
|
// insert the item into a non-sticky inventory if it could already go into a sticky inventory.
|
||||||
|
for (final List<IMEInventoryHandler<T>> stickyInvList : this.stickyPriorityInventory.values()) {
|
||||||
|
Iterator<IMEInventoryHandler<T>> ii = stickyInvList.iterator();
|
||||||
|
while (ii.hasNext() && input != null) {
|
||||||
|
final IMEInventoryHandler<T> inv = ii.next();
|
||||||
|
if (inv.validForPass(1) && inv.canAccept(input) && (inv.isPrioritized(input) || inv.extractItems(input, Actionable.SIMULATE, src) != null)) {
|
||||||
|
input = inv.injectItems(input, type, src);
|
||||||
|
stickyInventoryFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stickyInventoryFound) {
|
||||||
|
this.surface(this, type);
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
for (final List<IMEInventoryHandler<T>> invList : this.priorityInventory.values()) {
|
for (final List<IMEInventoryHandler<T>> invList : this.priorityInventory.values()) {
|
||||||
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
|
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
|
||||||
while (ii.hasNext() && input != null) {
|
while (ii.hasNext() && input != null) {
|
||||||
@@ -186,6 +211,16 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (List<IMEInventoryHandler<T>> invList : this.stickyPriorityInventory.descendingMap().values()) {
|
||||||
|
final Iterator<IMEInventoryHandler<T>> jj = invList.iterator();
|
||||||
|
while (jj.hasNext() && output.getStackSize() < req) {
|
||||||
|
final IMEInventoryHandler<T> inv = jj.next();
|
||||||
|
|
||||||
|
request.setStackSize(req - output.getStackSize());
|
||||||
|
output.add(inv.extractItems(request, mode, src));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.surface(this, mode);
|
this.surface(this, mode);
|
||||||
|
|
||||||
if (output.getStackSize() <= 0) {
|
if (output.getStackSize() <= 0) {
|
||||||
@@ -201,15 +236,21 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (Entry<Integer, IMEInventoryHandler<T>> h : priorityInventory.entries())
|
out = iterateInventories(out, priorityInventory);
|
||||||
for (final List<IMEInventoryHandler<T>> i : this.priorityInventory.values()) {
|
out = iterateInventories(out, stickyPriorityInventory);
|
||||||
|
|
||||||
|
this.surface(this, Actionable.SIMULATE);
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IItemList<T> iterateInventories(IItemList<T> out, final NavigableMap<Integer, List<IMEInventoryHandler<T>>> map) {
|
||||||
|
for (final List<IMEInventoryHandler<T>> i : map.values()) {
|
||||||
for (final IMEInventoryHandler<T> j : i) {
|
for (final IMEInventoryHandler<T> j : i) {
|
||||||
out = j.getAvailableItems(out);
|
out = j.getAvailableItems(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.surface(this, Actionable.SIMULATE);
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
|||||||
private int patternExpansionUpgrades = 0;
|
private int patternExpansionUpgrades = 0;
|
||||||
private int magnetUpgrades = 0;
|
private int magnetUpgrades = 0;
|
||||||
private int quantumUpgrades = 0;
|
private int quantumUpgrades = 0;
|
||||||
|
private int stickyUpgrades = 0;
|
||||||
|
|
||||||
public UpgradeInventory(final IAEAppEngInventory parent, final int s) {
|
public UpgradeInventory(final IAEAppEngInventory parent, final int s) {
|
||||||
super(null, s, 1);
|
super(null, s, 1);
|
||||||
@@ -85,6 +86,8 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
|||||||
return this.magnetUpgrades;
|
return this.magnetUpgrades;
|
||||||
case QUANTUM_LINK:
|
case QUANTUM_LINK:
|
||||||
return this.quantumUpgrades;
|
return this.quantumUpgrades;
|
||||||
|
case STICKY:
|
||||||
|
return this.stickyUpgrades;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -94,7 +97,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
|||||||
|
|
||||||
private void updateUpgradeInfo() {
|
private void updateUpgradeInfo() {
|
||||||
this.cached = true;
|
this.cached = true;
|
||||||
this.patternExpansionUpgrades = this.inverterUpgrades = this.capacityUpgrades = this.redstoneUpgrades = this.speedUpgrades = this.fuzzyUpgrades = this.craftingUpgrades = magnetUpgrades = quantumUpgrades = 0;
|
this.patternExpansionUpgrades = this.inverterUpgrades = this.capacityUpgrades = this.redstoneUpgrades = this.speedUpgrades = this.fuzzyUpgrades = this.craftingUpgrades = magnetUpgrades = quantumUpgrades = stickyUpgrades = 0;
|
||||||
|
|
||||||
for (final ItemStack is : this) {
|
for (final ItemStack is : this) {
|
||||||
if (is == null || is.getItem() == Items.AIR || !(is.getItem() instanceof IUpgradeModule)) {
|
if (is == null || is.getItem() == Items.AIR || !(is.getItem() instanceof IUpgradeModule)) {
|
||||||
@@ -129,6 +132,10 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
|||||||
break;
|
break;
|
||||||
case QUANTUM_LINK:
|
case QUANTUM_LINK:
|
||||||
this.quantumUpgrades++;
|
this.quantumUpgrades++;
|
||||||
|
break;
|
||||||
|
case STICKY:
|
||||||
|
this.stickyUpgrades++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -143,6 +150,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
|||||||
this.patternExpansionUpgrades = Math.min(this.patternExpansionUpgrades, this.getMaxInstalled(Upgrades.PATTERN_EXPANSION));
|
this.patternExpansionUpgrades = Math.min(this.patternExpansionUpgrades, this.getMaxInstalled(Upgrades.PATTERN_EXPANSION));
|
||||||
this.magnetUpgrades = Math.min(this.magnetUpgrades, this.getMaxInstalled(Upgrades.MAGNET));
|
this.magnetUpgrades = Math.min(this.magnetUpgrades, this.getMaxInstalled(Upgrades.MAGNET));
|
||||||
this.quantumUpgrades = Math.min(this.quantumUpgrades, this.getMaxInstalled(Upgrades.QUANTUM_LINK));
|
this.quantumUpgrades = Math.min(this.quantumUpgrades, this.getMaxInstalled(Upgrades.QUANTUM_LINK));
|
||||||
|
this.stickyUpgrades = Math.min(this.stickyUpgrades, this.getMaxInstalled(Upgrades.STICKY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
this.getConfigManager().registerSetting(Settings.ACCESS, AccessRestriction.READ_WRITE);
|
this.getConfigManager().registerSetting(Settings.ACCESS, AccessRestriction.READ_WRITE);
|
||||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||||
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
|
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
|
||||||
|
this.getConfigManager().registerSetting(Settings.STICKY_MODE, YesNo.NO);
|
||||||
this.mySrc = new MachineSource(this);
|
this.mySrc = new MachineSource(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,6 +468,10 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getInstalledUpgrades(Upgrades.STICKY) > 0) {
|
||||||
|
this.handler.setSticky(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
||||||
this.handler.setPartitionList(new FuzzyPriorityList<>(priorityList, (FuzzyMode) this.getConfigManager().getSetting(Settings.FUZZY_MODE)));
|
this.handler.setPartitionList(new FuzzyPriorityList<>(priorityList, (FuzzyMode) this.getConfigManager().getSetting(Settings.FUZZY_MODE)));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ gui.appliedenergistics2.Renamer=Custom Name: (Enter to set)
|
|||||||
gui.appliedenergistics2.Nothing=Nothing
|
gui.appliedenergistics2.Nothing=Nothing
|
||||||
gui.appliedenergistics2.CraftingToastDone=Crafting Done!
|
gui.appliedenergistics2.CraftingToastDone=Crafting Done!
|
||||||
gui.appliedenergistics2.CraftingToastCancelled=Crafting Cancelled!
|
gui.appliedenergistics2.CraftingToastCancelled=Crafting Cancelled!
|
||||||
|
gui.appliedenergistics2.Sticky=Sticky
|
||||||
|
|
||||||
// GUI Tooltips
|
// GUI Tooltips
|
||||||
gui.tooltips.appliedenergistics2.Stash=Store Items
|
gui.tooltips.appliedenergistics2.Stash=Store Items
|
||||||
@@ -524,6 +525,7 @@ item.appliedenergistics2.material.silicon_print.name=Printed Silicon
|
|||||||
item.appliedenergistics2.material.name_press.name=Inscriber Name Press
|
item.appliedenergistics2.material.name_press.name=Inscriber Name Press
|
||||||
item.appliedenergistics2.material.sky_dust.name=Sky Stone Dust
|
item.appliedenergistics2.material.sky_dust.name=Sky Stone Dust
|
||||||
item.appliedenergistics2.material.card_crafting.name=Crafting Card
|
item.appliedenergistics2.material.card_crafting.name=Crafting Card
|
||||||
|
item.appliedenergistics2.material.card_sticky.name=Sticky Card
|
||||||
|
|
||||||
item.appliedenergistics2.multi_part.annihilation_plane.name=ME Annihilation Plane
|
item.appliedenergistics2.multi_part.annihilation_plane.name=ME Annihilation Plane
|
||||||
item.appliedenergistics2.multi_part.fluid_annihilation_plane.name=ME Fluid Annihilation Plane
|
item.appliedenergistics2.multi_part.fluid_annihilation_plane.name=ME Fluid Annihilation Plane
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "appliedenergistics2:items/material_card_sticky"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"type": "forge:and",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"type": "appliedenergistics2:material_exists",
|
||||||
|
"material": "material.card_sticky"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "appliedenergistics2:material_exists",
|
||||||
|
"material": "material.basic_card"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": {
|
||||||
|
"type": "appliedenergistics2:part",
|
||||||
|
"part": "material.card_sticky"
|
||||||
|
},
|
||||||
|
"type": "appliedenergistics2:part_shapeless",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"item": "minecraft:slime_ball"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "appliedenergistics2:part",
|
||||||
|
"part": "material.basic_card"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 448 B |
Reference in New Issue
Block a user