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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://pastebin.com/VwpAW6PX My game crashes upon launch when trying to implement the Oculus mod to this mod compilation, above is the crash report, I do not know where to begin to attempt to fix this issue and require assistance.
    • https://youtube.com/shorts/gqLTSMymgUg?si=5QOeSvA4TTs-bL46
    • CubeHaven is a SMP server with unique features that can't be found on the majority of other servers! Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132 3 different stores: - CubeHaven Store: Our store to purchase using real money. - Bitcoin Store: Store for Bitcoin. Bitcoin can be earned from playing the server. Giving options for players if they want to spend real money or grind to obtain exclusive packages. - Black Market: A hidden store for trading that operates outside our traditional stores, like custom enchantments, exclusive items and more. Some of our features include: Rank Up: Progress through different ranks to unlock new privileges and perks. 📈 Skills: RPG-style skill system that enhances your gaming experience! 🎮 Leaderboards: Compete and shine! Top players are rewarded weekly! 🏆 Random Teleporter: Travel instantly across different worlds with a click! 🌐 Custom World Generation: Beautifully generated world. 🌍 Dungeons: Explore challenging and rewarding dungeons filled with treasures and monsters. 🏰 Kits: Unlock ranks and gain access to various kits. 🛠️ Fishing Tournament: Compete in a friendly fishing tournament! 🎣 Chat Games: Enjoy games right within the chat! 🎲 Minions: Get some help from your loyal minions. 👥 Piñata Party: Enjoy a festive party with Piñatas! 🎉 Quests: Over 1000 quests that you can complete! 📜 Bounty Hunter: Set a bounty on a player's head. 💰 Tags: Displayed on nametags, in the tab list, and in chat. 🏷️ Coinflip: Bet with other players on coin toss outcomes, victory, or defeat! 🟢 Invisible & Glowing Frames: Hide your frames for a cleaner look or apply a glow to it for a beautiful look. 🔲✨[ Player Warp: Set your own warp points for other players to teleport to. 🌟 Display Shop: Create your own shop and sell to other players! 🛒 Item Skins: Customize your items with unique skins. 🎨 Pets: Your cute loyal companion to follow you wherever you go! 🐾 Cosmetics: Enhance the look of your character with beautiful cosmetics! 💄 XP-Bottle: Store your exp safely in a bottle for later use! 🍶 Chest & Inventory Sorting: Keep your items neatly sorted in your inventory or chest! 📦 Glowing: Stand out from other players with a colorful glow! ✨ Player Particles: Over 100 unique particle effects to show off. 🎇 Portable Inventories: Over virtual inventories with ease. 🧳 And a lot more! Become part of our growing community today! Discord: https://cubehaven.net/discord Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132
    • # Problematic frame: # C [libopenal.so+0x9fb4d] It is always the same issue - this refers to the Linux OS - so your system may prevent Java from working   I am not familiar with Linux - check for similar/related issues  
  • Topics

×
×
  • Create New...

Important Information

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