From 516add78039aad28626d92296154397d17511aad Mon Sep 17 00:00:00 2001 From: gohjoseph Date: Mon, 21 Mar 2022 01:17:30 +0800 Subject: [PATCH 1/3] 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); } /// From 4c7df5d5516538d2de43bde00bf5564cb667f7f4 Mon Sep 17 00:00:00 2001 From: gohjoseph Date: Mon, 21 Mar 2022 01:29:29 +0800 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cb2fd5b..0ab70189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes +* Fix `TSPlayer.GiveItem` not working if the player is in lava. (@gohjoseph) ## TShock 4.5.17 * Fixed duplicate characters (twins) after repeatedly logging in as the same character due to connection not being immediately closed during `NetHooks_NameCollision`. (@gohjoseph) From 5b7ecd344da01745f456363826f6621ce9f08253 Mon Sep 17 00:00:00 2001 From: gohjoseph Date: Mon, 21 Mar 2022 01:38:15 +0800 Subject: [PATCH 3/3] Fix "Fixed" typo in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab70189..6eb544ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes -* Fix `TSPlayer.GiveItem` not working if the player is in lava. (@gohjoseph) +* Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@gohjoseph) ## TShock 4.5.17 * Fixed duplicate characters (twins) after repeatedly logging in as the same character due to connection not being immediately closed during `NetHooks_NameCollision`. (@gohjoseph)