MMD OreSpawn

MMD OreSpawn

11M Downloads

Biome Whitelist & Blacklist is broken

Insane96 opened this issue · 43 comments

commented

I've made a custom ore generation in my modpack, but as soon as I create a world, I get a NullPointerException

Full crashlog: https://pastebin.com/ArQcqNJ2 (crashlog in modpack: https://pastebin.com/mkGKYb3Y)
Actual orespawn.json: https://pastebin.com/uWUf3Mv6
And there's a rar of the world that generated until the game froze on "Building Terrain" with the error: https://www.dropbox.com/s/d2488xipmh9fgdi/Singleplayer.rar?dl=1

commented

hrm... I'll have to poke at this a bit, as my first thought was an issue with an ore specification

commented

...wtf ? It looks like its having a problem finding the "feature", but... blargh - this is going to be tricky to figure out

commented
commented

if you actually got into the game with no errors in the logs, the json was valid json and there were no issues with the parsing.

What I was thinking was that there might have been a mis-specified ore, but no - unless I'm looking at a crash in a pre-3.2 version, the line it dies on is where it tries to get the feature generator that is to be used.

commented

That's pretty strange. Running the default orespawn.json doesn't crash the game.
Plus, I've tried running in a empty pack (orespawn only), creating about 5 worlds and none of them runs :/
New crash log that's more readable since there are no mods: https://pastebin.com/ArQcqNJ2

Edit: Oh, and I'm using 3.2.2.113

commented

Something to try is on line 10 of your json, you have -1 in quotes, try it without the quotes

commented

I really don't think that's the problem. The default one has it and doesn't crash

commented

afaik, we removed the quotes there in latest, it might not be the problem, but it's not needed anyway, give it a try and let me know, all part of the debugging process.

If it's not that, then my bet is there's a bug in "includes" or "excludes", likely on our side.

commented
commented

I don't have a list of biomes to hand, but that's possible, if it's not 1 or 2, then we're likely mishandling something on the includes/excludes lists

commented

I do believe...

"minecraft:mutaded_mesa", "minecraft:mutaded_mesa_rock", "minecraft:mutaded_mesa_clear_rock"

that it's "mutated" not "mutaded"

commented

This does expose, however, that we've either forgotten or lost error-checking code in that region.

commented

It's not the "-1"
And did some more testing

I've removed every biome from excludes and includes and it worked.
I've removed every include and it worked
I've removed every include but one (with diamonds) with "MUSHROOM" inside and it worked
Same as above but with "SAVANNA" and it worked.

I hope this helps, if not, I'll check tomorrow if biomes are correctly written

commented

"replace vanilla" only replaces the various ore-spawning phases - sand is one of those things that Minecraft just adds, period. Sorry, but without replacing a massive chunk of the world-gen process, I cannot override that.

commented

Actually I'm talking about underground sand. There's no sand underground in vanilla. I'm trying to spawn sand and red sand underground in deserts and mesas instead of gravel, but the sand spawns (underground) anywhere

commented

...I see... I, personally, have only tested biome-dictionary use in includes/excludes
You could try "includes": ["MESA"] and "includes": ["DESERT"]

commented

Yep, it was. Now no longer crashes, but it doesn't work properly

If includes means that this block should spawn only in the includes list, then it's not working properly.
Sand and red sand spawn in every biome ignoring includes

"sand": {
	"retrogen": false,
	"enabled": true,
	"feature": "default",
	"replaces": "default",
	"dimensions": [],
	"biomes": {
		"includes": ["minecraft:desert", "minecraft:desert_hills", "minecraft:mutated_desert"]
	},
	"parameters": {
		"size": 112,
		"variation": 50,
		"frequency": 10,
		"minHeight": 0,
		"maxHeight": 255
	},
	"blocks": [
		{
			"name": "minecraft:sand",
			"chance": 100
		}
	]
},
"red_sand": {
	"retrogen": false,
	"enabled": true,
	"feature": "default",
	"replaces": "default",
	"dimensions": [],
	"biomes": {
		"includes": ["minecraft:mesa", "minecraft:mesa_rock", "minecraft:mesa_clear_rock", "minecraft:mutated_mesa", "minecraft:mutated_mesa_rock", "minecraft:mutated_mesa_clear_rock"]
	},
	"parameters": {
		"size": 112,
		"variation": 50,
		"frequency": 10,
		"minHeight": 0,
		"maxHeight": 255
	},
	"blocks": [
		{
			"name": "minecraft:sand",
			"chance": 100,
			"state": "variant=red_sand"
		}
	]
}
commented
commented

Okay... looks like the BiomeDictionary got overhauled since the last time I looked deep at it. I think your issue might be related to the crash - I'll be giving that code a good cleaning and bug-proofing later today or Friday.

commented

Found some other strange behaviour

Sand and red sand spawn in every biome ignoring includes

This doesn't happen for lapis_ore. It doesn't spawn in every biome, only in desert.

                   "lapis_ore_biome": {
			"retrogen": false,
			"enabled": true,
			"feature": "default",
			"replaces": "default",
			"dimensions": [],
			"biomes": {
				"includes": ["minecraft:desert", "minecraft:desert_hills", "minecraft:mutated_desert"]
			},
			"parameters": {
				"size": 4,
				"variation": 3,
				"frequency": 4,
				"minHeight": 0,
				"maxHeight": 64
			},
			"blocks": [
				{
					"name": "minecraft:lapis_ore",
					"chance": 100
				}
			]
		},

Hope this helps for the bug hunting

EDIT: found out that even dirt doesn't respect the excludes field

commented

hrm... this will help a lot, yes

commented

Got what should be a proper fix in for the first of the issues. Not exactly sure how the issue with the biome restrictions not applying is happening, but think that one should be easy to fix as well. We shall see.

commented

Okay, another bugfix is in testing, this one to hopefully fix the issue of exclusions/inclusions not being obeyed for specific biome listings

commented

and... The limited testing I did (using your Lapis spawn with other Lapis turned off, period) showed it showing up in a 4-chunk region of desert, but not in a 4-chunk region of Extreme Hills, forest or plains. So... While awaiting further review and information from the reporter, I'm tentatively declaring the issues raised in this thread "fixed in -dev". (-dev is available on our maven)

commented

Actually lapis was working properly.
(Red) sand and dirt were the problems ignoring exclude and include.

3.2.2.124 (latest dev) still has the same problem. Dirt spawns in every biome when shouldn't in desert and sand spawns everywhere instead of only in deserts (red sand too)
Script: https://pastebin.com/fjJKPfxk

commented

Do you have "replace vanilla orespawn" set to "true" in config/orespawn.cfg ?

That should halt vanilla from generating any of its built-in underground spawns. And... I've never seen underground sand spawns, so I can't comment on what might be happening there, but I have checked and even fixed the biome checks. If things such as dirt are still spawning in underground pockets, then I don't know what I can do...

Forge has:

        public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, DIORITE, GRANITE, ANDESITE, EMERALD, SILVERFISH, CUSTOM }

Available as "Types" for the event that fires when an ore is generated. We trap on all of those if "replace vanilla orespawn" is set, and deny/cancel the event.

In OreSpawn itself we have a system called "BiomeLocation" that handles the white/black list and we use it to determine if we should be spawning a block in the current chunks biome. These spawns might overlap into the incorrect biome-next-door if they happen to be on a biome border.

This is why I say I do not understand what is happening here - I have confirmed that, with the config value "replace vanilla orespawn" turned on, the biome controls are being respected for ores - which means they should be respected for any other block, as OreSpawn treats all blocks its told to generate exactly the same.

commented

An addendum: Quark has some world-gen to it, though I've only seen it do andesite, diorite and granite - and these do not get stopped by the "replace vanilla" option in OreSpawn. Is it possible that some of your spawn issues are caused by other mods ?

commented

In your orespan as Dshad pointed out if you change the mutaded to mutated, that fixes the crash at least

commented

Lastly: have you fixed your typo ? The word is "mutated" not "mutaded"

commented

Im not sure how its done but to m e "includes" means biomes to include in the generation and "excludes" means all but those ones listed

commented

A little recap

  • Fixing the names to 'mutated' fixed the crash
  • Lapis were spawning properly
  • (Red) Sand and Dirt were ignoring include and exclude
  • After updating to dev 124 nothing changed, lapis still spawn properly while (red) sand and dirt ignore 'includes' and 'excludes'
  • All the tests have been made in an empty enviroment (OreSpawn only, no other mods)

Im not sure how its done but to me "includes" means biomes to include in the generation and "excludes" means all but those ones listed

I thought the same

commented

okay... strange, but... I think there might actually be an issue in the code that loads the lists and it isn't setting up the data as the code expects... I'm going to make a test here and see.

Okay... wtf ? There is an issue in either the loading code or the biome matching code. This should have shown up in the testing done all around that code, really.

commented

...and... it seems that the biome whitelist/blacklist code is broken in strange and wonderful ways - thank you for your patience.

I'm looking at it - and while admittedly tired - and the code that I wrote so many months ago has me scratching my head and going "am I a fecking idiot ?"

Expect a complete rewrite of a large swathe of the code in that area in the near future.

commented

Issue title changed to reflect remaining problem.

commented

I don't know if this can help but
With this orespawn.json the only things spawning are emeralds and gold_ore (that have nothing in "exclude") and ores that have an include (e.g. "redstone_ore_biome_low_y" & "redstone_ore_biome_high_y" have CONIFEROUS in "includes", and it spawns in right biome (taigas, etc.)

"biomes": {
    "includes": ["CONIFEROUS"]
},

but "redstone_ore" doesn't spawn in other biomes when "excludes" has CONIFEROUS)

"biomes": {
    "excludes": ["CONIFEROUS"]
},
commented

Cause of the issue is known. A fast fix could be done, but a proper fix is actually being worked on.

commented

Nice, then I'll wait

commented

Currently have PR #123 waiting for @jriwanek to review and approve - with that PR we have the biome blacklist/whitelist issue fixed - turns out that, for larger spawns using "default" the actual generation of the block didn't always go through a centralized spot as I'd thought.

The API rework and related changes, however, make the 3.3 rewrite even better, as it provides a means for me to properly document the "replacements" file (and the entry in the config file) as well as gives motivation to finish the user-side documentation and write the developer documentation as well. So... Thank you for your patience, for finding this issue and for providing data and test cases to show what was happening

commented

So the latest .128 build should do the job?

commented

Tested locally with your provided settings. Where before I'd find red sand in a plains biome, I found none but did find it in the Mesa a few chunks away (try world seed "BOOK" for a spawn in a jungle near a mesa, ocean and plains)

commented

Yep the sand and the red sand are now working properly but did a little test and seems like every ore with the exclude field doesn't spawn at all

commented

Did a simple test
-Got the original orespawn.json
-Set "excludes" for coal to "DRY"
-Coal doens't spawn at all in any biome

commented

...
empty whitelist, partial blacklist - I thought I'd tested this... but... ffs, right - empty whitelist is "exclude everything"

grumbles okay, that is a nice, fun corner to have found