specify inventory changes

This commit is contained in:
gnembon committed 2024-02-29 12:32:52 +01:00
1 parent a0bd6e22ac
commit 289df9d9f8
4 files changed
+21 -12

No files matched your search

@@ -27,10 +27,11 @@ public abstract class Inventory_scarpetEventMixin
if (!PLAYER_PICKS_UP_ITEM.isNeeded() || !(player instanceof ServerPlayer))
return playerInventory.add(-1, stack);
int count = stack.getCount();
ItemStack previous = stack.copy();
boolean res = playerInventory.add(-1, stack);
if (count != stack.getCount()) // res returns false for larger item adding to a almost full ineventory
{
ItemStack diffStack = stack.copyWithCount(count - stack.getCount());
ItemStack diffStack = previous.copyWithCount(count - stack.getCount());
PLAYER_PICKS_UP_ITEM.onItemAction((ServerPlayer) player, null, diffStack);
}
return res;
@@ -1661,7 +1661,7 @@ public class ShapeDispatcher
public Value validate(Map<String, Value> options, MinecraftServer server, Value value)
{
ItemStack item = ValueConversions.getItemStackFromValue(value, true, server.registryAccess());
return new NBTSerializableValue(item.save(server.registryAccess()));
return new NBTSerializableValue(item.saveOptional(server.registryAccess()));
}
@Override