Jump to content

wojtab

Members
  • Posts

    5
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

wojtab's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Thanks, it worked, I didn't realise that I can look for this method in Item.class, I checked ItemPickaxe and ItemTool, but it wasn't there. TY very much.
  2. Use .setUnlocalizedName("canempty"); at constructor for an block/item ex. can_empty = new itemCan(Blocks.air).setUnlocalizedName("canempty"); then go to game, check what is the name, which is showing: https://www.dropbox.com/s/2fs1jqhx17rvun6/canempty.png and then add in your .lang file shownname=Name of Item, so in my example that would be item.canempty.name=Empty Can .lang files have to go to assets.nameofyourmod.lang and default name for english is en_US.lang. In Your case package would be assets.meca.lang Hope I helped.
  3. Just change public void load(FMLInitializationEvent event) to public void load(FMLPreInitializationEvent event)
  4. FTFY package com.hex.lootbag; import java.util.Random; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemLootBag extends Item { public ItemLootBag() { setUnlocalizedName("itemLootBag"); setCreativeTab(CreativeTabs.tabAllSearch); setTextureName("lootbag:ItemLootBag"); setMaxStackSize(1); } public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { System.out.println("Working!"); if (player.capabilities.isCreativeMode) { player.dropPlayerItemWithRandomChoice(new ItemStack(getRandomItem(), 1), false); return item; }else{ --item.stackSize; player.dropPlayerItemWithRandomChoice(new ItemStack(getRandomItem(), 1), false); return item; } } static Random RANDOM = new Random(); public static Item getRandomItem() { Item i = null; int length = Item.itemRegistry.getKeys().toArray().length; Object select = Item.itemRegistry.getObjectById(ItemLootBag.RANDOM.nextInt(length)); if(select != null && select instanceof Item) { i = (Item) select; } else { return getRandomItem(); } return i; } }
  5. Hi, I want to do something like autosmelting pickaxe, or like Thaumcraft's Pickaxe of the core, but I just don't know how to deal with it. First of all I don't know where to put Random, because if I put it in function func_150897_b (which should be named canToolBreak or something) it's called multiple times. I could set return of this function to always be false and spawn my item in onBlockDestroyed, but that just makes speed of breaking blocks as if I were breaking them with a fist. So my question is - could I still be breaking blocks at reasonable speed without them dropping?
×
×
  • Create New...

Important Information

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