use of net.minecraft.world.ServerWorldAccess in project Biome-Makeover by Lemonszz.
the class SummonPhase method spawnEntity.
protected void spawnEntity() {
BlockPos spawnPos = spawnPositions[spawnIndex];
if (world.getBlockState(spawnPos.down()).isAir())
world.setBlockState(spawnPos.down(), Blocks.COBBLESTONE.getDefaultState());
LivingEntity entity = entities[random.nextInt(entities.length)].create(world);
if (entity instanceof MobEntity)
((MobEntity) entity).initialize((ServerWorldAccess) world, world.getLocalDifficulty(spawnPos), SpawnReason.EVENT, null, null);
((LootBlocker) entity).setLootBlocked(true);
entity.refreshPositionAndAngles((double) spawnPos.getX() + 0.5D, (double) spawnPos.getY(), (double) spawnPos.getZ() + 0.5D, 0.0F, 0.0F);
world.spawnEntity(entity);
adjudicator.clearArea(entity);
if (entity instanceof EvokerEntity) {
GoalSelectorExtension.removeGoal((MobEntity) entity, EvokerEntity.SummonVexGoal.class);
}
world.playSound(null, spawnPos, SoundEvents.ENTITY_EVOKER_CAST_SPELL, SoundCategory.HOSTILE, 10F, 1F);
}
Aggregations