Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public class MTEVendingMachine extends MTEMultiBlockBase

private final ArrayList<MTEVendingUplinkHatch> uplinkHatches = new ArrayList<>();

public static final int INPUT_SLOTS = 6;
public static final int OUTPUT_SLOTS = 6;
public static final int INPUT_SLOTS = 8;
public static final int OUTPUT_SLOTS = 8;

public static final int MAX_TRADES = 300;

Expand Down Expand Up @@ -500,15 +500,53 @@ public void saveNBTData(NBTTagCompound aNBT) {
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
boolean loadedLegacyData = false;

NBTTagList pendingOutputs = aNBT.getTagList("outputBuffer", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < pendingOutputs.tagCount(); i++) {
outputBuffer.add(GTUtility.loadItem(pendingOutputs.getCompoundTagAt(i)));
}

if (inputItems != null) {
inputItems.deserializeNBT(aNBT.getCompoundTag("inputs"));
if (inputItems.getSlots() != MTEVendingMachine.INPUT_SLOTS) {
loadedLegacyData = true;
List<ItemStack> oldStacks = new ArrayList<>();
for (int i = 0; i < inputItems.getSlots(); i++) {
oldStacks.add(inputItems.getStackInSlot(i));
}
inputItems.setSize(MTEVendingMachine.INPUT_SLOTS);
for (int i = 0; i < oldStacks.size(); i++) {
if (i >= MTEVendingMachine.INPUT_SLOTS) {
outputBuffer.add(oldStacks.get(i));
} else {
inputItems.setStackInSlot(i, oldStacks.get(i));
}
}
}
}

if (outputItems != null) {
outputItems.deserializeNBT(aNBT.getCompoundTag("outputs"));
if (outputItems.getSlots() != MTEVendingMachine.OUTPUT_SLOTS) {
loadedLegacyData = true;
List<ItemStack> oldStacks = new ArrayList<>();
for (int i = 0; i < outputItems.getSlots(); i++) {
oldStacks.add(outputItems.getStackInSlot(i));
}
outputItems.setSize(MTEVendingMachine.OUTPUT_SLOTS);
for (int i = 0; i < oldStacks.size(); i++) {
if (i >= MTEVendingMachine.OUTPUT_SLOTS) {
outputBuffer.add(oldStacks.get(i));
} else {
outputItems.setStackInSlot(i, oldStacks.get(i));
}
}
}
}
NBTTagList pendingOutputs = aNBT.getTagList("outputBuffer", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < pendingOutputs.tagCount(); i++) {
outputBuffer.add(GTUtility.loadItem(pendingOutputs.getCompoundTagAt(i)));

if (loadedLegacyData) {
this.markDirty();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void doEjectItems() {
private IWidget createIOColumn() {
return new ParentWidget<>().excludeAreaInRecipeViewer()
.width(50)
.height(178)
.height(214)
.right(-48)
.top(40)
.widgetTheme(WidgetThemes.BACKGROUND_SIDEPANEL)
Expand All @@ -349,7 +349,7 @@ private IWidget createIOColumn() {
.child(
new Row().child(createInputSlots().center())
.top(20)
.height(18 * 3))
.height(18 * 4))
.child(
new Row().child(
new ToggleButton().overlay(GTGuiTextures.OVERLAY_BUTTON_CYCLIC)
Expand All @@ -363,24 +363,24 @@ private IWidget createIOColumn() {
.tooltipBuilder(t -> t.addLine(IKey.lang("vendingmachine.gui.coin_eject")))
.syncHandler("ejectCoins")
.left(6))
.top(80)
.top(98)
.height(18))
.child(
GuiTextures.OUTPUT_SPRITE.asWidget()
.leftRel(0.5f)
.bottom(52)
.bottom(70)
.width(30)
.height(20))
.child(
new Row().child(createOutputSlots().center())
.bottom(6)
.height(18 * 3))
.height(18 * 4))
.right(1));
}

private SlotGroupWidget createInputSlots() {
return SlotGroupWidget.builder()
.matrix("II", "II", "II")
.matrix("II", "II", "II", "II")
.key('I', index -> {
InterceptingSlot slot = new InterceptingSlot(base.inputItems, index, this.base);
this.inputSlots.add(slot);
Expand Down Expand Up @@ -414,7 +414,7 @@ private SlotGroupWidget createInputSlots() {

private SlotGroupWidget createOutputSlots() {
return SlotGroupWidget.builder()
.matrix("II", "II", "II")
.matrix("II", "II", "II", "II")
.key('I', index -> {
return new ItemSlot().slot(
new ModularSlot(base.outputItems, index).accessibility(false, true)
Expand Down