Jump to content

Need help with first mod


M-C

Recommended Posts

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

    }

}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ^.^

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...