Search in sources :

Example 1 with TileEntityTreasureChestMP

use of stevekung.mods.moreplanets.util.tileentity.TileEntityTreasureChestMP in project MorePlanets by SteveKunG.

the class EntityMiniVeinFloater method onDeathUpdate.

@Override
protected void onDeathUpdate() {
    ++this.deathTicks;
    if (this.deathTicks >= 180 && this.deathTicks <= 200) {
        float f = (this.rand.nextFloat() - 0.5F) * 5.5F;
        float f1 = (this.rand.nextFloat() - 0.5F) * 28.0F;
        float f2 = (this.rand.nextFloat() - 0.5F) * 5.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 = 200;
            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 = 200;
        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, 6);
        }
        if (chest != null) {
            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, 5));
            }
        }
        this.entityDropItem(new ItemStack(NibiruItems.NIBIRU_DUNGEON_KEY, 1, this.rand.nextBoolean() ? 1 : 2), 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)

Example 2 with TileEntityTreasureChestMP

use of stevekung.mods.moreplanets.util.tileentity.TileEntityTreasureChestMP in project MorePlanets by SteveKunG.

the class EntityCheeseCubeEyeBoss 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 = 150;
            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));
        }
    }
    this.move(MoverType.SELF, 0.0D, -0.10000000149011612D, 0.0D);
    if (this.deathTicks == 200 && !this.world.isRemote) {
        i = 150;
        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, 5);
        }
        if (chest != null) {
            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, 5));
            }
        }
        this.entityDropItem(new ItemStack(ChalosItems.CHALOS_DUNGEON_KEY, 1, 0), 0.5F);
        super.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)

Example 3 with TileEntityTreasureChestMP

use of stevekung.mods.moreplanets.util.tileentity.TileEntityTreasureChestMP 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

PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)3 EntityXPOrb (net.minecraft.entity.item.EntityXPOrb)3 ItemStack (net.minecraft.item.ItemStack)3 TileEntity (net.minecraft.tileentity.TileEntity)3 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)3 TileEntityTreasureChestMP (stevekung.mods.moreplanets.util.tileentity.TileEntityTreasureChestMP)3