Jump to content

[1.8] Custom glass block won't render as transparent


xStuffAndThingz

Recommended Posts

I'm making a type of glass for my mod, and I've coded the json files properly, and the texture I'm using is transparent. The glass renders as transparent in my hand and in my inventory, but when I place it down there's a weird black texture in the areas where it should be transparent. Does anyone know what could be wrong?

 

This is my code for the glass block's class.

package xstuffmods.rfnp.blocks;

import xstuffmods.rfnp.RFnP;
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class GreenhouseGlass extends BlockBreakable{

public GreenhouseGlass(Material materialIn, boolean ignoreSimilarityIn) {
	super(materialIn.glass, ignoreSimilarityIn);
	GameRegistry.registerBlock(this, "greenhouseGlass");
	setUnlocalizedName("greenhouseGlass");
	setStepSound(soundTypeGlass);
	setHardness(1.0F);
	setResistance(0.0F);
	setCreativeTab(RFnP.cTab);
	// TODO Auto-generated constructor stub
}

}

Link to comment
Share on other sites

try adding this to your glass class:

@Override

public EnumWorldBlockLayer getBlockLayer() {

 

return EnumWorldBlockLayer.CUTOUT;

}

 

 

example:

 

package xstuffmods.rfnp.blocks;

 

import xstuffmods.rfnp.RFnP;

import net.minecraft.block.BlockBreakable;

import net.minecraft.block.material.Material;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class GreenhouseGlass extends BlockBreakable{

 

public GreenhouseGlass(Material materialIn, boolean ignoreSimilarityIn) {

super(materialIn.glass, ignoreSimilarityIn);

GameRegistry.registerBlock(this, "greenhouseGlass");

setUnlocalizedName("greenhouseGlass");

setStepSound(soundTypeGlass);

setHardness(1.0F);

setResistance(0.0F);

setCreativeTab(RFnP.cTab);

// TODO Auto-generated constructor stub

}

 

        @Override

public EnumWorldBlockLayer getBlockLayer() {

 

return EnumWorldBlockLayer.CUTOUT;

}

}

 

 

 

I believe this should fix your problem

Link to comment
Share on other sites

To allow transparency in models you need to override two Block methods with the methods below:

 

@Override

public boolean isOpaqueCube() {

return false;

}

 

@Override

public EnumWorldBlockLayer getBlockLayer() {

return EnumWorldBlockLayer.CUTOUT;

}

 

The method isOpaqueCube is set to false already by you extending BlockBreakable instead of Block. This third method below might help some shading bugs. Hope it works out.

 

@Override

public boolean isFullCube() {

        return false;

}

 

Link to comment
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.
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.