diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e3b404..522803c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added preliminary support for Terraria 1.4.4.5. (@drunderscore) * For clarity sake, we're listing the individual changes to Terraria's version, despite the fact that this version only supports the latest one. * Don't allow players to sync loadout index whilst disabled (@drunderscore) +* Fixed painting wall/tile being rejected from hand of creation. (@Rozen4334) ## TShock 4.5.18 * Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@gohjoseph) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index c7d11d92..4101e5d4 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3584,6 +3584,12 @@ namespace TShockAPI return false; } + private static bool HasPaintSprayerAbilities(Item item) + => item is not null && item.stack > 0 && ( + item.type == ItemID.PaintSprayer || + item.type == ItemID.ArchitectGizmoPack || + item.type == ItemID.HandOfCreation); + private static bool HandlePaintTile(GetDataHandlerArgs args) { var x = args.Data.ReadInt16(); @@ -3600,11 +3606,6 @@ namespace TShockAPI return true; } - bool hasPaintSprayerAbilities(Item item) => - item != null - && item.stack > 0 - && (item.type == ItemID.PaintSprayer || item.type == ItemID.ArchitectGizmoPack); - // Not selecting paintbrush or paint scraper or the spectre versions? Hacking. if (args.Player.SelectedItem.type != ItemID.PaintRoller && args.Player.SelectedItem.type != ItemID.PaintScraper && @@ -3612,8 +3613,8 @@ namespace TShockAPI args.Player.SelectedItem.type != ItemID.SpectrePaintRoller && args.Player.SelectedItem.type != ItemID.SpectrePaintScraper && args.Player.SelectedItem.type != ItemID.SpectrePaintbrush && - !args.Player.Accessories.Any(hasPaintSprayerAbilities) && - !args.Player.Inventory.Any(hasPaintSprayerAbilities)) + !args.Player.Accessories.Any(HasPaintSprayerAbilities) && + !args.Player.Inventory.Any(HasPaintSprayerAbilities)) { TShock.Log.ConsoleDebug("GetDataHandlers / HandlePaintTile rejected select consistency {0}", args.Player.Name); args.Player.SendData(PacketTypes.PaintTile, "", x, y, Main.tile[x, y].color()); @@ -3659,8 +3660,8 @@ namespace TShockAPI args.Player.SelectedItem.type != ItemID.SpectrePaintRoller && args.Player.SelectedItem.type != ItemID.SpectrePaintScraper && args.Player.SelectedItem.type != ItemID.SpectrePaintbrush && - !args.Player.Accessories.Any(i => i != null && i.stack > 0 && - (i.type == ItemID.PaintSprayer || i.type == ItemID.ArchitectGizmoPack))) + !args.Player.Accessories.Any(HasPaintSprayerAbilities) && + !args.Player.Inventory.Any(HasPaintSprayerAbilities)) { TShock.Log.ConsoleDebug("GetDataHandlers / HandlePaintWall rejected selector consistency {0}", args.Player.Name); args.Player.SendData(PacketTypes.PaintWall, "", x, y, Main.tile[x, y].wallColor());