Search in sources :

Example 1 with BossSpawningItem

use of net.tslat.aoa3.item.misc.summon.BossSpawningItem in project Advent-Of-Ascension by Tslat.

the class EntityBossItem method onUpdate.

@Override
public void onUpdate() {
    super.onUpdate();
    if (lifespan == 6000)
        return;
    if (!world.isRemote && (player == null || !(getItem().getItem() instanceof BossSpawningItem))) {
        setDead();
        return;
    }
    BossSpawningItem bossItem = (BossSpawningItem) getItem().getItem();
    if (!world.isRemote) {
        if (ticksExisted == lifespan) {
            if (bossItem.canSpawnHere(world, player, posX, posY, posZ)) {
                bossItem.spawnBoss(world, player, posX, posY, posZ);
                setDead();
            } else {
                lifespan = 6000;
                isDead = false;
            }
        }
        return;
    }
    if (ticksExisted < lifespan)
        bossItem.handleTimerParticles(this, posX, posY, posZ, lifespan, ticksExisted);
}
Also used : BossSpawningItem(net.tslat.aoa3.item.misc.summon.BossSpawningItem)

Example 2 with BossSpawningItem

use of net.tslat.aoa3.item.misc.summon.BossSpawningItem in project Advent-Of-Ascension by Tslat.

the class PlayerEvents method onItemToss.

@SubscribeEvent
public void onItemToss(final ItemTossEvent ev) {
    World world = ev.getPlayer().getEntityWorld();
    if (!world.isRemote) {
        EntityItem entityItem = ev.getEntityItem();
        Item item = entityItem.getItem().getItem();
        if (item == ItemRegister.BLANK_REALMSTONE) {
            if (entityItem.isInLava())
                ItemUtil.givePlayerItemOrDrop(ev.getPlayer(), new ItemStack(ItemRegister.NETHER_REALMSTONE));
        } else if (item instanceof BossSpawningItem) {
            if (world.getDifficulty() == EnumDifficulty.PEACEFUL) {
                PlayerUtil.getAdventPlayer(ev.getPlayer()).sendThrottledChatMessage("message.feedback.spawnBoss.difficultyFail");
                return;
            }
            ev.setCanceled(true);
            world.spawnEntity(EntityUtil.newBossEntityItemFromExisting(entityItem, ev.getPlayer()));
            BossSpawningItem bossItem = (BossSpawningItem) item;
            if (bossItem.getThrowingSound() != null)
                world.playSound(null, entityItem.posX, entityItem.posY, entityItem.posZ, bossItem.getThrowingSound(), SoundCategory.PLAYERS, 1.0f, 1.0f);
        }
    }
}
Also used : Item(net.minecraft.item.Item) BossSpawningItem(net.tslat.aoa3.item.misc.summon.BossSpawningItem) EntityItem(net.minecraft.entity.item.EntityItem) ReservedItem(net.tslat.aoa3.item.misc.ReservedItem) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem) BossSpawningItem(net.tslat.aoa3.item.misc.summon.BossSpawningItem) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

BossSpawningItem (net.tslat.aoa3.item.misc.summon.BossSpawningItem)2 EntityItem (net.minecraft.entity.item.EntityItem)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 World (net.minecraft.world.World)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 ReservedItem (net.tslat.aoa3.item.misc.ReservedItem)1