Posted December 7, 20213 yr 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, 20213 yr by samjviana more info
December 7, 20213 yr Author 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; }
December 7, 20213 yr Author 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
December 7, 20213 yr Author 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.
December 7, 20213 yr 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
December 7, 20213 yr Author 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.
December 7, 20213 yr Author 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, 20213 yr by samjviana
December 7, 20213 yr post a git repo so i can debug this local, since your code looks okay it should work Edited December 7, 20213 yr by Luis_ST
December 7, 20213 yr Author 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
December 7, 20213 yr 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
December 7, 20213 yr Author 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
January 3, 20223 yr Author 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?
January 3, 20223 yr unfortunately it doesn't work for me either, the reason for that is that skipRendering is not called but i have no idea why
January 3, 20223 yr Author 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.
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.