Advertisement
jipthechip

Mixins: @Shadow method from superclass example

Dec 18th, 2020
2,545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. @Mixin(LivingEntity.class)
  2. public abstract class LivingEntityMixin{
  3.     @Shadow public abstract boolean hasStatusEffect(StatusEffect effect);
  4.     @Shadow public abstract StatusEffectInstance getStatusEffect(StatusEffect effect);
  5. }
  6.  
  7. @Mixin(ClientPlayerEntity.class)
  8. public abstract class ClientPlayerEntityMixin extends LivingEntityMixin{
  9.  
  10.     @Inject(method = "updateNausea()V", at = @At(value = "TAIL"))
  11.     private void injection(CallbackInfo ci){
  12.         if (this.hasStatusEffect(StatusEffects.NAUSEA) && this.getStatusEffect(StatusEffects.NAUSEA).getDuration() > 60) {
  13.             // do something
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement