Identity

Identity

3M Downloads

iron golem

BoniH1908 opened this issue ยท 2 comments

commented

the iron golem can regenarate infinitly and gets unlimited hearts

commented

@Draylar , I'm trying to solve this issue but confused about some of the code.

Why do we need to modify maxHealth since it's already modified in IdentityComponent.java? I tried to remove this inject and the problem was solved. But I'm unsure what it does.

@Inject(
method = "getMaxHealth",
at = @At("HEAD"),
cancellable = true
)
private void modifyMaxHealth(CallbackInfoReturnable<Float> cir) {
if (Identity.CONFIG.scalingHealth) {
if ((Object) this instanceof PlayerEntity) {
LivingEntity identity = Components.CURRENT_IDENTITY.get(this).getIdentity();
if (identity != null) {
cir.setReturnValue(identity.getMaxHealth());
}
}
}
}

commented

Thanks for the info Allan - no idea why it was like that, but the issue should be fixed now! <3