use of party.lemons.biomemakeover.util.access.SlimeEntityAccess in project Biome-Makeover by Lemonszz.
the class GiantSlimeEntity method remove.
public void remove() {
int size = this.getSize();
if (!this.world.isClient && size > 1 && this.isDead()) {
Text text = this.getCustomName();
boolean hasDisabledAI = this.isAiDisabled();
DecayedEntity decayed = BMEntities.DECAYED.create(this.world);
if (this.isPersistent()) {
decayed.setPersistent();
}
decayed.equipStack(EquipmentSlot.MAINHAND, new ItemStack(Items.AIR));
decayed.equipStack(EquipmentSlot.OFFHAND, new ItemStack(Items.AIR));
decayed.setCustomName(text);
decayed.setAiDisabled(hasDisabledAI);
decayed.setInvulnerable(this.isInvulnerable());
decayed.refreshPositionAndAngles(this.getX(), this.getY() + 0.5D, this.getZ(), yaw, pitch);
this.world.spawnEntity(decayed);
}
if (!this.world.isClient && size > 1 && this.isDead()) {
Text text = this.getCustomName();
boolean bl = this.isAiDisabled();
float quarterSize = (float) size / 4.0F;
int halfSize = size / 2;
int count = 2 + this.random.nextInt(3);
for (int in = 0; in < count; ++in) {
float offsetX = ((float) (in % 2) - 0.5F) * quarterSize;
float offsetY = ((float) (in / 2) - 0.5F) * quarterSize;
SlimeEntity slimeEntity = EntityType.SLIME.create(this.world);
if (this.isPersistent()) {
slimeEntity.setPersistent();
}
slimeEntity.setCustomName(text);
slimeEntity.setAiDisabled(bl);
slimeEntity.setInvulnerable(this.isInvulnerable());
((SlimeEntityAccess) slimeEntity).bm_setSlimeSize(halfSize, true);
slimeEntity.refreshPositionAndAngles(this.getX() + (double) offsetX, this.getY() + 0.5D, this.getZ() + (double) offsetY, this.random.nextFloat() * 360.0F, 0.0F);
this.world.spawnEntity(slimeEntity);
}
}
this.removed = true;
}
Aggregations