Question

I am working on a mod for Minecraft but there is 1 last piece of code giving me trouble. I am not very knowledgeable about this code so i cant work through the error as normal and Eclipse dose not give any option to fix it. I am trying to grab a Value from the Config

B:CreativeBiomeConfig = false

When this is set to true is should Register the Biome

GameRegistry.addBiome(CreativeBiome);

The current code I am using is a boolean but gives the following error

The operation == is undefined for the argument type(s) int, boolean

if (this.CreativeBiomeConfig == true){
 GameRegistry.addBiome(CreativeBiome);
}

Pastbin for Classes

http://pastebin.com/hR5zpbE3

http://pastebin.com/4iVjxvXS

http://pastebin.com/iEJ4M32f

Was it helpful?

Solution

If you want to read a boolean value from your configuration file, you should use getBoolean method (true in getBoolean(true) indicates the default value):

CreativeBiomeConfig = config.get(Configuration.CATEGORY_GENERAL, "CreativeBiomeConfig", true).getBoolean(true);

You should also make sure that the CreativeBiomeConfig field in your class is declared as boolean:

public static boolean CreativeBiomeConfig;

Of course, you can change the name of the setting (second argument of config.get) if you want to, you don't have to rename variables in your code:

CreativeBiomeConfig = config.get(Configuration.CATEGORY_GENERAL, "SpawnCreativeBiome", true).getBoolean(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top