Jump to content

[1.16.5] new block window not rendering correctly


matt1999rd

Recommended Posts

Hello everyone,

 

in my new mod, I want to had windows to the game. The idea I had is to use an object inherited from the class DoorBlock. But as I try it into the game with a texture of glass it render with strange gray texture instead.

Here is the rendering in game and the following rendering in BlockBench. I guess it may be due to alpha layer but I don't know how to change it.

 

2020-02-17_18.42.28.png

window.PNG

2020-02-17_18.46.38.png

Link to comment
Share on other sites

This is likely because the alpha channel in your texture is not set-up properly, or because you did not enable transparency in model.  
Are you using a custom renderer, or are you using a model.json file for this?  
Please post the code of these files.

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

for this block I use blockbench it generates json models. I use it to create as minecraft door block a parent model. Here is the model of th window :

 

window_bottom.json

{
   "credit": "Made with Blockbench",
   "textures": {
      "0": "gates:block/glass",
      "2": "gates:block/metal",
      "particle": "#bottom"
   },
   "elements": [
      {
         "from": [1, 3, 8],
         "to": [2, 16, 14],
         "faces": {
            "north": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "east": {"uv": [0, 8, 16, 16], "texture": "#0"},
            "south": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "west": {"uv": [0, 8, 16, 16], "texture": "#0"},
            "up": {"uv": [0, 0, 6, 1], "rotation": 270, "texture": "#0"},
            "down": {"uv": [0, 0, 6, 1], "rotation": 90, "texture": "#0"}
         }
      },
      {
         "from": [1, 3, 2],
         "to": [2, 16, 8],
         "faces": {
            "north": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "east": {"uv": [0, 8, 16, 16], "texture": "#0"},
            "south": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "west": {"uv": [0, 8, 16, 16], "texture": "#0"},
            "up": {"uv": [0, 0, 6, 1], "rotation": 270, "texture": "#0"},
            "down": {"uv": [0, 0, 6, 1], "rotation": 90, "texture": "#0"}
         }
      },
      {
         "from": [0, 0, 2],
         "to": [3, 3, 14],
         "faces": {
            "north": {"uv": [0, 0, 3, 4], "texture": "#bottom"},
            "east": {"uv": [0, 0, 12, 4], "texture": "#bottom"},
            "south": {"uv": [0, 0, 3, 4], "texture": "#bottom"},
            "west": {"uv": [0, 0, 12, 4], "texture": "#bottom"},
            "up": {"uv": [0, 0, 12, 3], "rotation": 270, "texture": "#bottom"},
            "down": {"uv": [0, 0, 12, 3], "rotation": 90, "texture": "#bottom"}
         }
      },
      {
         "from": [0, 0, 0],
         "to": [3, 16, 2],
         "faces": {
            "north": {"uv": [0, 0, 3, 16], "texture": "#bottom"},
            "east": {"uv": [0, 0, 2, 16], "texture": "#bottom"},
            "south": {"uv": [0, 0, 3, 16], "texture": "#bottom"},
            "west": {"uv": [0, 0, 2, 16], "texture": "#bottom"},
            "up": {"uv": [0, 0, 2, 3], "rotation": 270, "texture": "#bottom"},
            "down": {"uv": [0, 0, 2, 3], "rotation": 90, "texture": "#bottom"}
         }
      },
      {
         "from": [0, 0, 14],
         "to": [3, 16, 16],
         "faces": {
            "north": {"uv": [0, 0, 3, 16], "texture": "#bottom"},
            "east": {"uv": [0, 0, 2, 16], "texture": "#bottom"},
            "south": {"uv": [0, 0, 3, 16], "texture": "#bottom"},
            "west": {"uv": [0, 0, 2, 16], "texture": "#bottom"},
            "up": {"uv": [0, 0, 2, 3], "rotation": 270, "texture": "#bottom"},
            "down": {"uv": [0, 0, 2, 3], "rotation": 90, "texture": "#bottom"}
         }
      },
      {
         "from": [2, 15, 6],
         "to": [3, 16, 7],
         "faces": {
            "north": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "south": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "up": {"uv": [0, 0, 1, 1], "rotation": 270, "texture": "#2"},
            "down": {"uv": [0, 0, 1, 1], "rotation": 90, "texture": "#2"}
         }
      },
      {
         "from": [2, 15, 9],
         "to": [3, 16, 10],
         "faces": {
            "north": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "east": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "south": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "west": {"uv": [0, 0, 1, 1], "texture": "#2"},
            "up": {"uv": [0, 0, 1, 1], "rotation": 270, "texture": "#2"},
            "down": {"uv": [0, 0, 1, 1], "rotation": 90, "texture": "#2"}
         }
      }
   ]
}

 

window_top.json

{
   "credit": "Made with Blockbench",
   "textures": {
      "0": "gates:block/glass",
      "1": "gates:block/metal",
      "particle": "#top"
   },
   "elements": [
      {
         "from": [1, 0, 8],
         "to": [2, 13, 14],
         "faces": {
            "north": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "east": {"uv": [0, 0, 16, 8], "texture": "#0"},
            "south": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "west": {"uv": [0, 0, 16, 8], "texture": "#0"},
            "up": {"uv": [0, 0, 6, 1], "rotation": 270, "texture": "#0"},
            "down": {"uv": [0, 0, 6, 1], "rotation": 90, "texture": "#0"}
         }
      },
      {
         "from": [1, 0, 2],
         "to": [2, 13, 8],
         "faces": {
            "north": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "east": {"uv": [0, 0, 16, 8], "texture": "#0"},
            "south": {"uv": [0, 0, 1, 13], "texture": "#0"},
            "west": {"uv": [0, 0, 16, 8], "texture": "#0"},
            "up": {"uv": [0, 0, 6, 1], "rotation": 270, "texture": "#0"},
            "down": {"uv": [0, 0, 6, 1], "rotation": 90, "texture": "#0"}
         }
      },
      {
         "from": [0, 13, 2],
         "to": [3, 16, 14],
         "faces": {
            "north": {"uv": [0, 0, 3, 3], "texture": "#top"},
            "east": {"uv": [0, 0, 12, 3], "texture": "#top"},
            "south": {"uv": [0, 0, 3, 3], "texture": "#top"},
            "west": {"uv": [0, 0, 12, 3], "texture": "#top"},
            "up": {"uv": [0, 0, 12, 3], "rotation": 270, "texture": "#top"},
            "down": {"uv": [0, 0, 12, 3], "rotation": 90, "texture": "#top"}
         }
      },
      {
         "from": [0, 0, 0],
         "to": [3, 16, 2],
         "faces": {
            "north": {"uv": [0, 0, 3, 16], "texture": "#top"},
            "east": {"uv": [0, 0, 2, 16], "texture": "#top"},
            "south": {"uv": [0, 0, 3, 16], "texture": "#top"},
            "west": {"uv": [0, 0, 2, 16], "texture": "#top"},
            "up": {"uv": [0, 0, 2, 3], "rotation": 270, "texture": "#top"},
            "down": {"uv": [0, 0, 2, 3], "rotation": 90, "texture": "#top"}
         }
      },
      {
         "from": [0, 0, 14],
         "to": [3, 16, 16],
         "faces": {
            "north": {"uv": [0, 0, 3, 16], "texture": "#top"},
            "east": {"uv": [0, 0, 2, 16], "texture": "#top"},
            "south": {"uv": [0, 0, 3, 16], "texture": "#top"},
            "west": {"uv": [0, 0, 2, 16], "texture": "#top"},
            "up": {"uv": [0, 0, 2, 3], "rotation": 270, "texture": "#top"},
            "down": {"uv": [0, 0, 2, 3], "rotation": 90, "texture": "#top"}
         }
      },
      {
         "from": [2, 0, 6],
         "to": [3, 1, 7],
         "faces": {
            "north": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "east": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "south": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "west": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "up": {"uv": [0, 0, 1, 1], "rotation": 270, "texture": "#1"},
            "down": {"uv": [0, 0, 1, 1], "rotation": 90, "texture": "#1"}
         }
      },
      {
         "from": [2, 0, 9],
         "to": [3, 1, 10],
         "faces": {
            "north": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "east": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "south": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "west": {"uv": [0, 0, 1, 1], "texture": "#1"},
            "up": {"uv": [0, 0, 1, 1], "rotation": 270, "texture": "#1"},
            "down": {"uv": [0, 0, 1, 1], "rotation": 90, "texture": "#1"}
         }
      }
   ]
}

 

stone_window_bottom

{
    "parent": "gates:block/window_bottom",
    "textures": {
        "bottom": "gates:block/stone",
        "top": "gates:block/stone"
    }
}

 

stone_window_top

{
    "parent": "gates:block/window_top",
    "textures": {
        "bottom": "gates:block/stone",
        "top": "gates:block/stone"
    }
}

 

This is all for the model for the code it is only the properties that I defined and I choose the Material ROCK but I try to change it and it didn't work

Edited by matt1999rd
Link to comment
Share on other sites

You need to add your block to the layer lookup table.  
Run something like this after registering your block.

if (FMLEnvironment.dist == Dist.CLIENT) {
	RenderTypeLookup.setRenderLayer(yourBlock, RenderType.CUTOUT);
}

 

Edited by Busti

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

2 hours ago, Busti said:

You need to add your block to the layer lookup table.  
Run something like this after registering your block.


if (FMLEnvironment.dist == Dist.CLIENT) {
	RenderTypeLookup.setRenderLayer(yourBlock, RenderType.CUTOUT);
}

 

Run this in the client setup event. You can also use DistExecutor to run code only on a specific side but be careful with lambdas and the verifier.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

  • matt1999rd changed the title to [solved][1-15] new block window not rendering correctly
  • 2 months later...
  • 3 weeks later...
On 5/4/2020 at 10:56 AM, matt1999rd said:

I am returning to this topic because I am about to upload my mod and the function does not work for 1.14.4 unfortunately do someone have an idea of how to do it ?

I ran into exactly the same problem, but for 1.15.2; Not sure about 1.14.4, but by looking in RenderType I found the old fields, just renamed weirdly. In my case,

RenderType.func_228643_e_() 

ended up being right; if you're using transparency, you'll probably want

RenderType.func_228645_f_()

. That is, in FMLClientSetupEvent, do

RenderTypeLookup.setRenderLayer(block, RenderType.(whichever function you need))

 

Edited by SpaceCheetah
fixed grammar
Link to comment
Share on other sites

  • matt1999rd changed the title to [1.16.5] new block window not rendering correctly

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.