wip interfaces stacksizes
This commit is contained in:
+6
-2
@@ -289,7 +289,11 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||
final String which = Integer.toString(x);
|
||||
if (invData.hasKey(which)) {
|
||||
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
|
||||
NBTTagCompound tag = invData.getCompoundTag(which);
|
||||
current.getInventory().setStackInSlot(x, new ItemStack(tag));
|
||||
if (tag.hasKey("stackSize")) {
|
||||
current.getInventory().getStackInSlot(x).setCount(tag.getInteger("stackSize"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException ignored) {
|
||||
@@ -435,7 +439,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
ClientDCInternalInv o = this.byId.get(id);
|
||||
|
||||
if (o == null) {
|
||||
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 64));
|
||||
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 512));
|
||||
this.refreshList = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -545,23 +545,20 @@ public abstract class AEBaseContainer extends Container {
|
||||
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
|
||||
if (hand.isEmpty()) {
|
||||
s.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
s.putStack(hand.copy());
|
||||
}
|
||||
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
|
||||
if (!hand.isEmpty()) {
|
||||
final ItemStack is = hand.copy();
|
||||
is.setCount(1);
|
||||
s.putStack(is);
|
||||
} else {
|
||||
final ItemStack is = s.getStack().copy();
|
||||
if (is.getCount() < is.getMaxStackSize())
|
||||
if (is.getCount() < is.getMaxStackSize() * 8)
|
||||
is.grow(1);
|
||||
s.putStack(is);
|
||||
}
|
||||
@@ -575,7 +572,6 @@ public abstract class AEBaseContainer extends Container {
|
||||
}
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
|
||||
ItemStack is = s.getStack();
|
||||
if (!is.isEmpty()) {
|
||||
if (hand.isEmpty()) {
|
||||
@@ -586,14 +582,12 @@ public abstract class AEBaseContainer extends Container {
|
||||
is = hand.copy();
|
||||
is.setCount(1);
|
||||
}
|
||||
|
||||
s.putStack(is);
|
||||
} else if (!hand.isEmpty()) {
|
||||
is = hand.copy();
|
||||
is.setCount(1);
|
||||
s.putStack(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case CREATIVE_DUPLICATE:
|
||||
case MOVE_REGION:
|
||||
@@ -606,9 +600,9 @@ public abstract class AEBaseContainer extends Container {
|
||||
if (action == InventoryAction.MOVE_REGION) {
|
||||
final List<Slot> from = new ArrayList<>();
|
||||
|
||||
for (final Object j : this.inventorySlots) {
|
||||
if (j instanceof Slot && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||
from.add((Slot) j);
|
||||
for (final Slot j : this.inventorySlots) {
|
||||
if (j != null && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||
from.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -184,7 +184,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
}
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
if (inSlot.getMaxStackSize() > inSlot.getCount()) {
|
||||
if (inSlot.getCount() < inSlot.getMaxStackSize() * 8) {
|
||||
inSlot.grow(1);
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
||||
}
|
||||
@@ -299,6 +299,9 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
|
||||
if (!is.isEmpty()) {
|
||||
is.writeToNBT(itemNBT);
|
||||
if (is.getCount() > is.getMaxStackSize()) {
|
||||
itemNBT.setInteger("stackSize", is.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
||||
|
||||
@@ -114,8 +114,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private final IActionSource mySource;
|
||||
private final IActionSource interfaceRequestSource;
|
||||
private final ConfigManager cm = new ConfigManager(this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS);
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS, 512);
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS, 512);
|
||||
private final AppEngInternalInventory patterns = new AppEngInternalInventory(this, NUMBER_OF_PATTERN_SLOTS);
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>(new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>(new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class));
|
||||
|
||||
@@ -52,6 +52,13 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
||||
this.inv = new IAEItemStack[s];
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory(final IAEAppEngInventory te, final int s, int stackSize) {
|
||||
this.te = te;
|
||||
this.size = s;
|
||||
this.maxStack = stackSize;
|
||||
this.inv = new IAEItemStack[s];
|
||||
}
|
||||
|
||||
public void setMaxStackSize(final int s) {
|
||||
this.maxStack = s;
|
||||
}
|
||||
@@ -216,7 +223,7 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
||||
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return this.maxStack > 64 ? 64 : this.maxStack;
|
||||
return this.maxStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user