Jump to content

Recommended Posts

Posted

Hey guys, I'm working on a mod with a water entity, that's supposed to spawn in the water. For some reason, it doesn't spawn when adding a SpawnListEntry. I can spawn it using the eggs or using /summon but it won't spawn naturally. Did they change anything about the spawnlist registry or something? Please help me :) Here's my code 

@SubscribeEvent
	public void registerEntityType(RegistryEvent.Register<EntityType<?>> event) {
		event.getRegistry().register(AXOLOTL_ENTITY);
		event.getRegistry().register(GOLDEN_AXOLOTL_ENTITY);
		RenderingRegistry.registerEntityRenderingHandler(AXOLOTL_ENTITY, new AxolotlRender.RenderFactory());
		RenderingRegistry.registerEntityRenderingHandler(GOLDEN_AXOLOTL_ENTITY,
				new GoldenAxolotlRender.RenderFactory());
		registerEntityWorldSpawn(AXOLOTL_ENTITY, 1, Biomes.OCEAN, Biomes.WARM_OCEAN, Biomes.DEEP_WARM_OCEAN,
				Biomes.DEEP_OCEAN, Biomes.RIVER, Biomes.LUKEWARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN);
		registerEntityWorldSpawn(GOLDEN_AXOLOTL_ENTITY, 2, Biomes.OCEAN, Biomes.WARM_OCEAN, Biomes.DEEP_WARM_OCEAN,
				Biomes.DEEP_OCEAN, Biomes.RIVER);
	}

	public static void registerEntityWorldSpawn(EntityType<?> entity, int weight, Biome... biomes) {
		for (Biome biome : biomes) {
			if (biome != null) {
				biome.getSpawns(entity.getClassification()).add(new SpawnListEntry(entity, weight, 1, 100));
			}
		}
	}

 

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.