Skip to content

Commit

Permalink
Fixed a bug where more crystals would spawn too low
Browse files Browse the repository at this point in the history
  • Loading branch information
Insane96 committed Dec 22, 2020
1 parent 821d5d8 commit 119a6cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,18 @@ private static void moreCrystals(EnderDragonEntity dragon, float killedCount) {

for (EnderCrystalEntity crystal : crystals) {
BlockPos crystalPos = new BlockPos(crystal.getPosX(), crystal.getPosY() - 16, crystal.getPosZ());
if (crystalPos.getY() < centerPodium.getY())
crystalPos = new BlockPos(crystalPos.getX(), centerPodium.getY(), crystalPos.getZ());

Stream<BlockPos> blocks = BlockPos.getAllInBox(crystalPos.add(-1, -1, -1), crystalPos.add(1, 1, 1));

blocks.forEach(pos -> dragon.world.setBlockState(pos, Blocks.AIR.getDefaultState()));
dragon.world.setBlockState(crystalPos.add(0, -1, 0), Blocks.OBSIDIAN.getDefaultState());
dragon.world.setBlockState(crystalPos.add(0, -1, 0), Blocks.BEDROCK.getDefaultState());

dragon.world.createExplosion(dragon, crystalPos.getX() + .5f, crystalPos.getY(), crystalPos.getZ() + .5, 5f, Explosion.Mode.DESTROY);

EnderCrystalEntity newCrystal = new EnderCrystalEntity(dragon.world, crystalPos.getX() + .5, crystalPos.getY(), crystalPos.getZ() + .5);
newCrystal.setShowBottom(false);
//newCrystal.setShowBottom(false);
dragon.world.addEntity(newCrystal);

crystalSpawned++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ private static void spawnSkeletons(WitherEntity wither, World world) {
}
}

private static final Predicate<LivingEntity> NOT_UNDEAD = livingEntity -> livingEntity instanceof LivingEntity && livingEntity.getCreatureAttribute() != CreatureAttribute.UNDEAD && livingEntity.attackable();
private static final Predicate<LivingEntity> NOT_UNDEAD = livingEntity -> livingEntity != null && livingEntity.getCreatureAttribute() != CreatureAttribute.UNDEAD && livingEntity.attackable();

/*
* Check if the mob has space to spawn and if sits on solid ground
Expand Down

0 comments on commit 119a6cb

Please sign in to comment.