Search in sources :

Example 16 with EntityXPOrb

use of net.minecraft.entity.item.EntityXPOrb in project MorePlanets by SteveKunG.

the class EntityInfectedCrystallizeSlimeBoss method onDeathUpdate.

@Override
protected void onDeathUpdate() {
    ++this.deathTicks;
    if (this.deathTicks >= 180 && this.deathTicks <= 200) {
        float f = (this.rand.nextFloat() - 0.5F) * 1.5F;
        float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F;
        float f2 = (this.rand.nextFloat() - 0.5F) * 1.5F;
        this.world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + f, this.posY + 2.0D + f1, this.posZ + f2, 0.0D, 0.0D, 0.0D);
    }
    int i;
    int j;
    if (!this.world.isRemote) {
        if (this.deathTicks >= 180 && this.deathTicks % 5 == 0) {
            GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_EXPLODE, GCCoreUtil.getDimensionID(this.world), new Object[] {}), new TargetPoint(GCCoreUtil.getDimensionID(this.world), this.posX, this.posY, this.posZ, 40.0D));
        }
        if (this.deathTicks > 150 && this.deathTicks % 5 == 0) {
            i = 120;
            while (i > 0) {
                j = EntityXPOrb.getXPSplit(i);
                i -= j;
                this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j));
            }
        }
        if (this.deathTicks == 40) {
            GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_BOSS_DEATH, GCCoreUtil.getDimensionID(this.world), new Object[] { this.getSoundPitch() - 0.1F }), new TargetPoint(GCCoreUtil.getDimensionID(this.world), this.posX, this.posY, this.posZ, 40.0D));
        }
    }
    if (this.deathTicks == 200 && !this.world.isRemote) {
        i = 120;
        while (i > 0) {
            j = EntityXPOrb.getXPSplit(i);
            i -= j;
            this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j));
        }
        TileEntityTreasureChestMP chest = null;
        if (this.spawner != null && this.spawner.getChestPos() != null) {
            TileEntity chestTest = this.world.getTileEntity(this.spawner.getChestPos());
            if (chestTest != null && chestTest instanceof TileEntityTreasureChestMP) {
                chest = (TileEntityTreasureChestMP) chestTest;
            }
        }
        if (chest == null) {
            chest = TileEntityTreasureChestMP.findClosest(this, 4);
        } else {
            double dist = this.getDistanceSq(chest.getPos().getX() + 0.5, chest.getPos().getY() + 0.5, chest.getPos().getZ() + 0.5);
            if (dist < 1000 * 1000) {
                if (!chest.locked) {
                    chest.locked = true;
                }
                int slot = this.rand.nextInt(chest.getSizeInventory());
                chest.setLootTable(MPLootTables.COMMON_SPACE_DUNGEON, this.rand.nextLong());
                chest.setInventorySlotContents(slot, MPLootTables.getTieredKey(this.rand, 4));
            }
        }
        this.entityDropItem(new ItemStack(DionaItems.DIONA_DUNGEON_KEY, 1, 0), 0.5F);
        this.setDead();
        if (this.spawner != null) {
            this.spawner.isBossDefeated = true;
            this.spawner.boss = null;
            this.spawner.spawned = false;
        }
    }
}
Also used : TileEntityTreasureChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityTreasureChestMP) TileEntity(net.minecraft.tileentity.TileEntity) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) ItemStack(net.minecraft.item.ItemStack) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Aggregations

EntityXPOrb (net.minecraft.entity.item.EntityXPOrb)16 EntityItem (net.minecraft.entity.item.EntityItem)6 ItemStack (net.minecraft.item.ItemStack)5 TileEntity (net.minecraft.tileentity.TileEntity)5 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)4 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)4 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 TileEntityTreasureChestMP (stevekung.mods.moreplanets.util.tileentity.TileEntityTreasureChestMP)3 EntityLiving (net.minecraft.entity.EntityLiving)2 BlockPos (net.minecraft.util.math.BlockPos)2 World (net.minecraft.world.World)2 NotNull (org.jetbrains.annotations.NotNull)2 List (java.util.List)1 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 Entity (net.minecraft.entity.Entity)1 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1