Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This should be in your Mod main class under the @Init method.
- //Note that public static Block/Item should be in your @Instance method.
- public static Block Rubarb;
- Rubarb = (new Rubarb(448)).setUnlocalizedName("Rubarb");
- GameRegistry.registerBlock(Rubarb, "Rubarb");
- LanguageRegistry.addName(Rubarb, "Rubarb");
- //Edit name,ID,the BlockId's to whatever your want.
- public static Item rubarb;
- rubarb = (new ItemSeedFood(452, 4, 0.3F, Rubarb.blockID, Block.tilledField.blockID)).setUnlocalizedName("mystique:Rubarb");
- GameRegistry.registerItem(rubarb, "rubarb");
- LanguageRegistry.addName(rubarb, "Rubarb");
- //Here is the Block class for the crop.
- //Change package and names to what fits your mod.Also change or add imports if needed!
- package erikstutorials;
- import net.minecraft.block.BlockCrops;
- import net.minecraft.client.renderer.texture.IconRegister;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.Icon;
- import net.minecraft.world.World;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class Rubarb extends BlockCrops
- {
- @SideOnly(Side.CLIENT)
- private Icon[] iconArray;
- public Rubarb(int par1)
- {
- super(par1);
- }
- @SideOnly(Side.CLIENT)
- /**
- * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
- */
- public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
- {
- if (par2 < 7)
- {
- if (par2 == 6)
- {
- par2 = 5;
- }
- return this.iconArray[par2 >> 1];
- }
- else
- {
- return this.iconArray[3];
- }
- }
- /**
- * Generate a seed ItemStack for this crop.
- */
- protected int getSeedItem()
- {
- return Mod_Main.rubarb.itemID;
- }
- /**
- * Generate a crop produce ItemStack for this crop.
- */
- protected int getCropItem()
- {
- return Mod_Main.rubarb.itemID;
- }
- @SideOnly(Side.CLIENT)
- /**
- * When this method is called, your block should register all the icons it needs with the given IconRegister. This
- * is the only chance you get to register icons.
- */
- public void registerIcons(IconRegister par1IconRegister)
- {
- this.iconArray = new Icon[4];
- for (int i = 0; i < this.iconArray.length; ++i)
- {
- this.iconArray[i] = par1IconRegister.registerIcon("carrots_" + i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment