Skip to content

Commit 9ffb6b9

Browse files
committed
fix MC-44654 (thanks Microcontrollers #474)
1 parent dae8dec commit 9ffb6b9

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.bugs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ patched 272431 server basic
106106
patched 298066 server basic
107107
patched 263999 server basic
108108
patched 153010 server basic
109+
patched 44654 server basic
109110

110111
previous 2025 17w47a
111112
previous 53312 22w17a
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package dev.isxander.debugify.mixins.basic.mc44654;
2+
3+
import dev.isxander.debugify.fixes.BugFix;
4+
import dev.isxander.debugify.fixes.FixCategory;
5+
import net.minecraft.world.entity.Entity;
6+
import net.minecraft.world.entity.EntityType;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.Shadow;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12+
13+
@BugFix(id = "MC-44654", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "Some entities don't update position to the client when teleported")
14+
@Mixin(Entity.class)
15+
public abstract class EntityMixin {
16+
@Shadow
17+
public abstract EntityType<?> getType();
18+
19+
@Shadow
20+
public boolean hasImpulse;
21+
22+
/**
23+
* Since the update interval is set to infinity, the position will never get updated.
24+
* To fix, we mark velocity as dirty via hasImpulse to force an update.
25+
*
26+
* We inject precisely here as the target is only called when `!firstTick && isServerLevel`,
27+
* since this is where the issue occurs.
28+
*/
29+
@Inject(method = "setPosRaw", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;isRemoved()Z"))
30+
private void forceClientUpdate(CallbackInfo ci) {
31+
if (this.getType().updateInterval() == Integer.MAX_VALUE) {
32+
this.hasImpulse = true;
33+
}
34+
}
35+
}

src/main/resources/debugify.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"basic.mc297837.WaypointTransmitterMixin",
6161
"basic.mc298066.LivingEntityMixin",
6262
"basic.mc30391.LivingEntityMixin",
63+
"basic.mc44654.EntityMixin",
6364
"basic.mc7569.RconConsoleSourceMixin",
6465
"basic.mc82263.EnderDragonMixin",
6566
"basic.mc84661.MobEffectsMixin",

0 commit comments

Comments
 (0)