Skip to content

Commit 36d713c

Browse files
committed
simplify CraftingOutputSlot MS and SH constructor
rename int sync value to be more appropriate
1 parent f750d95 commit 36d713c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ public class CraftingOutputSlot extends Widget<CraftingOutputSlot> implements In
4343
private static final int SYNC_STACK = 5;
4444
private final CraftingSlotSH syncHandler;
4545

46-
public CraftingOutputSlot(IntSyncValue syncValue, MetaTileEntityWorkbench workbench) {
47-
this.syncHandler = new CraftingSlotSH(
48-
new CraftingOutputMS(
49-
workbench.getCraftingRecipeLogic().getCraftingResultInventory(),
50-
syncValue, workbench));
46+
public CraftingOutputSlot(IntSyncValue amountCrafted, MetaTileEntityWorkbench workbench) {
47+
this.syncHandler = new CraftingSlotSH(amountCrafted, workbench);
5148
setSyncHandler(this.syncHandler);
5249
tooltipAutoUpdate(true);
5350
tooltipBuilder(tooltip -> {
@@ -100,8 +97,8 @@ protected static class CraftingSlotSH extends SyncHandler {
10097

10198
private final List<ModularSlot> shiftClickSlots = new ArrayList<>();
10299

103-
public CraftingSlotSH(CraftingOutputMS slot) {
104-
this.slot = slot;
100+
public CraftingSlotSH(IntSyncValue amountCrafted, MetaTileEntityWorkbench workbench) {
101+
this.slot = new CraftingOutputMS(amountCrafted, workbench);
105102
this.recipeLogic = slot.recipeLogic;
106103
}
107104

@@ -256,15 +253,16 @@ public void handleItemCraft(ItemStack craftedStack, EntityPlayer player) {
256253

257254
protected static class CraftingOutputMS extends ModularSlot {
258255

259-
private final IntSyncValue syncValue;
256+
private final IntSyncValue amountCrafted;
260257
private final CraftingRecipeLogic recipeLogic;
261258
private final CraftingRecipeMemory recipeMemory;
262259
private final IItemHandler craftingGrid;
263260

264-
public CraftingOutputMS(IInventory craftingInventory, IntSyncValue syncValue,
265-
MetaTileEntityWorkbench workbench) {
266-
super(new InventoryWrapper(craftingInventory, workbench.getCraftingRecipeLogic()), 0, true);
267-
this.syncValue = syncValue;
261+
public CraftingOutputMS(IntSyncValue amountCrafted, MetaTileEntityWorkbench workbench) {
262+
super(new InventoryWrapper(
263+
workbench.getCraftingRecipeLogic().getCraftingResultInventory(),
264+
workbench.getCraftingRecipeLogic()), 0, true);
265+
this.amountCrafted = amountCrafted;
268266
this.recipeLogic = workbench.getCraftingRecipeLogic();
269267
this.recipeMemory = workbench.getRecipeMemory();
270268
this.craftingGrid = workbench.getCraftingGrid();
@@ -285,7 +283,7 @@ public boolean canTakeStack(EntityPlayer playerIn) {
285283
}
286284

287285
public void notifyRecipePerformed(ItemStack stack) {
288-
this.syncValue.setValue(this.syncValue.getValue() + stack.getCount(), true, true);
286+
this.amountCrafted.setValue(this.amountCrafted.getValue() + stack.getCount(), true, true);
289287
this.recipeMemory.notifyRecipePerformed(this.craftingGrid, stack);
290288
}
291289

0 commit comments

Comments
 (0)