mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 03:10:54 -04:00
Workaround for shadowed fields from supermixins do not remap. (#1251)
This commit is contained in:
parent
cbe9176f9d
commit
49c073f9a3
1 changed files with 3 additions and 1 deletions
|
@ -33,6 +33,8 @@ import net.fabricmc.fabric.api.entity.event.v1.ServerEntityCombatEvents;
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue