The Sky can be Seen Through Blocks

Status
Fixed
Type
Product/platform
MCreator/Windows
Priority
Normal
Issue description

While working on a mod block that collected water when exposed to the sky during rain, I found out that "the sky was visible" through my other blocks. It tried changing the transparency to all the different settings, but nothing helped. I believe it is an issue with how Mcreator is registering the blocks because I do not see what could be messed up about the can see sky part due to the fact it works fine for regular vanilla blocks. All my procedure did was test to see if it could see the sky and was raining, then place a block.

Issue comments

Could you attach the screenshot of this issue and possibly the workspace file that contains an example of such block? Thanks!

I do not have screenshots, but with the mcr, just place a modded block over an empty collector then toggle downfall (Not the waiting version of the collector!)

I am pretty sure the reason for this is a light opacity value of your block/s. I have not tried importing your workspace, but I am certain that if I would build a closed room from some of your blocks on the surface, there would still be light.
Why? For the same reason - light opacity value of your block/s.

The default value used by MCreator is 0. That means that the block is absolutely transparent for light.

Now, let's take a look on the vanilla code, that handles checking if a block can see sky:

public boolean canBlockSeeSky(BlockPos pos)
    {
        if (pos.getY() >= this.getSeaLevel())
        {
            return this.canSeeSky(pos);
        }
        else
        {
            BlockPos blockpos = new BlockPos(pos.getX(), this.getSeaLevel(), pos.getZ());

            if (!this.canSeeSky(blockpos))
            {
                return false;
            }
            else
            {
                for (BlockPos blockpos1 = blockpos.down(); blockpos1.getY() > pos.getY(); blockpos1 = blockpos1.down())
                {
                    IBlockState iblockstate = this.getBlockState(blockpos1);

                    if (iblockstate.getBlock().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.getMaterial().isLiquid())
                    {
                        return false;
                    }
                }

                return true;
            }
        }
    }

 

As you can see, there is a check if the value of the light opacity of the block, that it is checking at the moment, is more than 0. If this condition (+ some others) are met, then the block is not exposed to the sky, but if they are not met, then it is "transparent" even if there is a block.

So to solve your issue should be enough just changing the opacity to anything but 0.

Nuparu00 is right, changing the opacity will fix this bug. As a side note, in MCreator 1.8.0, default opacity value will now be 255 to avoid such confusions as this is the default value for normal blocks.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.