Closed suliman03 closed 1 year ago
Already figured it out. For those who wonder:
@Redirect(
method = "onCollision(Lnet/minecraft/util/hit/HitResult;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z"
)
)
private boolean onDamage(Entity entity, DamageSource damageSource, float damage) {
damage = 5;
if (entity instanceof ServerPlayerEntity) {
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity)entity;
if (serverPlayerEntity.getAttributeValue(MMGAEntityAttributes.ENDERMEN_IMMUNITY) < 1) {
entity.damage(this.getDamageSources().fall(), damage);
return true;
}
}
return false;
}
Hi, glad you figured out your question but for future questions please use the discord channel linked in the readme as this is an issue tracker.
I'm new to modding and Java Mixin and I'm trying to modify some code in the following method:
I would like to change the line
entity.damage(this.getDamageSources().fall(), 5.0f);
forif (bool) {entity.damage(this.getDamageSources().fall(), 5.0f)}
How can I do this? With@REDIRECT
?