File tree 3 files changed +16
-1
lines changed
src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/desync
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,10 @@ public interface IPrevMotion
14
14
double getPrevMotionZ ();
15
15
16
16
void setPrevMotionZ (double prevMotionZ );
17
+
18
+ /**
19
+ * Checks if this entity has ever called super.onUpdate(). This should adequately determine if it should be ignored by the desync fix.
20
+ * @return true if the implementing class calls super.onUpdate()
21
+ */
22
+ boolean hasSuperUpdate ();
17
23
}
Original file line number Diff line number Diff line change @@ -36,6 +36,6 @@ public static void initBlacklistedEntityEntries()
36
36
37
37
public static boolean isBlacklisted (Entity entity )
38
38
{
39
- return blacklistedEntityEntries .contains (EntityRegistry .getEntry (entity .getClass ()));
39
+ return blacklistedEntityEntries .contains (EntityRegistry .getEntry (entity .getClass ())) || !((( IPrevMotion ) entity ). hasSuperUpdate ()) ;
40
40
}
41
41
}
Original file line number Diff line number Diff line change @@ -27,11 +27,14 @@ public class UTEntityMixin implements IPrevMotion
27
27
private double prevMotionY ;
28
28
@ Unique
29
29
private double prevMotionZ ;
30
+ @ Unique
31
+ private boolean universalTweaks$superUpdate = false ;
30
32
31
33
@ Inject (method = "onUpdate" , at = @ At ("HEAD" ))
32
34
public void utOnUpdate (CallbackInfo info )
33
35
{
34
36
if (UTEntityDesync .isBlacklisted (((Entity ) (Object ) this ))) return ;
37
+ if (!universalTweaks$superUpdate ) universalTweaks$superUpdate = true ;
35
38
prevMotionX = motionX ;
36
39
prevMotionY = motionY ;
37
40
prevMotionZ = motionZ ;
@@ -72,4 +75,10 @@ public void setPrevMotionZ(double prevMotionZ)
72
75
{
73
76
this .prevMotionZ = prevMotionZ ;
74
77
}
78
+
79
+ @ Override
80
+ public boolean hasSuperUpdate ()
81
+ {
82
+ return universalTweaks$superUpdate ;
83
+ }
75
84
}
You can’t perform that action at this time.
0 commit comments