Fix rusty gear item stack not updating client side

Part of #6
This commit is contained in:
zontreck 2025-06-07 13:18:21 -07:00
parent 6b6e2af0fc
commit 8d875653e0
4 changed files with 11 additions and 6 deletions

View file

@ -35,7 +35,7 @@ namespace AriasServerUtils
{ {
if (entity is EntityPlayer player) if (entity is EntityPlayer player)
{ {
if (unmount && player.MountedOn.Entity != null) if (unmount && player.MountedOn != null && player.MountedOn.Entity != null)
{ {
player.TryUnmount(); player.TryUnmount();
} }

View file

@ -73,12 +73,17 @@ public static class RustyGearUtils
int amountToRemove = Math.Min(value, amount); int amountToRemove = Math.Min(value, amount);
// If the slot size is less than or equal to the amount to remove, set the slot's itemstack to null // If the slot size is less than or equal to the amount to remove, set the slot's itemstack to null
if (slot.StackSize <= amountToRemove) slot.Itemstack = null; if (slot.StackSize <= amountToRemove)
{
slot.Itemstack = null;
slot.MarkDirty();
}
else else
{ {
// Otherwise, subtract the amount to remove from the slot size and decrement the total amount // Otherwise, subtract the amount to remove from the slot size and decrement the total amount
slot.Itemstack.StackSize -= amountToRemove; slot.Itemstack.StackSize -= amountToRemove;
amount -= amountToRemove; amount -= amountToRemove;
slot.MarkDirty();
} }
} }

View file

@ -48,6 +48,6 @@
"psp": "[ASU] PSP Starting... you do not need to stay in bed", "psp": "[ASU] PSP Starting... you do not need to stay in bed",
"psp-ending": "[ASU] PSP Complete", "psp-ending": "[ASU] PSP Complete",
"cost-insufficient": "You only have {1} rusty gears, you need {0}.", "cost-insufficient": "You only have {1} rusty gear(s), you need {0}.",
"cost-charged": "You have been charged {0} rusty gears." "cost-charged": "You have been charged {0} rusty gear(s)."
} }

View file

@ -3,8 +3,8 @@
"modid": "ariasserverutils", "modid": "ariasserverutils",
"name": "Aria's Server Utilities", "name": "Aria's Server Utilities",
"authors": ["zontreck"], "authors": ["zontreck"],
"description": "A collection of server utilities\n\nBuild Date: 06-07-2025 @ 1:03 PM MST", "description": "A collection of server utilities\n\nBuild Date: 06-07-2025 @ 1:16 PM MST",
"version": "1.1.0-dev.6", "version": "1.1.0-dev.7",
"dependencies": { "dependencies": {
"game": "" "game": ""
} }