Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How do I make a translucent block?


Recommended Posts

Posted (edited)

I'm trying to make a custom glass but I don't know how to make it transparent 

package fr.lithium.nirvana.Bases.Blocks;

import net.minecraft.block.AbstractGlassBlock;


public class GlassBase extends AbstractGlassBlock {

    public GlassBase(Properties p_i49999_1_) {
        super(p_i49999_1_);
    }
}

I guess I need to had an

@OnlyIn(Dist.CLIENT)
	RenderType.State.Builder() bkrebojn ;

but I don't know how it works and I didn't find any things about it in docs

Where the block is Init:

Spoiler

package fr.lithium.nirvana.init;

import fr.lithium.nirvana.Bases.Blocks.BlockBase;
import fr.lithium.nirvana.Bases.Blocks.GlassBase;
import fr.lithium.nirvana.NIRVANA;
import fr.lithium.nirvana.utils.ModItemGroups;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;


public class ModBlocks {
    public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, NIRVANA.MODID);

    public static final RegistryObject<Block> BLOODY_GLASS = BlockBase.CreateBlock("bloody_glass", () -> new GlassBase(AbstractBlock.Properties.of(Material.GLASS).strength(0.3F).sound(SoundType.GLASS).noOcclusion()), new Item.Properties().tab(ModItemGroups.NIRVANA_TAB));

   }

 

And I also want to make it act like the Tconstructs clear glass

Edited by Yourou1000
Link to post
Share on other sites
1 hour ago, Yourou1000 said:

@OnlyIn(Dist.CLIENT)
RenderType.State.Builder() bkrebojn ;

what is this supposed to do?

if you want your block to be transparent,
you have to add a RenderType to it in FMLClientSetupEvent

Link to post
Share on other sites

If anybody need it:

private void ClientSetUp(FMLClientSetupEvent e){
        RenderTypeLookup.setRenderLayer(ModBlockInit.YOUR_BLOCK.get(), RenderType.translucent());
    }

and thx for your time and your help Luis ^^

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.