samjviana Posted December 7, 2021 Share Posted December 7, 2021 (edited) How can i make the transparency of an block work just like the SlimeBlock, as shown in the image: By now i'm setting the RenderLayer of the block to RenderType.translucent() and also extending the HalfTransparentBlock in my block. Edited December 7, 2021 by samjviana more info Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 show your Block class and your Registration Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 9 minutes ago, Luis_ST said: show your Block class and your Registration Block class: Spoiler public class ColoredSlimeBlock extends SlimeBlock { public ColoredSlimeBlock(Properties properties) { super(properties); } @Override public boolean isStickyBlock(BlockState state) { return true; } } The registration: Spoiler @OnlyIn(Dist.CLIENT) public static Object clientOnlySetup() { for (RegistryObject<Block> regBlock : ModBlocks.BLOCKS.getEntries()) { if (regBlock.get() instanceof ColoredSlimeBlock) { ItemBlockRenderTypes.setRenderLayer(regBlock.get(), RenderType.translucent()); } } ... return null; } Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 show your Block Registration and do never use @OnlyIn it's only for vanilla Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 1 hour ago, Luis_ST said: show your Block Registration and do never use @OnlyIn it's only for vanilla @SubscribeEvent public static void onRegisterItem(final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); ModBlocks.BLOCKS.getEntries().stream().map(RegistryObject::get).forEach((block) -> { final Item.Properties properties; if (shouldHide(block)) { return; } else if (isBlockItem(block)) { properties = new Item.Properties().tab(ModCreativeTab.ITEMS); } else { properties = new Item.Properties().tab(ModCreativeTab.BLOCKS); } final BlockItem blockItem = new BlockItem(block, properties); blockItem.setRegistryName(block.getRegistryName()); registry.register(blockItem); }); } Did'n know about the OnlyIn thing, thanks Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 this is the Item Registration Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 4 minutes ago, Luis_ST said: this is the Item Registration have to admit that i don't have an Block Registration 😳, thought that only the item registration was necessary. But the block works fine. Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 20 minutes ago, samjviana said: thought that only the item registration was necessary. you need to register the Block itself and the BlockItem for it Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 4 minutes ago, Luis_ST said: you need to register the Block itself and the BlockItem for it @SubscribeEvent public static void onRegisterBlock(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); ModBlocks.BLOCKS.getEntries().stream().map(RegistryObject::get).forEach((block) -> { registry.register(block); }); } just did the block registration, but the block transparency remains the same. Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 show the Registry Entry of your ColoredSlimeBlock Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 (edited) 4 minutes ago, Luis_ST said: show the Registry Entry of your ColoredSlimeBlock public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, BunchOfThings.MODID); public static final RegistryObject<Block> BLACK_SLIME_BLOCK = BLOCKS.register("black_slime_block", () -> { return new ColoredSlimeBlock(BlockBehaviour.Properties.of(Material.CLAY).friction(0.8f).sound(SoundType.SLIME_BLOCK).noOcclusion()); }); Edited December 7, 2021 by samjviana Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 (edited) post a git repo so i can debug this local, since your code looks okay it should work Edited December 7, 2021 by Luis_ST Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 24 minutes ago, Luis_ST said: post a git repo so i can debug this local, since your code looks okay it should work Done ... https://github.com/samjviana/bunchofthings i think it's the default one, but it's the 1.17.1 branch Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 7, 2021 Share Posted December 7, 2021 i've test your code and unfortunately i can't tell you what'S exactly is the problem the only thing i can tell you is that HalfTransparentBlock#skipRendering is not called, but i don't know why sorry Quote Link to comment Share on other sites More sharing options...
samjviana Posted December 7, 2021 Author Share Posted December 7, 2021 1 hour ago, Luis_ST said: i've test your code and unfortunately i can't tell you what'S exactly is the problem the only thing i can tell you is that HalfTransparentBlock#skipRendering is not called, but i don't know why sorry I thought that it should be called, place some logs inside it, but it's never called. i could try to create an custom render, kinda copying the translucent, but i think is to much work Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted December 8, 2021 Share Posted December 8, 2021 I will try to reproduce the problem in my own project Quote Link to comment Share on other sites More sharing options...
samjviana Posted January 3, 2022 Author Share Posted January 3, 2022 On 12/8/2021 at 4:24 AM, Luis_ST said: I will try to reproduce the problem in my own project Hi, did you achieve something? Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted January 3, 2022 Share Posted January 3, 2022 unfortunately it doesn't work for me either, the reason for that is that skipRendering is not called but i have no idea why Quote Link to comment Share on other sites More sharing options...
samjviana Posted January 3, 2022 Author Share Posted January 3, 2022 7 hours ago, Luis_ST said: unfortunately it doesn't work for me either, the reason for that is that skipRendering is not called but i have no idea why i'll try to create a new render, if it works i'll come back here with it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.