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

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.