M-C Posted December 2, 2012 Posted December 2, 2012 I wasn't sure if I should make a new thread or post this in the sticky... But I'm having a problem. I just started to learn modding and decided to make a transparent block (reinforced glass, to be exact). Now nearly everything is fine about the block, except for one thing. When I place it on the floor, I can see through the entire world looking through the block... I'll add a picture if I really need to.. But for now, here's the code: The basic code: package azmod.common; import net.minecraft.src.Block; import net.minecraft.src.Item; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "azmod", name = "azmod", version = "1.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Basic { public static Block ReinforcedGlass; @SidedProxy(clientSide = "azmod.common.azmodClient", serverSide= "azmod.common.azmodProxy") public static azmodProxy proxy; @Init public void load(FMLInitializationEvent event) { proxy.registerRenderInformation(); ReinforcedGlass = new BlockReinforcedGlass(175, 0).setHardness(40F).setStepSound(Block.soundGlassFootstep).setBlockName("Reinforced Glass"); GameRegistry.registerBlock(ReinforcedGlass); LanguageRegistry.addName(ReinforcedGlass, "Reinforced Glass"); } } And inside the block: package azmod.common; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Material; public class BlockReinforcedGlass extends Block { public BlockReinforcedGlass(int i, int j) { super(i, j, Material.glass); this.setCreativeTab(CreativeTabs.tabBlock); } public String getTextureFile() { return "/azmod/texture.png"; } }
Neowulf Posted December 2, 2012 Posted December 2, 2012 net.minecraft.src.BlockGlass In the MCP+forge decompile under common /** * Is this block (a) opaque and ( a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; }[/code
M-C Posted December 2, 2012 Author Posted December 2, 2012 net.minecraft.src.BlockGlass In the MCP+forge decompile under common /** * Is this block (a) opaque and ( a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; }[/code Thank you, you saved the day . it works now ^.^
Neowulf Posted December 2, 2012 Posted December 2, 2012 If you're trying to do something a vanilla block already does, go look it over and see if anything stands out.
M-C Posted December 2, 2012 Author Posted December 2, 2012 If you're trying to do something a vanilla block already does, go look it over and see if anything stands out. Aha, thanks for the tip. Fun, time to test the glass with some creepers :D
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now