From 8d875653e069641ecd26080d4338c4490be91402 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 7 Jun 2025 13:18:21 -0700 Subject: [PATCH] Fix rusty gear item stack not updating client side Part of #6 --- AriasServerUtils/PlayerData.cs | 2 +- AriasServerUtils/RustyGearUtils.cs | 7 ++++++- AriasServerUtils/assets/ariasserverutils/lang/en.json | 4 ++-- AriasServerUtils/modinfo.json | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AriasServerUtils/PlayerData.cs b/AriasServerUtils/PlayerData.cs index 6be84eb..0608773 100644 --- a/AriasServerUtils/PlayerData.cs +++ b/AriasServerUtils/PlayerData.cs @@ -35,7 +35,7 @@ namespace AriasServerUtils { if (entity is EntityPlayer player) { - if (unmount && player.MountedOn.Entity != null) + if (unmount && player.MountedOn != null && player.MountedOn.Entity != null) { player.TryUnmount(); } diff --git a/AriasServerUtils/RustyGearUtils.cs b/AriasServerUtils/RustyGearUtils.cs index 8ee5a9c..d4cf9c8 100644 --- a/AriasServerUtils/RustyGearUtils.cs +++ b/AriasServerUtils/RustyGearUtils.cs @@ -73,12 +73,17 @@ public static class RustyGearUtils 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 (slot.StackSize <= amountToRemove) slot.Itemstack = null; + if (slot.StackSize <= amountToRemove) + { + slot.Itemstack = null; + slot.MarkDirty(); + } else { // Otherwise, subtract the amount to remove from the slot size and decrement the total amount slot.Itemstack.StackSize -= amountToRemove; amount -= amountToRemove; + slot.MarkDirty(); } } diff --git a/AriasServerUtils/assets/ariasserverutils/lang/en.json b/AriasServerUtils/assets/ariasserverutils/lang/en.json index d94d30f..4ae5596 100644 --- a/AriasServerUtils/assets/ariasserverutils/lang/en.json +++ b/AriasServerUtils/assets/ariasserverutils/lang/en.json @@ -48,6 +48,6 @@ "psp": "[ASU] PSP Starting... you do not need to stay in bed", "psp-ending": "[ASU] PSP Complete", - "cost-insufficient": "You only have {1} rusty gears, you need {0}.", - "cost-charged": "You have been charged {0} rusty gears." + "cost-insufficient": "You only have {1} rusty gear(s), you need {0}.", + "cost-charged": "You have been charged {0} rusty gear(s)." } diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index 2462384..660a44b 100644 --- a/AriasServerUtils/modinfo.json +++ b/AriasServerUtils/modinfo.json @@ -3,8 +3,8 @@ "modid": "ariasserverutils", "name": "Aria's Server Utilities", "authors": ["zontreck"], - "description": "A collection of server utilities\n\nBuild Date: 06-07-2025 @ 1:03 PM MST", - "version": "1.1.0-dev.6", + "description": "A collection of server utilities\n\nBuild Date: 06-07-2025 @ 1:16 PM MST", + "version": "1.1.0-dev.7", "dependencies": { "game": "" }