11package wearblackallday .dimthread .mixin ;
22
3+ import net .minecraft .entity .Entity ;
4+ import net .minecraft .entity .FallingBlockEntity ;
5+ import net .minecraft .server .world .ServerWorld ;
36import org .spongepowered .asm .mixin .Final ;
47import org .spongepowered .asm .mixin .Mixin ;
58import org .spongepowered .asm .mixin .Shadow ;
69import org .spongepowered .asm .mixin .injection .At ;
710import org .spongepowered .asm .mixin .injection .Inject ;
811import org .spongepowered .asm .mixin .injection .Redirect ;
912import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
10-
11- import net .minecraft .entity .Entity ;
12- import net .minecraft .entity .FallingBlockEntity ;
13- import net .minecraft .server .world .ServerWorld ;
1413import wearblackallday .dimthread .DimThread ;
1514
1615@ Mixin (Entity .class )
@@ -22,6 +21,8 @@ public abstract class EntityMixin {
2221
2322 @ Shadow private Entity .RemovalReason removalReason ;
2423
24+ private boolean duped = false ;
25+
2526 /**
2627 * Schedules moving entities between dimensions to the server thread. Once all
2728 * the world finish ticking, {@code moveToWorld()} is processed in a safe manner
@@ -49,7 +50,12 @@ public void moveToWorld(ServerWorld destination, CallbackInfoReturnable<Entity>
4950 @ Redirect (method = "moveToWorld" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/entity/Entity;isRemoved()Z" ))
5051 public final boolean forceNotRemoved (Entity entity ) {
5152 Entity .RemovalReason reason = this .removalReason ;
52- if ((((Object ) this ) instanceof FallingBlockEntity ) && (reason == Entity .RemovalReason .DISCARDED )) {
53+ if (
54+ (Entity ) (Object ) this instanceof FallingBlockEntity &&
55+ reason == Entity .RemovalReason .DISCARDED &&
56+ !duped
57+ ) {
58+ duped = true ;
5359 return false ;
5460 }
5561 return entity .isRemoved ();
0 commit comments