Posted August 6, 201510 yr 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 } }
August 6, 201510 yr 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
August 7, 201510 yr I had the same problem with glass, but when i used that code I could use the glass like an x-ray: the bottom and top of the block allowed me to see through the world...
August 7, 201510 yr Hi This link might be useful for background info. http://greyminecraftcoder.blogspot.com.au/2014/12/block-rendering-18.html @Yakman - try override Block.isOpaqueCube() to return false. -TGG
August 7, 201510 yr 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; }
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.