Jump to content

Recommended Posts

Posted

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";

    }

}

Posted

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

Posted

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 :P. it works now ^.^

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...