Skip to content

Commit fc2c165

Browse files
authored
Merge pull request #221 from pylonmc/fix/pit-kiln
Fix #219 and resolve #218
2 parents f02d718 + 7d307f7 commit fc2c165

File tree

1 file changed

+9
-8
lines changed
  • src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting

1 file changed

+9
-8
lines changed

src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/PitKiln.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,16 @@ public void onInteract(@NotNull PlayerInteractEvent event) {
134134
for (ItemStack contentItem : contents) {
135135
currentAmount += contentItem.getAmount();
136136
}
137-
int taken = Math.min(CAPACITY - currentAmount, item.getAmount());
138-
if (taken <= 0) return;
137+
if (currentAmount >= CAPACITY) return;
139138

139+
item.subtract();
140140
for (ItemStack contentItem : contents) {
141141
if (contentItem.isSimilar(item)) {
142-
contentItem.add(taken);
143-
break;
142+
contentItem.add();
143+
return;
144144
}
145145
}
146-
item.subtract(taken);
146+
contents.add(item.asOne());
147147
}
148148

149149
@Override
@@ -174,15 +174,16 @@ public void tick(double deltaSeconds) {
174174
};
175175
topBlock.setType(Material.COARSE_DIRT);
176176
}
177+
outputLoop:
177178
for (ItemStack outputItem : processing) {
178179
int addAmount = (int) Math.floor(outputItem.getAmount() * multiplier);
179180
for (ItemStack contentItem : contents) {
180181
if (contentItem.isSimilar(outputItem)) {
181-
outputItem.add(addAmount);
182-
contents.remove(contentItem);
183-
break;
182+
contentItem.add(addAmount);
183+
continue outputLoop;
184184
}
185185
}
186+
contents.add(outputItem.asQuantity(addAmount));
186187
}
187188
processing.clear();
188189
for (Vector3i coal : COAL_POSITIONS) {

0 commit comments

Comments
 (0)