Jump to content

[Solved][1.16.5] Spawning entities in structures


Buecher_wurm

Recommended Posts

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.

Link to comment
Share on other sites

  • Buecher_wurm changed the title to [Solved][1.16.5] Spawning entities in structures

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.