Posted May 27, 20205 yr Hello. I want to archive a block which has a transparent texture. I've already found out how to do basic transparency, but when I try to use a texture which has an other alpha value than 0 or 255, the alpha value for that pixel changes to 255. Thanks for any help.
May 27, 20205 yr I had the same issue, see here: for how to fix it. Edit: this thread is also helpful: Edited May 27, 20205 yr by felinoid add
May 27, 20205 yr Author Thanks for replying, but my issue still persists. This is my texture: , but the block looks like this:
May 27, 20205 yr What render layer is your block on? Please also post your code, preferably as a GitHub repo. Edited May 27, 20205 yr by DavidM Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
May 27, 20205 yr Author @DavidM Here is my github repo: https://github.com/Budschie/Deepnether-Mod/ I use the translucent render layer, but I also tried cutout and cutout mipped, but those didn't work either. By the way, I have no idea how the render layers work, what performance impact they have etc.
May 27, 20205 yr Author I also noticed a weird behaviour of the block rendering, the pixels are flickering a bit.
May 27, 20205 yr 8 hours ago, Budschie said: @DavidM Here is my github repo: https://github.com/Budschie/Deepnether-Mod/ I use the translucent render layer, but I also tried cutout and cutout mipped, but those didn't work either. By the way, I have no idea how the render layers work, what performance impact they have etc. You may find this info helpful https://greyminecraftcoder.blogspot.com/2020/04/block-rendering-1144.html 8 hours ago, Budschie said: I also noticed a weird behaviour of the block rendering, the pixels are flickering a bit. Flickering normally means that you're trying to render two quads directly on top of each other (called 'z-fighting'). Remove one of the quads or move it slightly (say 0.001) Is your block supposed to be translucent (like ice) or have holes (like glass block or leaves)? The first one needs transparent layer, the second needs cutout layer. -TGG
May 28, 20205 yr Author @TheGreyGhost I'm sure it is not z-fighting, because there is no pattern that usually occurs when I have z-fighting. The whole brightness of the pixel changes. 10 hours ago, TheGreyGhost said: Is your block supposed to be translucent (like ice) or have holes (like glass block or leaves)? The first one needs transparent layer, the second needs cutout layer. It should be translucent like for example ice. But when I set the RenderLayer to translucent, the alpha is still either 0 or 255.
May 28, 20205 yr Howdy I looked at your github repo but it doesn't compile. -TGG eg C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: class StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: class StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: variable StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: variable StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: variable StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:97: error: cannot find symbol RenderTypeLookup.setRenderLayer(BlockInit.ANCIENT_LEAVES, RenderType.getTranslucent()); ^ symbol: variable ANCIENT_LEAVES location: class BlockInit C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:98: error: cannot find symbol RenderTypeLookup.setRenderLayer(BlockInit.ANCIENT_WITHERED_LEAVES, RenderType.getTranslucent()); ^ symbol: variable ANCIENT_WITHERED_LEAVES location: class BlockInit
May 28, 20205 yr Author @TheGreyGhost That's strange. It could be because I use AdoptOpenJDK as a compiler. I run my project with the minecraft jre. Make sure to use java 1.8. Maybe that will fix the problem.
May 30, 20205 yr Author I finally managed to solve my issue: I just had to extend my ModLeavesBlock from BreakableBlock instead of LeavesBlock. That fixed the transparency issue... But I'm not exactly sure why. Maybe some instanceof checking.
May 30, 20205 yr 4 hours ago, Budschie said: I finally managed to solve my issue: I just had to extend my ModLeavesBlock from BreakableBlock instead of LeavesBlock. That fixed the transparency issue... But I'm not exactly sure why. Maybe some instanceof checking. Ah, yeah you're right. Vanilla does have a few of these dirty "quick fixes" hidden away in the guts of the code. @Deprecated public static RenderType getChunkRenderType(BlockState blockStateIn) { Block block = blockStateIn.getBlock(); if (block instanceof LeavesBlock) { return fancyGraphics ? RenderType.getCutoutMipped() : RenderType.getSolid(); } else { RenderType rendertype = TYPES_BY_BLOCK.get(block); return rendertype != null ? rendertype : RenderType.getSolid(); } } and public static boolean canRenderInLayer(BlockState state, RenderType type) { Block block = state.getBlock(); if (block instanceof LeavesBlock) { return fancyGraphics ? type == RenderType.getCutoutMipped() : type == RenderType.getSolid(); } else { java.util.function.Predicate<RenderType> rendertype; synchronized (RenderTypeLookup.class) { rendertype = blockRenderChecks.get(block.delegate); } return rendertype != null ? rendertype.test(type) : type == RenderType.getSolid(); } }
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.