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++) {
|
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||||
final String which = Integer.toString(x);
|
final String which = Integer.toString(x);
|
||||||
if (invData.hasKey(which)) {
|
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) {
|
} catch (final NumberFormatException ignored) {
|
||||||
@@ -435,7 +439,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
ClientDCInternalInv o = this.byId.get(id);
|
ClientDCInternalInv o = this.byId.get(id);
|
||||||
|
|
||||||
if (o == null) {
|
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;
|
this.refreshList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -545,23 +545,20 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PICKUP_OR_SET_DOWN:
|
case PICKUP_OR_SET_DOWN:
|
||||||
|
|
||||||
if (hand.isEmpty()) {
|
if (hand.isEmpty()) {
|
||||||
s.putStack(ItemStack.EMPTY);
|
s.putStack(ItemStack.EMPTY);
|
||||||
} else {
|
} else {
|
||||||
s.putStack(hand.copy());
|
s.putStack(hand.copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE:
|
||||||
|
|
||||||
if (!hand.isEmpty()) {
|
if (!hand.isEmpty()) {
|
||||||
final ItemStack is = hand.copy();
|
final ItemStack is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
} else {
|
} else {
|
||||||
final ItemStack is = s.getStack().copy();
|
final ItemStack is = s.getStack().copy();
|
||||||
if (is.getCount() < is.getMaxStackSize())
|
if (is.getCount() < is.getMaxStackSize() * 8)
|
||||||
is.grow(1);
|
is.grow(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
}
|
}
|
||||||
@@ -575,7 +572,6 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPLIT_OR_PLACE_SINGLE:
|
case SPLIT_OR_PLACE_SINGLE:
|
||||||
|
|
||||||
ItemStack is = s.getStack();
|
ItemStack is = s.getStack();
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
if (hand.isEmpty()) {
|
if (hand.isEmpty()) {
|
||||||
@@ -586,14 +582,12 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
is = hand.copy();
|
is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
} else if (!hand.isEmpty()) {
|
} else if (!hand.isEmpty()) {
|
||||||
is = hand.copy();
|
is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CREATIVE_DUPLICATE:
|
case CREATIVE_DUPLICATE:
|
||||||
case MOVE_REGION:
|
case MOVE_REGION:
|
||||||
@@ -606,9 +600,9 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
if (action == InventoryAction.MOVE_REGION) {
|
if (action == InventoryAction.MOVE_REGION) {
|
||||||
final List<Slot> from = new ArrayList<>();
|
final List<Slot> from = new ArrayList<>();
|
||||||
|
|
||||||
for (final Object j : this.inventorySlots) {
|
for (final Slot j : this.inventorySlots) {
|
||||||
if (j instanceof Slot && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
if (j != null && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||||
from.add((Slot) j);
|
from.add(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -184,7 +184,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE:
|
||||||
if (inSlot.getMaxStackSize() > inSlot.getCount()) {
|
if (inSlot.getCount() < inSlot.getMaxStackSize() * 8) {
|
||||||
inSlot.grow(1);
|
inSlot.grow(1);
|
||||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
||||||
}
|
}
|
||||||
@@ -299,6 +299,9 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
|
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
is.writeToNBT(itemNBT);
|
is.writeToNBT(itemNBT);
|
||||||
|
if (is.getCount() > is.getMaxStackSize()) {
|
||||||
|
itemNBT.setInteger("stackSize", is.getCount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
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 mySource;
|
||||||
private final IActionSource interfaceRequestSource;
|
private final IActionSource interfaceRequestSource;
|
||||||
private final ConfigManager cm = new ConfigManager(this);
|
private final ConfigManager cm = new ConfigManager(this);
|
||||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS);
|
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS, 512);
|
||||||
private final AppEngInternalInventory storage = new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS);
|
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 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<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));
|
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];
|
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) {
|
public void setMaxStackSize(final int s) {
|
||||||
this.maxStack = s;
|
this.maxStack = s;
|
||||||
}
|
}
|
||||||
@@ -216,7 +223,7 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSlotLimit(int slot) {
|
public int getSlotLimit(int slot) {
|
||||||
return this.maxStack > 64 ? 64 : this.maxStack;
|
return this.maxStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user