I am trying to spawn my custom entity in a nether fortresses.
What I tried so far is using the WorldEvent.PotentialSpawns event, but that did not really work out
My code so far
@SubscribeEvent
public void onFeatureRegistry(final WorldEvent.PotentialSpawns event) {
if (event.getType() == EntityClassification.MONSTER) {
boolean isFortress = ((ServerWorld) event.getWorld()).structureFeatureManager()
.getStructureAt(event.getPos(), true, Structure.NETHER_BRIDGE).isValid();
boolean isNetherBrick = event.getWorld().getBlockState(event.getPos().below())
.getBlock() == Blocks.NETHER_BRICKS;
if (isFortress && isNetherBrick) {
Main.LOGGER.info("ADDED " + event.getPos().toShortString());
event.getList().add(new Spawners(ModEntityTypes.NETHER_KNIGHT_ENTITY.get(), 50, 5, 5));
}
}
}
the conditions are definitely met, because my log message is triggered when I am near a fortress, but my mob does not spawn.
Even with a higher item weight for the Spawners it does not work.