Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted (edited)

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
Posted (edited)

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.

Posted
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)

Posted

thank you for your reply but RenderLayer has no attribute CUT_OUT it only has LINES is it something from 1.14 version ...

I have tried with RenderLayer.getCutOut() and it works thanks !!

 

  • matt1999rd changed the title to [solved][1-15] new block window not rendering correctly
  • 2 months later...
  • 3 weeks later...
Posted (edited)
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
  • 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

    • The game crashed whilst unexpected error Error: net.minecraftforge.fml.ModLoadingException: Advanced Mining Dimension (mining_dimension) encountered an error during the done event phase
    • Here is the end of the log. it was way too big to put in pastebin, but I started from when I was online and everything was fine. Error should be in here: https://pastebin.com/Sdhdq593
    • Update: I stand corrected as I was able to dig up a relevant log from my earlier testing which highlights the overall issue but does not explain how to solve it. See, Diagnostic Logs for pack.mcmeta not found: https://pastebin.com/LXS8Rtna
    • Which mod was this? What are all the mods that were in use? It will help if enough information to replicate the problem is available.
    • I have been attempting to create a supplementary resource pack with Patchouli in order to add back the guidebook for Better End but unfortunately in every prototype I have made pack.mcmeta and my resource pack are not recognized. I have tested both zipped and unzipped and either way curseforge does not recognize my resource pack as existing. For testing I stripped my pack down to just the pack.mcmeta file and two empty folders labelled data and assets and I know the data folder is not the problem as firstly my first attempts just had an assets folder following Patchouli instructions and data came later in my flailing attempts to make anything in my pack work. The mcmeta file is not recognized whether or not I use this:  { "pack": { "pack_format": 15, "description": "A replacement for the BetterEnd Guide Book." } "language": { "en_US": { "name": "English", "region": "United States" } } } ,or this:  { "pack": { "pack_format": 15, "description": "A replacement for the BetterEnd Guide Book." } } I have made sure to only use lowercase and the pack folder is named better-end-guide. Is this some magic nonsense from me doing this manually instead of using an IDE or similar tool? Could it be because my files are by default in UTF-8 even though ANSI gives the same results? Is there a specific community secret tool I am supposed to use for zipping or specific settings? I am pulling my hair in distress. Unfortunately as there are no errors involved I lack logs to offer, if that disqualifies this thread please do not be harsh and instead if you can then please direct me to a forum with different rules and sufficiently respectful but knowledgeable as to be of assistance. Most of my experience with the programming community has been poor and so naturally I find myself wary.
  • Topics

×
×
  • Create New...

Important Information

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