Jump to content

Recommended Posts

Posted

Hi guys! :D I'm creating a new flowers but my question is: how can i place this new flowers in the vanilla Flower Pot (so without creating a specific new one) ?

 

Here is my BlockFlowerMod file:

package mod.mineworld.blocks.mod_plants;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;

import mod.mineworld.MineWorld;
import mod.mineworld.mod_plants;
import mod.mineworld.mod_tabs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
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;

public class BlockFlowerMod extends BlockBush
{
    private static final String[][] flower_names = new String[][] {{"blue_flower"}};
    public static final String[] names = new String[] {"blueFlower"};
    public static final String[] dandelion = new String[] {"dandelion"};
    @SideOnly(Side.CLIENT)
    private IIcon[] icon;
    private int metadata;

    public BlockFlowerMod(int par1)
    {
        super(Material.plants);
        this.metadata = par1;
        this.setCreativeTab(mod_tabs.tabPlantsDecorations);
        this.setStepSound(Block.soundTypeGrass);
    }

    /**
     * Gets the block's texture. Args: side, meta
     */
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int par1, int par2)
    {
        if (par2 >= this.icon.length)
        {
            par2 = 0;
        }

        return this.icon[par2];
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister par1)
    {
        this.icon = new IIcon[flower_names[this.metadata].length];

        for (int i = 0; i < this.icon.length; ++i)
        {
            this.icon[i] = par1.registerIcon(MineWorld.MODID + ":mod_plants/" + flower_names[this.metadata][i]);
        }
    }

    /**
     * Determines the damage on the item the block drops. Used in cloth and wood.
     */
    public int damageDropped(int par1)
    {
        return par1;
    }

    /**
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
     */
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item par1, CreativeTabs par2, List par3)
    {
        for (int i = 0; i < this.icon.length; ++i)
        {
            par3.add(new ItemStack(par1, 1, i));
        }
    }

    public static BlockFlowerMod getBlock(String par1)
    {
        String[] astring = dandelion;
        int i = astring.length;
        int j;
        String s1;

        for (j = 0; j < i; ++j)
        {
            s1 = astring[j];

            if (s1.equals(par1))
            {
                return mod_plants.blue_flower;
            }
        }

        astring = names;
        i = astring.length;

        for (j = 0; j < i; ++j)
        {
            s1 = astring[j];

            if (s1.equals(par1))
            {
                return mod_plants.blue_flower;
            }
        }

        return null;
    }

    public static int func_149856_f(String par1)
    {
        int i;

        for (i = 0; i < dandelion.length; ++i)
        {
            if (dandelion[i].equals(par1))
            {
                return i;
            }
        }

        for (i = 0; i < names.length; ++i)
        {
            if (names[i].equals(par1))
            {
                return i;
            }
        }

        return 0;
    }
}

 

Thanks in advice for all who will help me :D

Don't blame me if i always ask for your help. I just want to learn to be better :)

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.

Announcements



×
×
  • Create New...

Important Information

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