Skip to content

Commit 9e48b83

Browse files
authored
Use reflection instead of DynData to eliminate race condition
1 parent a6ca53b commit 9e48b83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Entities/SpinnerBreakingBallVanilla.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Celeste.Mod.Entities;
22
using Microsoft.Xna.Framework;
33
using Monocle;
4-
using MonoMod.Utils;
54
using System.Reflection;
65

76
namespace Celeste.Mod.MaxHelpingHand.Entities {
@@ -12,6 +11,7 @@ namespace Celeste.Mod.MaxHelpingHand.Entities {
1211
public class SpinnerBreakingBallVanilla : SpinnerBreakingBallGeneric<CrystalStaticSpinner, CrystalColor> {
1312
private static MethodInfo crystalSpinnerGetHue = typeof(CrystalStaticSpinner).GetMethod("GetHue", BindingFlags.NonPublic | BindingFlags.Instance);
1413
private static FieldInfo spinnerIDField = typeof(CrystalStaticSpinner).GetField("ID", BindingFlags.NonPublic | BindingFlags.Instance);
14+
private static FieldInfo spinnerColorField = typeof(CrystalStaticSpinner).GetField("color", BindingFlags.NonPublic | BindingFlags.Instance);
1515

1616
private CrystalStaticSpinner rainbowSpinner;
1717
private bool rainbowTinting;
@@ -52,7 +52,7 @@ protected override int getID(CrystalStaticSpinner spinner) {
5252
}
5353

5454
protected override CrystalColor getColor(CrystalStaticSpinner spinner) {
55-
return new DynData<CrystalStaticSpinner>(spinner).Get<CrystalColor>("color");
55+
return (CrystalColor) spinnerColorField.GetValue(spinner);
5656
}
5757

5858
protected override bool getAttachToSolid(CrystalStaticSpinner spinner) {

0 commit comments

Comments
 (0)