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);
}
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);
}
}
}
Aggregations