Jump to content

Recommended Posts

Posted (edited)

On my git i saw someone reporting a crash that happens only server sided:

java.lang.NoSuchMethodError: net.minecraft.world.biome.Biome.func_185359_l()Ljava/lang/String;

Is this maybe a clientside only method? The function is getBiomeName()

What should i use instead?

 

Edited by winnetrie
Posted (edited)

I have changed it to this:

	public void generateOverworld(World world, Random rand, int x, int z){
		
		int XX = x * 16;
		int ZZ = z * 16;
		BlockPos pos = new BlockPos(XX, 70, ZZ);
		String biome = world.getBiome(pos).getRegistryName().toString().toLowerCase();
  
		System.out.println("Trying to generate in: "+ biome);
		if (ConfigHandler.enable_limestone_gen == true) {
			if (biome.contains("river")) {
				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.limestone_gen_chance * 2, 45, 65, BlockMatcher.forBlock(Blocks.STONE));
			}
			if (biome.contains("ocean")) {
				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 15, 33, ConfigHandler.limestone_gen_chance, 10, 50, BlockMatcher.forBlock(Blocks.STONE));
			}
		}
		if ((ConfigHandler.enable_marblestone_gen == true) && ((biome.contains("hills")) || (biome.contains("mountain")))) {
			generateOre(BlockInit.MARBLESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.marblestone_gen_chance, 65, 256, BlockMatcher.forBlock(Blocks.STONE));
		}
	}

Maybe not the best way. because the var biome contains also the mod id or in this case it has "minecraft:biomename"

Edited by winnetrie
Posted

I hope i'm doing this right. I changed the code and tested it. Everything is working fine. I even have a feeling it's working better (more accurately).

	public void generateOverworld(World world, Random rand, int x, int z){
		
		int XX = x * 16;
		int ZZ = z * 16;
		BlockPos pos = new BlockPos(XX, 70, ZZ);
		Biome biome = world.getBiome(pos);
		
		if (ConfigHandler.enable_limestone_gen == true) {
			if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.RIVER)) {
				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.limestone_gen_chance * 2, 45, 65, BlockMatcher.forBlock(Blocks.STONE));
			}
			if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN)) {
				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 15, 33, ConfigHandler.limestone_gen_chance, 10, 50, BlockMatcher.forBlock(Blocks.STONE));
			}
		}
		if ((ConfigHandler.enable_marblestone_gen == true) && (BiomeDictionary.hasType(biome, BiomeDictionary.Type.HILLS)) || (BiomeDictionary.hasType(biome, BiomeDictionary.Type.MOUNTAIN))) {
			generateOre(BlockInit.MARBLESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.marblestone_gen_chance, 65, 256, BlockMatcher.forBlock(Blocks.STONE));
		}
	}

Please don't say this is wrong.....:-)

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.