Skip to content

Commit

Permalink
Workaround for shadowed fields from supermixins do not remap. (#1251)
Browse files Browse the repository at this point in the history
(cherry picked from commit 49c073f)
  • Loading branch information
i509VCB authored and modmuss50 committed Jan 1, 2021
1 parent ef5bb8b commit c55516d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
abstract class LivingEntityMixin extends EntityMixin {
@Inject(method = "onDeath", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onKilledOther(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/LivingEntity;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void onEntityKilledOther(DamageSource source, CallbackInfo ci, Entity attacker) {
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.invoker().afterKilledOtherEntity(((ServerWorld) this.world), attacker, (LivingEntity) (Object) this);
// FIXME: Cannot use shadowed fields from supermixins - needs a fix so people can use fabric api in a dev environment even though this is fine in this repo and prod.
// A temporary fix is to just cast the mixin to LivingEntity and access the world field with a few ugly casts.
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.invoker().afterKilledOtherEntity((ServerWorld) ((LivingEntity) (Object) this).world, attacker, (LivingEntity) (Object) this);
}
}

0 comments on commit c55516d

Please sign in to comment.