Jump to content

Recommended Posts

Posted

I'm currently trying to set a custom mob to spawn in a specific biome, and I've looked at a couple of reference mods to see if I've been missing anything, but my mob just somehow cannot spawn.

 

	@SubscribeEvent(priority = EventPriority.HIGH)
	public static void addBiomeSpawn(BiomeLoadingEvent event) {
		Biome biome = ForgeRegistries.BIOMES.getValue(event.getName());
		System.out.println(biome.toString());
		
		if (biome.toString().equals("minecraft:plains")) {
			System.out.println("Its been Added!");
			event.getSpawns().getSpawner(EntityClassification.CREATURE).add(new MobSpawnInfo.Spawners(BestiaryRegistry.SEAL, 100, 1, 3));
		}
	}

 

as far as I'm concerned this is the only thing that has to be done, and it appears that my mob has been added to the spawn list, but it just refuses to appear. I feel like I'm missing something really stupid here but I can't figure it out.

  • Like 1

width=700 height=100http://driesgames.game-server.cc//banner.png[/img]

Java, Hosting Servers and Videos...

Posted

I've been doing some research, and it appears that my spawn function for my mob is set to spawn only on ice, but under the Blocks class SPECIFICALLY Ice is set to only allow Polar Bears to spawn, so the spawn algorithm returns false for ice whenever it checks if the block is spawnable. I went ahead and tried to override the Minecraft version of Ice by copying the code and adding my own mob:

 

    public static final RegistryObject<Block> ICE = VANILLA_BLOCKS.register("ice", () ->
    		new IceBlock(AbstractBlock.Properties.create(Material.ICE)
    											 .slipperiness(0.98F)
    											 .tickRandomly()
    											 .hardnessAndResistance(0.5F)
    											 .sound(SoundType.GLASS)
    											 .notSolid()
    											 .setAllowsSpawn((state, reader, pos, entity) -> {
    												 return entity == EntityType.POLAR_BEAR || entity == BestiaryRegistry.SEAL;
    											 }))
    		);

 

And my mob now spawns properly, except now Ice has disappeared from the creative menu and cannot be picked with middle mouse button. Is there anyway I can fix this, or even better, override a Vanilla blocks property without having to recreate the block?

width=700 height=100http://driesgames.game-server.cc//banner.png[/img]

Java, Hosting Servers and Videos...

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.