Configuration for what blocks qualify as "ground" etc.

Use this forum to discuss feature suggestions for Millénaire
Post Reply
MauveCloud
Posts: 63
Joined: Fri Oct 24, 2014 3:21 pm
Location: California

Configuration for what blocks qualify as "ground" etc.

Post by MauveCloud » Wed Apr 04, 2018 11:06 pm

While playing Millenaire with Biomes O Plenty, I discovered that only a very limited set of vanilla blocks are considered "ground" or "ceiling" blocks for purposes of determining what parts of a village map can be built on. This means that caves and ravines that have ceilings composed of sandy dirt/grass and dried sand (which can happen in the Steppe biome) can show up in brown on the village map, despite appearing to have a solid surface for the villagers to build on. There are probably other mods that also add non-standard blocks near the surface, so I am posting this for those, and so I can confirm the current (hard-coded) behavior, and possibly add details to the Wiki in the meantime (if I can figure out where, and if my health allows :( ).

From what I can tell with jd-gui, it seems the following blocks are considered "ground":
minecraft:bedrock
minecraft:clay // edit: corrected with help from https://raw.githubusercontent.com/KevyP ... fields.csv
minecraft:dirt
minecraft:grass
minecraft:gravel
minecraft:obsidian
minecraft:sand // including red sand
minecraft:farmland
// edit: I notice hardened clay aka terracotta is missing from the list, although this is not surprising, given that it was added in Minecraft 1.6.1, and Millenaire was started well before then.

"ceiling" blocks (I haven't entirely figured out how these are handled differently from "ground" blocks):
minecraft:stone // which includes andesite, diorite, and granite, whether polished or not.
minecraft:sandstone // including red sandstone

"fluid" blocks:
minecraft:water
minecraft:flowing_water
minecraft:lava
minecraft:flowing_lava
// modded fluid blocks could easily be detected as well, since they nearly always extend net.minecraftforge.fluids.BlockFluidBase

"artificial" blocks (having one of these as the top solid block prevents a new building from being added there, not sure if covering with an unknown block such as sandy dirt changes that):
minecraft:water
minecraft:flowing_water // um, aren't these redundant with the fluid blocks?
minecraft:ice // edit: corrected
minecraft:flowing_lava
minecraft:lava
minecraft:planks
minecraft:cobblestone
minecraft:brick_block
minecraft:chest
minecraft:glass
millenaire:earth_deco // dirt wall
millenaire:stone_deco // mud brick, cooked brick, gold ornament
millenaire:wood_deco // timber frames, thatch
// seems to me that also treating any block that returns true to the hasTileEntity method as artificial would be good - that would automatically cover furnaces, hoppers, droppers, dispensers, and most mod-added chests and machines.

MauveCloud
Posts: 63
Joined: Fri Oct 24, 2014 3:21 pm
Location: California

Re: Configuration for what blocks qualify as "ground" etc.

Post by MauveCloud » Wed Apr 11, 2018 12:28 am

Okay, I've found out that there is a separate set of blocks that can be replaced with paths: only dirt/grass, sand, and gravel (and existing path blocks, as long as they're "unstable" - i.e. placed as part of a path rather than while constructing a building).

My idea is to change the logic to be something like this:
1. Find the top non-air (and possibly non-log/leaf) block.
2. If it's a full solid opaque block, count it as a "ground" block to start with, so if it's in appropriate height range, buildings and paths can be built there.
3. If it's one of the known vanilla fluid blocks, fulfills instanceof net.minecraftforge.fluids.BlockFluidBase, or is in the config list of fluid blocks, count it as fluid.
4. If it returns true to hasTileEntity or is in the config list of artificial blocks, count it as artificial.
5. If it is in the config list of ground blocks, count it as ground (possibly even if it was previously counted as fluid or artificial - I'm not entirely sure this is a good idea, but for all I know there could be mods that have blocks that cause weird false positives with the auto-detection strategies I listed above)

I guess there should also be a config for "dangerous" blocks, but right now that only seems to be lava - the map help (the second page of the sign with the village map) says lava and cactus are both supposed to be indicated in red, but cactus seems to be ignored from what I've seen, and lava doesn't actually hurt Millenaire villagers.

Most (or perhaps all) of the above logic can be skipped for map positions that are already part of a building or path.

User avatar
felinoel
Posts: 974
Joined: Sun Jun 09, 2013 6:02 pm

Re: Configuration for what blocks qualify as "ground" etc.

Post by felinoel » Thu Apr 12, 2018 2:58 pm

I have spoken with Kinn on this at great lengths but the major issue is that it is hard coded... /:
No way to introduce it as a config option apparently

MauveCloud
Posts: 63
Joined: Fri Oct 24, 2014 3:21 pm
Location: California

Re: Configuration for what blocks qualify as "ground" etc.

Post by MauveCloud » Thu Apr 12, 2018 3:16 pm

Currently hard coded. I'm not so sure it's impossible to change it to pick up sets of blocks from config. I have a migraine today :( , but perhaps in a few days I can take a stab at setting up a merge request for this.

User avatar
felinoel
Posts: 974
Joined: Sun Jun 09, 2013 6:02 pm

Re: Configuration for what blocks qualify as "ground" etc.

Post by felinoel » Thu Apr 12, 2018 7:49 pm

MauveCloud wrote:Currently hard coded. I'm not so sure it's impossible to change it to pick up sets of blocks from config. I have a migraine today :( , but perhaps in a few days I can take a stab at setting up a merge request for this.
The 1.8-1.11 versions of Millenaire may be able to be changed but Kinn is keeping most of his coding for 1.12 and onward

MauveCloud
Posts: 63
Joined: Fri Oct 24, 2014 3:21 pm
Location: California

Re: Configuration for what blocks qualify as "ground" etc.

Post by MauveCloud » Wed Apr 18, 2018 4:31 am

felinoel wrote:The 1.8-1.11 versions of Millenaire may be able to be changed but Kinn is keeping most of his coding for 1.12 and onward
You might be right in this case. A comment from him in a closed bug hinted that he plans to do something along these lines himself eventually, so he might not accept a merge request for this if I opened one.

However, in case he reads this thread, I thought of a simpler strategy for determining how unknown blocks (that may be from other mods) should be handled by default: the getMaterial method. It seems to me that many mod-added blocks, such as BOP dirts and grass, use the standard material types, and it would be reasonable to auto-detect their effective type that way (though overriding via config will hopefully become possible, and I still advocate checking hasTileEntity as well).

Edit: surprisingly, Kinniken has given me permission to set up the merge request (see here for proof: https://gitlab.com/Millenaire/Public/is ... e_68952922 ), but first I'll have to wait until my health allows me to tackle it. :(

Saggaris
Posts: 68
Joined: Fri Sep 22, 2017 11:13 am

Re: Configuration for what blocks qualify as "ground" etc.

Post by Saggaris » Sun Jun 03, 2018 9:57 am

Heya guys,

The Config thing would work for me on this, I often have villages expand that tear down the underside of a 'Natura' Giant Redwood, being able to add the bark to a forbidden block list would save me having to cut down upwards of 10,000 blocks whilst dancing among the leaves... being a Hardcore addict I'm a habitual restarter.
I'm on 1.17.10 as a lifer I think, I tried the 1.12 but so far some other mods in the pack I'm using are detrimental to my game and I need to spend time sorting it all out.

As ever Pete

User avatar
felinoel
Posts: 974
Joined: Sun Jun 09, 2013 6:02 pm

Re: Configuration for what blocks qualify as "ground" etc.

Post by felinoel » Tue Jun 05, 2018 3:13 pm

Maybe even make it culture specific, if he does that then an aquatic culture like the native Hawaiians could be added and only the native Hawaiians would build on water with everyone else not.

MauveCloud
Posts: 63
Joined: Fri Oct 24, 2014 3:21 pm
Location: California

Re: Configuration for what blocks qualify as "ground" etc.

Post by MauveCloud » Tue Jun 05, 2018 3:30 pm

Actually, when I was testing this, I tried to make a custom blocktypes.txt that would set water as a ground block and remove it from the "liquid" and "artificial" block types, but it still showed as water on the village map. I never got around to tracking down why that didn't work, but think about what would happen if the villagers "dug" out water the way they dig out ground, especially if there's an above-ground pond.

User avatar
felinoel
Posts: 974
Joined: Sun Jun 09, 2013 6:02 pm

Re: Configuration for what blocks qualify as "ground" etc.

Post by felinoel » Tue Jun 05, 2018 3:32 pm

MauveCloud wrote:Actually, when I was testing this, I tried to make a custom blocktypes.txt that would set water as a ground block and remove it from the "liquid" and "artificial" block types, but it still showed as water on the village map. I never got around to tracking down why that didn't work, but think about what would happen if the villagers "dug" out water the way they dig out ground, especially if there's an above-ground pond.
Nah my use of this would only be in the ocean and anything dug out would be replaced with a block

Post Reply