Jump to content

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

Posted

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

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.