Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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;

}

}

 

Don't just copy vanilla code. Making a flower isn't that hard. Just make a block that overrides getRenderType, has a null collision bounding box and can only be placed on dirt or grass.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

Thank you! I tried what you said, and it worked! It diffidently makes it easier if you extend block bush though.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.