Search in sources :

Example 1 with AdjudicatorMimicEntity

use of party.lemons.biomemakeover.entity.adjudicator.AdjudicatorMimicEntity in project Biome-Makeover by Lemonszz.

the class MimicPhase method onEnterPhase.

@Override
public void onEnterPhase() {
    super.onEnterPhase();
    List<BlockPos> setPositions = Lists.newArrayList();
    int mimicCount = RandomUtil.randomRange(3, 6);
    for (int i = 0; i < mimicCount; i++) {
        BlockPos spawnPos;
        do {
            spawnPos = adjudicator.findSuitableArenaPos();
        } while (setPositions.contains(spawnPos));
        setPositions.add(spawnPos);
        if (world.getBlockState(spawnPos.down()).isAir())
            world.setBlockState(spawnPos.down(), Blocks.COBBLESTONE.getDefaultState());
        AdjudicatorMimicEntity mimic = BMEntities.ADJUDICATOR_MIMIC.create(world);
        ((LootBlocker) mimic).setLootBlocked(true);
        mimic.initialize((ServerWorldAccess) world, world.getLocalDifficulty(spawnPos), SpawnReason.NATURAL, null, null);
        mimic.refreshPositionAndAngles(spawnPos.getX() + 0.5F, spawnPos.getY(), spawnPos.getZ() + 0.5F, 0, 0);
        world.spawnEntity(mimic);
        adjudicator.clearArea(mimic);
        NetworkUtil.doEnderParticles(world, mimic, 10);
    }
    NetworkUtil.doEnderParticles(world, adjudicator, 10);
}
Also used : AdjudicatorMimicEntity(party.lemons.biomemakeover.entity.adjudicator.AdjudicatorMimicEntity) LootBlocker(party.lemons.biomemakeover.util.extensions.LootBlocker) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 AdjudicatorMimicEntity (party.lemons.biomemakeover.entity.adjudicator.AdjudicatorMimicEntity)1 LootBlocker (party.lemons.biomemakeover.util.extensions.LootBlocker)1