Jump to content

Recommended Posts

Posted

Hello everyone,

Very junior mod maker here. I'm making a floating plank that sits over water. There's this heavy shadow on it when there's a block over it for some reason.

spacer.png

As you can see in the picture, the lily pad that has a block over it is just a little darker from the shadow. however my custom plank is almost dark.

I have no idea what might cause this.
If it is how I generate the block model, here's the code I'm using:
 

 getBuilder(block.getId().getPath())
                .ao(false)
                .texture("particle", new ResourceLocation(xxxxx.MODID, "block/" + block.getId().getPath()))
                .texture("texture", new ResourceLocation(xxxxx.MODID, "block/" + block.getId().getPath()))
                .element()
                .from(0.01f, -2f, 0.01f)
                .to(15.99f, 0.01f, 15.99f)
                .face(Direction.DOWN).uvs(0f, 0f, 16f,  16f).texture("#texture").cullface(Direction.DOWN).tintindex(0).end()
                .face(Direction.UP).uvs(0f, 0f, 16f, 16f).texture("#texture").cullface(Direction.UP).tintindex(0).end()
                .face(Direction.NORTH).uvs(0f, 0f, 16f, 2.01f).texture("#texture").cullface(Direction.NORTH).tintindex(0).end()
                .face(Direction.SOUTH).uvs(0f, 0f, 16f, 2.01f).texture("#texture").cullface(Direction.SOUTH).tintindex(0).end()
                .face(Direction.EAST).uvs(0f, 0f, 2.01f, 16f).texture("#texture").rotation(ModelBuilder.FaceRotation.CLOCKWISE_90).cullface(Direction.EAST).tintindex(0).end()
                .face(Direction.WEST).uvs(0f, 0f, 2.01f, 16f).texture("#texture").rotation(ModelBuilder.FaceRotation.CLOCKWISE_90).cullface(Direction.WEST).tintindex(0).end()
                .end();

 

Posted (edited)

Found the problem. The cullfaces were reversed. You need to set the cullface to UP on the DOWN face and vice-versa to all other faces. So that heavy shadow isn't a shadow, it's actually inside the block because the up face isn't rendered. And inside the block is almost dark because there's no light in there.

Here's the final code with a few more tweaks if anyone is interested:
 

getBuilder(block.getId().getPath())
    .ao(false)
    .texture("particle", new ResourceLocation(xxxxx.MODID, "block/" + block.getId().getPath()))
    .texture("texture", new ResourceLocation(xxxxx.MODID, "block/" + block.getId().getPath()))
    .element()
    .from(0f, -2f, 0f)
    .to(16f, 0.01f, 16f)
    .face(Direction.DOWN).uvs(0f, 0f, 16f,  16f).texture("#texture").cullface(Direction.UP).end()
    .face(Direction.UP).uvs(0f, 0f, 16f, 16f).texture("#texture").cullface(Direction.DOWN).end()
    .face(Direction.NORTH).uvs(0f, 0f, 16f, 2.01f).texture("#texture").rotation(ModelBuilder.FaceRotation.UPSIDE_DOWN).cullface(Direction.SOUTH).end()
    .face(Direction.SOUTH).uvs(0f, 0f, 16f, 2.01f).texture("#texture").cullface(Direction.NORTH).end()
    .face(Direction.EAST).uvs(0f, 0f, 2.01f, 16f).texture("#texture").rotation(ModelBuilder.FaceRotation.CLOCKWISE_90).cullface(Direction.WEST).end()
    .face(Direction.WEST).uvs(0f, 0f, 2.01f, 16f).texture("#texture").rotation(ModelBuilder.FaceRotation.COUNTERCLOCKWISE_90).cullface(Direction.EAST).end()
    .end();

 

Edited by DnDev

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.