Roguelike Dungeons

Roguelike Dungeons

33M Downloads

Settings (1.8.0), Criteria: 'biomes' not working + suggested fix

Micmu opened this issue ยท 0 comments

commented

Hi!
First of all, thanks for the excellent mod. I've been using it for a while now.
Recently I started experimenting with custom dungeons in new version 1.8.0.
I think I've found a bug where Criteria's "biomes" field gets ignored (impossible to make a dungeon for a specific biome by its registered name, e.g. biomesoplenty:wasteland), while "biomeTypes" does work.
I managed to find a problem in code...and fixed it, if you don't mind. :)
SpawnCriteria.java, isValid(), this.biomeTypes is always non-null and overwrites whatever previous statement has set.

java/greymerk/roguelike/dungeon/settings/SpawnCriteria.java:

public boolean isValid(ISpawnContext context){

	if(this.everywhere) return true;

	boolean biomeFound = false;

	if(this.biomes != null)	biomeFound = context.includesBiome(biomes);

	if(this.biomeTypes != null) biomeFound = context.includesBiomeType(this.biomeTypes);

	return biomeFound;
}

My suggested fix (works for me):

public boolean isValid(ISpawnContext context) {

	if (this.everywhere) return true;

	if ((this.biomes != null) && !this.biomes.isEmpty() && context.includesBiome(this.biomes)) return true;

	if ((this.biomeTypes != null) && !this.biomeTypes.isEmpty() && context.includesBiomeType(this.biomeTypes)) return true;

	return false;
}