Skip to content

Commit f378510

Browse files
committed
Cleanup StoredBlockMechanic pipe code
1 parent 57e2b35 commit f378510

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

craftbook-bukkit/src/main/java/org/enginehub/craftbook/mechanics/area/StoredBlockMechanic.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@ public void onPipeSuck(PipeSuckEvent event) {
167167
List<ItemStack> items = event.getItems();
168168
try {
169169
Material base = getOrSetStoredType(event.getSuckedBlock());
170-
int blocks = getStoredBlockCounts(sign);
171-
if (blocks > 0) {
170+
int blocks = getStoredBlockCount(sign);
171+
//noinspection ConstantValue
172+
if (blocks > 0 && blocks != INFINITE_SENTINEL) {
172173
items.add(new ItemStack(base, blocks));
173-
takeFromStoredBlockCounts(blocks, sign);
174+
setStoredBlockCount(sign, 0);
174175
}
175176
event.setItems(items);
176177
} catch (InvalidMechanismException e) {
@@ -345,7 +346,7 @@ public boolean hasRequiredBlockCounts(int count, @Nullable Sign... signs) {
345346
}
346347
}
347348

348-
return count >= sum;
349+
return sum >= count;
349350
}
350351

351352
/**

0 commit comments

Comments
 (0)