Search in sources :

Example 1 with ServerWorldAccess

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);
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) LootBlocker(party.lemons.biomemakeover.util.extensions.LootBlocker) ServerWorldAccess(net.minecraft.world.ServerWorldAccess) EvokerEntity(net.minecraft.entity.mob.EvokerEntity) BlockPos(net.minecraft.util.math.BlockPos) MobEntity(net.minecraft.entity.mob.MobEntity)

Aggregations

LivingEntity (net.minecraft.entity.LivingEntity)1 EvokerEntity (net.minecraft.entity.mob.EvokerEntity)1 MobEntity (net.minecraft.entity.mob.MobEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 ServerWorldAccess (net.minecraft.world.ServerWorldAccess)1 LootBlocker (party.lemons.biomemakeover.util.extensions.LootBlocker)1