Jump to content

Recommended Posts

Posted (edited)

How can i make the transparency of an block work just like the SlimeBlock, as shown in the image:
Vir9cqZ.png

By now i'm setting the RenderLayer of the block to RenderType.translucent() and also extending the HalfTransparentBlock in my block.

Edited by samjviana
more info
Posted
  On 12/7/2021 at 3:57 PM, Luis_ST said:

show your Block class and your Registration

Expand  

Block class: 

  Reveal hidden contents

The registration:

  Reveal hidden contents

 

Posted
  On 12/7/2021 at 4:11 PM, Luis_ST said:

show your Block Registration

and do never use @OnlyIn it's only for vanilla

Expand  
    @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

Posted
  On 12/7/2021 at 6:40 PM, Luis_ST said:

you need to register the Block itself and the BlockItem for it

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

Posted (edited)
  On 12/7/2021 at 6:48 PM, Luis_ST said:

show the Registry Entry of your ColoredSlimeBlock

Expand  
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 by samjviana
Posted

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

Posted
  On 12/7/2021 at 8:45 PM, 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

Expand  

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

  • 4 weeks later...

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



×
×
  • Create New...

Important Information

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