1.17 implement changing entity attributes when tamed

This commit is contained in:
SeanOMik 2021-06-23 19:45:47 -04:00
parent 01efec4092
commit d2b586feea
No known key found for this signature in database
GPG Key ID: CA09E5BE1F32728A
1 changed files with 14 additions and 15 deletions

View File

@ -11,6 +11,7 @@ import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult; import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*; import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.GenericAttributes;
import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.goal.*;
import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget; import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget;
import net.minecraft.world.entity.animal.*; import net.minecraft.world.entity.animal.*;
@ -76,16 +77,15 @@ public class EntityTamableFox extends EntityFox {
public EntityTamableFox(EntityTypes<? extends EntityFox> entitytypes, World world) { public EntityTamableFox(EntityTypes<? extends EntityFox> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
System.out.println("Set default attributes"); this.getAttributeInstance(GenericAttributes.d).setValue(0.33000001192092896D); // Set movement speed
/*this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.33000001192092896D);
if (isTamed()) { if (isTamed()) {
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(24.0D); this.getAttributeInstance(GenericAttributes.a).setValue(24.0D); // Set max health
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(3.0D); this.getAttributeInstance(GenericAttributes.f).setValue(3.0D); // Set attack damage
this.setHealth(this.getMaxHealth()); this.setHealth(this.getMaxHealth());
} else { } else {
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(10.0D); this.getAttributeInstance(GenericAttributes.a).setValue(10.0D); // Set max health
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D); this.getAttributeInstance(GenericAttributes.f).setValue(2.0D); // Set attack damage
}*/ }
} }
@Override @Override
@ -275,15 +275,14 @@ public class EntityTamableFox extends EntityFox {
} }
this.reassessTameGoals(); this.reassessTameGoals();
System.out.println("setTamed set attributes"); if (tamed_) {
/*if (tamed_) { this.getAttributeInstance(GenericAttributes.a).setValue(24.0D); // Set max health
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(24.0D); this.getAttributeInstance(GenericAttributes.f).setValue(3.0D); // Set attack damage
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(3.0D);
this.setHealth(this.getMaxHealth());
} else { } else {
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(10.0D); this.getAttributeInstance(GenericAttributes.a).setValue(10.0D); // Set max health
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D); this.getAttributeInstance(GenericAttributes.f).setValue(2.0D); // Set attack damage
}*/ }
this.setHealth(this.getMaxHealth());
} }
// Remove untamed goals if its tamed. // Remove untamed goals if its tamed.