Jump to content

Recommended Posts

Posted (edited)

[ANSWERED]

How do I make my Blocks have an Opacity like Glass

I tried going to another question but I couldn't find my answer

 

I tried using isOpaqueCube from Block.java

but It throughs an error because it is final

@Override
public final boolean isOpaqueCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
    return false;
}

 

I do not know how to do this can someone please help.

 

here is my code:

Spoiler

import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; public class Plexiglass extends Block { public Plexiglass() { super(Properties.create(Material.GLASS) .sound(SoundType.METAL) .hardnessAndResistance(5.0f) .lightValue(14) .harvestTool(ToolType.PICKAXE) .variableOpacity() ); setRegistryName("plexiglass"); } }

 

Edited by MrNoodles75
Posted

For a similar effect in my mod (translucent crystal), I override isOpaqueCube and getBlockLayer in my block class.

 

	@Override
	public boolean isOpaqueCube(IBlockState state)
	{
		return false;
	}
	
	@SideOnly(Side.CLIENT)
	public BlockRenderLayer getBlockLayer()
	{
		return BlockRenderLayer.TRANSLUCENT;
	}

 

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted

@SerpentDagger

 
 
0
 Advanced issues found
 
 
4 minutes ago, SerpentDagger said:

For a similar effect in my mod (translucent crystal), I override isOpaqueCube and getBlockLayer in my block class.

 


	@Override
	public boolean isOpaqueCube(IBlockState state)
	{
		return false;
	}
	
	@SideOnly(Side.CLIENT)
	public BlockRenderLayer getBlockLayer()
	{
		return BlockRenderLayer.TRANSLUCENT;
	}

 

I'm pretty sure this is for 1.12 correct?

Posted
2 minutes ago, MrNoodles75 said:

 

I'm pretty sure this is for 1.12 correct?

That's correct, I'm using 1.12.2. I didn't think those methods would have changed between versions, but it's possible that they did. If so, I'm sorry about the confusion.

You may still need to override the two of them, but if it's significantly different in 1.14, then you should take my advice with a grain of salt.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
38 minutes ago, SerpentDagger said:

public BlockRenderLayer getBlockLayer()

33 minutes ago, MrNoodles75 said:

I'm pretty sure this is for 1.12 correct?

It's called getRenderLayer now, and it is the only thing you have to override.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.