Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Feb 15, 2020
2 parents 45c14a5 + c318007 commit d10b8cf
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.minecraft.client.render.entity.feature.SkinOverlayOwner;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.attribute.EntityAttributeInstance;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker;
Expand Down Expand Up @@ -283,8 +284,13 @@ public void tickMovement() {
if (this.ticksInSunlight >= MATURATION_TIME) {
CreeperEntity adult = new CreeperEntity(EntityType.CREEPER, world);
UUID adultUuid = adult.getUuid();
EntityAttributeInstance adultMaxHealth = adult.getAttributeInstance(EntityAttributes.MAX_HEALTH);
EntityAttributeInstance babyMaxHealth = this.getAttributeInstance(EntityAttributes.MAX_HEALTH);
int healthMultiplier = (int)adultMaxHealth.getValue() / (int)babyMaxHealth.getValue();
adult.fromTag(this.toTag(new CompoundTag()));
adult.setUuid(adultUuid);
adultMaxHealth.setBaseValue(adult.defaultMaximumHealth);
adult.setHealth(adult.getHealth() * healthMultiplier);
world.spawnEntity(adult);
pushOutOfBlocks(adult);
this.remove();
Expand Down

0 comments on commit d10b8cf

Please sign in to comment.