Jump to content

MC 1.12.2 no such method crash on server


winnetrie

Recommended Posts

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
Link to comment
Share on other sites

You can access the field directly using reflection. Or you might be better of using the registry name, depending on your use case.

There is a reason vanilla minecraft does not use this on the server, it does not make much sense to use there.

Edited by diesieben07
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.....:-)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

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