Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

I had the same issue, see here:

for how to fix it.

 

Edit: this thread is also helpful:

 

Edited by felinoid
add

  • Author

Thanks for replying, but my issue still persists. This is my texture: ancient_leaves_withered.png.b654acd56da6bb8b19d8e515f2c97367.png, but the block looks like this:

2020-05-27_14_53_45.thumb.jpg.3edf607645f86f0e8baa9d05529963ef.jpg

What render layer is your block on?

Please also post your code, preferably as a GitHub repo.

Edited 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.

 

 

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

 

 

  • 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.

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

 

 

  • 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.

  • 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.

  • Budschie changed the title to [1.15.2] [Solved] How to archive transparent leaves?
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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.