Skip to content

Commit 923291e

Browse files
committed
I have no idea why this works
1 parent 472ff45 commit 923291e

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/main/java/wearblackallday/dimthread/mixin/EntityMixin.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package wearblackallday.dimthread.mixin;
22

3+
import net.minecraft.entity.Entity;
4+
import net.minecraft.entity.FallingBlockEntity;
5+
import net.minecraft.server.world.ServerWorld;
36
import org.spongepowered.asm.mixin.Final;
47
import org.spongepowered.asm.mixin.Mixin;
58
import org.spongepowered.asm.mixin.Shadow;
69
import org.spongepowered.asm.mixin.injection.At;
710
import org.spongepowered.asm.mixin.injection.Inject;
811
import org.spongepowered.asm.mixin.injection.Redirect;
912
import 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;
1413
import 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

Comments
 (0)