Skip to content

Commit bcaaf02

Browse files
fix: little bit of tidy up
1 parent 7b4c07a commit bcaaf02

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/main/java/com/tcm/MineTale/block/workbenches/entity/AbstractWorkbenchEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public abstract class AbstractWorkbenchEntity extends BlockEntity implements Men
3131
protected double scanRadius = 5.0;
3232

3333
// Slot Mapping: 0-1 Inputs, 2 Fuel, 3-6 Outputs
34-
protected final SimpleContainer inventory = new SimpleContainer(7);
34+
protected final SimpleContainer inventory = new SimpleContainer(Constants.TOTAL_SLOTS);
3535
protected int progress = 0;
3636
protected int maxProgress = 200;
3737

src/main/java/com/tcm/MineTale/block/workbenches/entity/FurnaceWorkbenchEntity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,12 @@ private void pullFromNearbyChests() {
228228
for (int i = 0; i < chest.getContainerSize(); i++) {
229229
ItemStack stack = chest.getItem(i);
230230
if (isOre(stack) || isWood(stack)) {
231-
int inputSlot = inventory.getItem(Constants.INPUT_1).isEmpty() ? Constants.INPUT_1 : (inventory.getItem(Constants.INPUT_2).isEmpty() ? Constants.INPUT_2 : -1);
231+
int inputSlot = -1;
232+
if (inventory.getItem(Constants.INPUT_1).isEmpty()) {
233+
inputSlot = Constants.INPUT_1;
234+
} else if (inventory.getItem(Constants.INPUT_2).isEmpty()) {
235+
inputSlot = Constants.INPUT_2;
236+
}
232237
if (inputSlot == -1) return;
233238
inventory.setItem(inputSlot, stack.split(1));
234239
chest.setChanged();

src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,24 @@ public ItemStack quickMoveStack(Player player, int index) {
166166
itemStack = itemStack2.copy();
167167

168168
// From Furnace to Player
169-
if (index < 7) {
170-
if (!this.moveItemStackTo(itemStack2, 7, 43, true)) {
169+
int containerSlots = Constants.TOTAL_SLOTS;
170+
int playerStart = containerSlots;
171+
int playerEnd = playerStart + 36;
172+
173+
// From Furnace to Player
174+
if (index < containerSlots) {
175+
if (!this.moveItemStackTo(itemStack2, playerStart, playerEnd, true)) {
171176
return ItemStack.EMPTY;
172177
}
173178
}
174179
// From Player to Furnace
175180
else {
176181
// If it's fuel, try fuel slot
177182
if (isFuel(itemStack2)) {
178-
if (!this.moveItemStackTo(itemStack2, 0, 1, false)) return ItemStack.EMPTY;
183+
if (!this.moveItemStackTo(itemStack2, Constants.FUEL_SLOT, Constants.FUEL_SLOT + 1, false)) return ItemStack.EMPTY;
179184
}
180185
// Otherwise, try inputs
181-
else if (!this.moveItemStackTo(itemStack2, 1, 3, false)) {
186+
else if (!this.moveItemStackTo(itemStack2, Constants.INPUT_1, Constants.INPUT_2 + 1, false)) {
182187
return ItemStack.EMPTY;
183188
}
184189
}

src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.tcm.MineTale.block.workbenches.menu;
22

33
import com.tcm.MineTale.registry.ModMenuTypes;
4+
import com.tcm.MineTale.util.Constants;
45

56
import net.minecraft.world.Container;
67
import net.minecraft.world.SimpleContainer;
@@ -9,7 +10,7 @@
910
import net.minecraft.world.inventory.SimpleContainerData;
1011

1112
public class CampfireWorkbenchMenu extends AbstractWorkbenchContainerMenu {
12-
private static final int containerSize = 7;
13+
private static final int containerSize = Constants.TOTAL_SLOTS;
1314
private static final int containerDataSize = 4;
1415

1516
/**

0 commit comments

Comments
 (0)