Water disabling structures from spawning?

Published by AOCAWOL on Mon, 09/23/2019 - 00:41
Upvotes: 2
Issue description

Hi so similar to my problem with Snow disabling structures from spawning in my biomes in 1.9.0, now when I loaded up mcreator 1.9.1 any biomes where the tree structures are restricted to water blocks (still or flowing) they don't spawn? 

Issue comments

I will check this out. Most likely this is happening because replaceable blocks are ignored when detecting ground blocks.

Okay thanks, maybe just in the structures element add a little tick box "Ignore Replaceable Blocks" and if u don't tick it, then it can like be restricted to water and stuff?

Anyway this could be added in a patch fix or something? It's just, I'm sapose to launch my update.by the end of October and it's gonna take you guys a long time to do the next update. Or if not could u show me a way to fix this in the code possibly or something? It's really messed up like 10 of my biomes and I really wanna get working on this update.

If there are any other bugs, I might release another patch.

In the code, find lines containing this code in structure element:

world.getBlockState(new BlockPos(i, height, k)).getBlock().isReplaceable(world, new BlockPos(i, height, k)

and rewrite if statement to not include this statement, for example, change

if (!world.isAirBlock(new BlockPos(i, height, k)) && !world.getBlockState(new BlockPos(i, height, k)).getBlock().isReplaceable(world, new BlockPos(i, height, k)))

to

if (!world.isAirBlock(new BlockPos(i, height, k)))

this should do it.

Submitted by AOCAWOL on Wed, 09/25/2019 - 16:55

So I got this error

C:\Users\Username\MCreatorWorkspaces\biomesyougo\build\sources\main\java\net\mcreator\byg\MCreatorMangroveTree1.java:42: error: ')' expected
                            && (world.isAirBlock(new BlockPos(i, height, k))) 
                                                                             ^
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 19s

Why is there &&?

I meant to only place:

if (!world.isAirBlock(new BlockPos(i, height, k)))

You may paste code around line 42 too.

Submitted by AOCAWOL on Wed, 09/25/2019 - 19:08

Here is the default code:

                boolean notpassed = true;
                while (height > 0) {
                    if (notpassed
                            && (world.isAirBlock(new BlockPos(i, height, k)) || world.getBlockState(new BlockPos(i, height, k)).getBlock()
                                    .isReplaceable(world, new BlockPos(i, height, k))))
                        notpassed = false;
                    else if (!notpassed && !world.isAirBlock(new BlockPos(i, height, k))
                            && !world.getBlockState(new BlockPos(i, height, k)).getBlock().isReplaceable(world, new BlockPos(i, height, k)))
                        break;
                    height--;
                }
            } else {
                while (height > 0) {
                    if (!world.isAirBlock(new BlockPos(i, height, k))
                            && !world.getBlockState(new BlockPos(i, height, k)).getBlock().isReplaceable(world, new BlockPos(i, height, k)))
                        break;
                    height--;
                }
            }

 

the && is part of the default code, I simply removed || world.getBlockState(new BlockPos(i, height, k)).getBlock()
                                    .isReplaceable(world, new BlockPos(i, height, k)))) leaving just && (world.isAirBlock(new BlockPos(i, height, k))) but then it gave me an error

Try this:


            } else {
                while (height > 0) {
                    if (!world.isAirBlock(new BlockPos(i, height, k)))
                        break;
                    height--;
                }
            }