From 516add78039aad28626d92296154397d17511aad Mon Sep 17 00:00:00 2001 From: gohjoseph Date: Mon, 21 Mar 2022 01:17:30 +0800 Subject: [PATCH] Fix `GiveItem` not working if the player is in lava --- TShockAPI/TSPlayer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 7b452fe4..93db08bc 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1380,7 +1380,9 @@ namespace TShockAPI public virtual void GiveItem(int type, int stack, int prefix = 0) { int itemIndex = Item.NewItem(new EntitySource_DebugCommand(), (int)X, (int)Y, TPlayer.width, TPlayer.height, type, stack, true, prefix, true); - SendData(PacketTypes.ItemDrop, "", itemIndex); + Main.item[itemIndex].playerIndexTheItemIsReservedFor = this.Index; + SendData(PacketTypes.ItemDrop, "", itemIndex, 1); + SendData(PacketTypes.ItemOwner, null, itemIndex); } ///