finetuning

This commit is contained in:
Jottyfan
2025-12-30 19:24:21 +01:00
parent 84b3779af2
commit 8dda7a8ded

View File

@@ -127,28 +127,45 @@ public class ItemHoarderBlockEntity extends BlockEntity implements Container {
return stacks.isEmpty();
}
/**
* @deprecated use getStack(String key) instead
*/
@Deprecated
@Override
public ItemStack getItem(int slot) {
// buggy; do not use this. The map wants to have an item name instead
return ItemStack.EMPTY;
}
/**
* @deprecated use getStack(String key).setCount(0) or such instead
*/
@Deprecated
@Override
public ItemStack removeItem(int slot, int count) {
// buggy; do not use this. The map wants to have an item name instead
return ItemStack.EMPTY;
}
/**
* @deprecated use getStack(String key).setCount(0) or such instead
*/
@Deprecated
@Override
public ItemStack removeItemNoUpdate(int slot) {
// buggy; do not use this. The map wants to have an item name instead
return ItemStack.EMPTY;
}
/**
* @param slot is ignored; the right slot is found by itemStack's name
* @param itemStack the itemStack to add
*/
@Override
public void setItem(int slot, ItemStack itemStack) {
if (slot < stacks.size()) {
stacks.get(itemStack.getItem().getName().getString()).grow(itemStack.getCount());
ItemStack found = stacks.get(itemStack.getItem().getName().getString());
if (found != null) {
found.grow(itemStack.getCount());
} else if (!itemStack.isEmpty()) {
stacks.put(itemStack.getItem().getName().getString(), itemStack);
}