mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-27 23:29:58 -04:00
Fix nether portal crash (#1256)
* Correct ordinal of `afterWorldChanged` mixin to the correct return Co-authored-by: i509VCB <git@i509.me> * Handle null entity when unable to be created * Comply with Checkstyle * Remove redundant ordinal and only use null return to check valid teleports Co-authored-by: Player <player@player.to> Co-authored-by: i509VCB <git@i509.me> Co-authored-by: Player <player@player.to>
This commit is contained in:
parent
36111fa0e1
commit
c7d5c83208
1 changed files with 7 additions and 2 deletions
|
@ -33,8 +33,13 @@ abstract class EntityMixin {
|
|||
@Shadow
|
||||
public World world;
|
||||
|
||||
@Inject(method = "moveToWorld", at = @At(value = "RETURN", ordinal = 1))
|
||||
@Inject(method = "moveToWorld", at = @At("RETURN"))
|
||||
private void afterWorldChanged(ServerWorld destination, CallbackInfoReturnable<Entity> cir) {
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, cir.getReturnValue(), (ServerWorld) this.world, (ServerWorld) cir.getReturnValue().world);
|
||||
// Ret will only have an entity if the teleport worked (entity not removed, teleportTarget was valid, entity was successfully created)
|
||||
Entity ret = cir.getReturnValue();
|
||||
|
||||
if (ret != null) {
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, ret, (ServerWorld) this.world, (ServerWorld) ret.world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue