Jump to content

Making a Flower


gosaints70

Recommended Posts

Hi, I have looked all over and I can not find a tutorial on how to make a flower/flower blocks. I have attempted to replicate the file for the flowers, but it did not work. I also added ItemFlowerBlock but that didn't help either.

 

Flower Main File

 

package com.crystal.block;

 

import java.util.List;

 

import com.crystal.creativetab.CreativeTabsManager;

 

import net.minecraft.block.BlockBush;

import net.minecraft.block.BlockFlower;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.IIcon;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class OverWorldFlowers extends BlockBush {

{

this.setCreativeTab(CreativeTabsManager.tabF);

}

    private static final String[][] field_149860_M = new String[][] {{}, {}};

    public static final String[] field_149859_a = new String[] {"Ariculapurple", "Ariculared", "Irisblue", "Irispurple", "Irisred", "Iriswhite"};

    public static final String[] field_149858_b = new String[] {};

    @SideOnly(Side.CLIENT)

    private IIcon[] field_149861_N;

    private int field_149862_O;

    private static final String __OBFID = "CL_00000246";

 

    protected OverWorldFlowers(int p_i2173_1_)

    {

        super(Material.plants);

        this.field_149862_O = p_i2173_1_;

    }

 

    /**

    * Gets the block's texture. Args: side, meta

    */

    @SideOnly(Side.CLIENT)

    public IIcon getIcon(int p_149691_1_, int p_149691_2_)

    {

        if (p_149691_2_ >= this.field_149861_N.length)

        {

            p_149691_2_ = 0;

        }

 

        return this.field_149861_N[p_149691_2_];

    }

 

    @SideOnly(Side.CLIENT)

    public void registerBlockIcons(IIconRegister p_149651_1_)

    {

        this.field_149861_N = new IIcon[field_149860_M[this.field_149862_O].length];

 

        for (int i = 0; i < this.field_149861_N.length; ++i)

        {

            this.field_149861_N = p_149651_1_.registerIcon(field_149860_M[this.field_149862_O]);

        }

    }

 

    /**

    * Determines the damage on the item the block drops. Used in cloth and wood.

    */

    public int damageDropped(int p_149692_1_)

    {

        return p_149692_1_;

    }

 

    /**

    * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)

    */

    @SideOnly(Side.CLIENT)

    public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_)

    {

        for (int i = 0; i < this.field_149861_N.length; ++i)

        {

            p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));

        }

    }

/*

    public static OverWorldFlowers func_149857_e(String p_149857_0_)

    {

        String[] astring = field_149858_b;

        int i = astring.length;

        int j;

        String s1;

 

        for (j = 0; j < i; ++j)

        {

            s1 = astring[j];

 

            if (s1.equals(p_149857_0_))

            {

                return Blocks.yellow_flower;

            }

        }

 

        astring = field_149859_a;

        i = astring.length;

 

        for (j = 0; j < i; ++j)

        {

            s1 = astring[j];

 

            if (s1.equals(p_149857_0_))

            {

                return Blocks.red_flower;

            }

        }

 

        return null;

    }

    */

 

    public static int func_149856_f(String p_149856_0_)

    {

        int i;

 

        for (i = 0; i < field_149858_b.length; ++i)

        {

            if (field_149858_b.equals(p_149856_0_))

            {

                return i;

            }

        }

 

        for (i = 0; i < field_149859_a.length; ++i)

        {

            if (field_149859_a.equals(p_149856_0_))

            {

                return i;

            }

        }

 

        return 0;

    }

}

 

 

ItemFlowerBlock

 

package com.crystal.item;

 

import net.minecraft.block.Block;

import net.minecraft.item.ItemBlock;

import net.minecraft.item.ItemStack;

 

public class ItemFlowerBlock extends ItemBlock{

 

public static final String[] field_149859_a = new String[] {"Ariculapurple", "Ariculared", "Irisblue", "Irispurple", "Irisred", "Iriswhite"};

 

public ItemFlowerBlock(Block block) {

super(block);

// TODO Auto-generated constructor stub

this.setHasSubtypes(true);

}

public String getUnlocalizedName(ItemStack itemstack) {

int i = itemstack.getItemDamage();

if (i < 0 || i >=field_149859_a.length) {

i = 0;

}

return super.getUnlocalizedName() + "." + field_149859_a;

}

 

public int getMetaData (int meta) {

return meta;

}

}

 

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.