Search in sources :

Example 1 with EntityVitalityGel

use of com.mraof.minestuck.entity.item.EntityVitalityGel in project Minestuck by mraof.

the class EntityUnderling method onDeathUpdate.

@Override
protected void onDeathUpdate() {
    super.onDeathUpdate();
    if (this.deathTime == 20 && !this.world.isRemote) {
        GristSet grist = this.getGristSpoils();
        if (fromSpawner)
            grist.scaleGrist(0.5F);
        if (!dropCandy) {
            for (GristAmount gristType : grist.getArray()) this.world.spawnEntity(new EntityGrist(world, randX(), this.posY, randZ(), gristType));
        } else {
            for (GristAmount gristType : grist.getArray()) {
                int candy = (gristType.getAmount() + 2) / 4;
                int gristAmount = gristType.getAmount() - candy * 2;
                if (candy > 0)
                    this.world.spawnEntity(new EntityItem(world, randX(), this.posY, randZ(), new ItemStack(MinestuckItems.candy, candy, gristType.getType().getId() + 1)));
                if (gristAmount > 0)
                    this.world.spawnEntity(new EntityGrist(world, randX(), this.posY, randZ(), new GristAmount(gristType.getType(), gristAmount)));
            }
        }
        if (this.rand.nextInt(4) == 0)
            this.world.spawnEntity(new EntityVitalityGel(world, randX(), this.posY, randZ(), this.getVitalityGel()));
    }
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) EntityGrist(com.mraof.minestuck.entity.item.EntityGrist) EntityVitalityGel(com.mraof.minestuck.entity.item.EntityVitalityGel) GristAmount(com.mraof.minestuck.util.GristAmount) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Aggregations

EntityGrist (com.mraof.minestuck.entity.item.EntityGrist)1 EntityVitalityGel (com.mraof.minestuck.entity.item.EntityVitalityGel)1 GristAmount (com.mraof.minestuck.util.GristAmount)1 GristSet (com.mraof.minestuck.util.GristSet)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ItemStack (net.minecraft.item.ItemStack)1