From 45c6ebcde48682a57efda9445149bfb928170b79 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Tue, 22 Oct 2024 02:51:04 +0900 Subject: [PATCH] Handle TileFrame boundary --- Core/Plugin.cs | 2 +- Core/WorldGen.cs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/Plugin.cs b/Core/Plugin.cs index 743d95b..08eef6b 100644 --- a/Core/Plugin.cs +++ b/Core/Plugin.cs @@ -423,7 +423,7 @@ private void PostTShockInitialize() { if (!Terraria.Program.LaunchParameters.TryAdd("-ip", System.Net.IPAddress.IPv6Any.ToString())) { - TShockAPI.TShock.Log.Warn("Listening on existing address, IPv6 dual-stack disabled."); + TShockAPI.TShock.Log.Warn("Listening on existing address, attempts to enable IPv6 dual-stack without -ip."); } } } diff --git a/Core/WorldGen.cs b/Core/WorldGen.cs index bac62a0..092fd82 100644 --- a/Core/WorldGen.cs +++ b/Core/WorldGen.cs @@ -157,12 +157,15 @@ private void MMHook_WorldGen_KillTile(On.Terraria.WorldGen.orig_KillTile orig, i private void MMHook_WorldGen_TileFrame(On.Terraria.WorldGen.orig_TileFrame orig, int i, int j, bool resetFrame, bool noBreak) { - var pos = (((ulong) i) << 32) | ((uint) j); + if (i <= 5 || j <= 5 || i >= Terraria.Main.maxTilesX - 5 || j >= Terraria.Main.maxTilesY - 5) + { + return; + } var type = Terraria.Main.tile[i, j].type; orig.Invoke(i, j, resetFrame, noBreak); if (type != Terraria.Main.tile[i, j].type && this.config.Mitigation.Value.RecursiveTileBreak.Value && !this._pendingTileFrame.Contains(pos)) { - this._pendingTileFrame.Add(pos); + this._pendingTileFrame.Add((((ulong) i) << 32) | ((uint) j)); } } } \ No newline at end of file