Fix teleport/respawn across world NPE (#130 #133)

This commit is contained in:
IzzelAliz 2021-01-25 23:03:24 +08:00
parent 2185b6f1bc
commit d65b12ae78
2 changed files with 3 additions and 6 deletions

View File

@ -393,8 +393,10 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
at = @At(value = "FIELD", shift = At.Shift.AFTER, target = "Lnet/minecraft/network/play/ServerPlayNetHandler;targetPos:Lnet/minecraft/util/math/vector/Vector3d;"), at = @At(value = "FIELD", shift = At.Shift.AFTER, target = "Lnet/minecraft/network/play/ServerPlayNetHandler;targetPos:Lnet/minecraft/util/math/vector/Vector3d;"),
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/ServerPlayerEntity;isInvulnerableDimensionChange()Z"))) slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/ServerPlayerEntity;isInvulnerableDimensionChange()Z")))
private void arclight$updateLoc(CConfirmTeleportPacket packetIn, CallbackInfo ci) { private void arclight$updateLoc(CConfirmTeleportPacket packetIn, CallbackInfo ci) {
if (((ServerPlayerEntityBridge) this.player).bridge$isValid()) {
this.player.getServerWorld().getChunkProvider().updatePlayerPosition(this.player); this.player.getServerWorld().getChunkProvider().updatePlayerPosition(this.player);
} }
}
@Inject(method = "processConfirmTeleport", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/network/play/ServerPlayNetHandler;teleportId:I")) @Inject(method = "processConfirmTeleport", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/network/play/ServerPlayNetHandler;teleportId:I"))
private void arclight$confirm(CConfirmTeleportPacket packetIn, CallbackInfo ci) { private void arclight$confirm(CConfirmTeleportPacket packetIn, CallbackInfo ci) {

View File

@ -254,11 +254,6 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
} }
} }
@Inject(method = "removeEntityComplete", remap = false, at = @At("RETURN"))
public void arclight$invalidateEntity(Entity entityIn, boolean keepData, CallbackInfo ci) {
((EntityBridge) entityIn).bridge$setValid(false);
}
private transient boolean arclight$force; private transient boolean arclight$force;
@Redirect(method = "spawnParticle(Lnet/minecraft/particles/IParticleData;DDDIDDDD)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;sendPacketWithinDistance(Lnet/minecraft/entity/player/ServerPlayerEntity;ZDDDLnet/minecraft/network/IPacket;)Z")) @Redirect(method = "spawnParticle(Lnet/minecraft/particles/IParticleData;DDDIDDDD)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;sendPacketWithinDistance(Lnet/minecraft/entity/player/ServerPlayerEntity;ZDDDLnet/minecraft/network/IPacket;)Z"))