From 2fda8ed5d36b7f115ae8030abf3c17c652aa6994 Mon Sep 17 00:00:00 2001 From: Kalobi <46748261+Kalobi@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:39:49 +0200 Subject: [PATCH] Fix broken Tileset indexer properties --- Celeste.Mod.mm/Patches/Monocle/Tileset.cs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Celeste.Mod.mm/Patches/Monocle/Tileset.cs b/Celeste.Mod.mm/Patches/Monocle/Tileset.cs index 8f2714355..af173e605 100644 --- a/Celeste.Mod.mm/Patches/Monocle/Tileset.cs +++ b/Celeste.Mod.mm/Patches/Monocle/Tileset.cs @@ -12,21 +12,16 @@ public class patch_Tileset : Tileset { [MonoModIgnore] public patch_Tileset(MTexture texture, int tileWidth, int tileHeight) : base(texture, tileWidth, tileHeight) {} + + // patch compiler generated methods directly to circumvent MonoMod issue with patching properties with identical names + [MonoModReplace] + public MTexture get_Item(int x, int y) => tiles[x % tiles.GetLength(0), y % tiles.GetLength(1)]; - public new MTexture this[int x, int y] { - [MonoModReplace] - get { - return tiles[x % tiles.GetLength(0), y % tiles.GetLength(1)]; - } - } - - public new MTexture this[int index] { - [MonoModReplace] - get { - if (index < 0) - return null; - return tiles[index % tiles.GetLength(0), (index / tiles.GetLength(0)) % tiles.GetLength(1)]; - } + [MonoModReplace] + public MTexture get_Item(int index) { + if (index < 0) + return null; + return tiles[index % tiles.GetLength(0), (index / tiles.GetLength(0)) % tiles.GetLength(1)]; } } }