use of net.minecraft.entity.mob.EvokerEntity in project Biome-Makeover by Lemonszz.
the class BMWorldEvents method init.
public static void init() {
DispenserBlock.registerBehavior(Items.CROSSBOW, new FallibleItemDispenserBehavior() {
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
BlockPos blockPos = pointer.getBlockPos().offset(pointer.getBlockState().get(DispenserBlock.FACING));
List<StoneGolemEntity> list = pointer.getWorld().getEntitiesByClass(StoneGolemEntity.class, new Box(blockPos), (golem) -> !golem.isHolding(Items.CROSSBOW) && golem.isPlayerCreated() && golem.isAlive());
if (!list.isEmpty()) {
list.get(0).equipStack(EquipmentSlot.MAINHAND, stack.copy());
stack.decrement(1);
this.setSuccess(true);
return stack;
} else {
return super.dispenseSilently(pointer, stack);
}
}
});
// Adjudicator Drop Illunite Shard
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.register((world, entity, killedEntity) -> {
if (!world.isClient() && entity instanceof PlayerEntity && killedEntity instanceof EvokerEntity) {
if (!LootBlocker.isBlocked(killedEntity)) {
if (world.random.nextFloat() < 0.15F) {
killedEntity.dropStack(new ItemStack(BMItems.ILLUNITE_SHARD, 1 + world.random.nextInt(2)));
}
}
}
});
}
use of net.minecraft.entity.mob.EvokerEntity 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