Fix MatteryContainer not adding items properly
This commit is contained in:
parent
d9baced685
commit
ee2c3241d4
@ -193,7 +193,7 @@ public class MatteryContainer implements Container, Iterable<ItemStack> {
|
|||||||
if (stack.isEmpty() || start < 0 || end > size || start >= end)
|
if (stack.isEmpty() || start < 0 || end > size || start >= end)
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
var copy = stack.copy();
|
final var copy = stack.copy();
|
||||||
|
|
||||||
// двигаем в одинаковые слоты
|
// двигаем в одинаковые слоты
|
||||||
for (int slot = start; slot < end; slot++) {
|
for (int slot = start; slot < end; slot++) {
|
||||||
@ -229,6 +229,7 @@ public class MatteryContainer implements Container, Iterable<ItemStack> {
|
|||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
var put_copy = copy.copy();
|
var put_copy = copy.copy();
|
||||||
put_copy.setCount(diff);
|
put_copy.setCount(diff);
|
||||||
|
slots[slot] = put_copy;
|
||||||
tracked_slots[slot] = put_copy.copy();
|
tracked_slots[slot] = put_copy.copy();
|
||||||
setChanged(slot, put_copy, ItemStack.EMPTY);
|
setChanged(slot, put_copy, ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
@ -244,10 +245,12 @@ public class MatteryContainer implements Container, Iterable<ItemStack> {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public ItemStack addItem(ItemStack stack, boolean simulate) {
|
public ItemStack addItem(ItemStack stack, boolean simulate) {
|
||||||
return addItem(stack, 0, size, simulate);
|
return addItem(stack, 0, size, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public ItemStack addItem(ItemStack stack) {
|
public ItemStack addItem(ItemStack stack) {
|
||||||
return addItem(stack, 0, size, false);
|
return addItem(stack, 0, size, false);
|
||||||
}
|
}
|
||||||
@ -260,6 +263,7 @@ public class MatteryContainer implements Container, Iterable<ItemStack> {
|
|||||||
return addItem(stack, 0, size, false).isEmpty();
|
return addItem(stack, 0, size, false).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public boolean fullyAddItem(ItemStack stack, int start, int end) {
|
public boolean fullyAddItem(ItemStack stack, int start, int end) {
|
||||||
if (!addItem(stack, start, end, true).isEmpty()) {
|
if (!addItem(stack, start, end, true).isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user