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

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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