Skip to content

Commit 7b4e39f

Browse files
committed
fix: CustomItemStack ctor -> static factory
1 parent c0e2183 commit 7b4e39f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ abstract class AbstractItemNetwork extends Network {
5959
private static final int[] TERMINAL_SLOTS = { 0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42 };
6060
private static final int TERMINAL_OUT_SLOT = 17;
6161

62-
private final ItemStack terminalPlaceholderItem = new CustomItemStack(Material.BARRIER, "&4No Item cached");
62+
private final ItemStack terminalPlaceholderItem = CustomItemStack.create(Material.BARRIER, "&4No Item cached");
6363

6464
protected final Set<Location> terminals = new HashSet<>();
6565
protected final Set<Location> imports = new HashSet<>();
@@ -175,13 +175,13 @@ private void collectExtractionRequest(Map<Location, Inventory> inventories, Item
175175
if (stack == null) {
176176
stack = is;
177177
} else {
178-
stack = new CustomItemStack(stack, stack.getAmount() + is.getAmount());
178+
stack = CustomItemStack.create(stack, stack.getAmount() + is.getAmount());
179179
}
180180

181181
if (is.getAmount() == item.getAmount()) {
182182
break;
183183
} else {
184-
item = new CustomItemStack(item, item.getAmount() - is.getAmount());
184+
item = CustomItemStack.create(item, item.getAmount() - is.getAmount());
185185
}
186186
}
187187
}
@@ -193,7 +193,7 @@ private void collectExtractionRequest(Map<Location, Inventory> inventories, Item
193193
if (prev == null) {
194194
terminal.replaceExistingItem(slot, stack);
195195
} else {
196-
terminal.replaceExistingItem(slot, new CustomItemStack(stack, stack.getAmount() + prev.getAmount()));
196+
terminal.replaceExistingItem(slot, CustomItemStack.create(stack, stack.getAmount() + prev.getAmount()));
197197
}
198198
}
199199

@@ -247,7 +247,7 @@ private void collectExportRequests(Map<Location, Inventory> inventories) {
247247
ItemStack template = menu.getItemInSlot(slot);
248248

249249
if (template != null) {
250-
items.add(new CustomItemStack(template, 1));
250+
items.add(CustomItemStack.create(template, 1));
251251
}
252252
}
253253

@@ -387,7 +387,7 @@ private void updateTerminal(Location l, BlockMenu terminal, int slot, int index,
387387
terminal.replaceExistingItem(slot, stack);
388388
terminal.addMenuClickHandler(slot, (p, sl, is, action) -> {
389389
int amount = item.getInt() > item.getItem().getMaxStackSize() ? item.getItem().getMaxStackSize() : item.getInt();
390-
ItemStack requestedItem = new CustomItemStack(item.getItem(), action.isRightClicked() ? amount : 1);
390+
ItemStack requestedItem = CustomItemStack.create(item.getItem(), action.isRightClicked() ? amount : 1);
391391
itemRequests.add(new ItemRequest(l, 44, requestedItem, ItemTransportFlow.WITHDRAW));
392392
return false;
393393
});

0 commit comments

Comments
 (0)