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.

wojtab

Members
  • Joined

  • Last visited

  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?

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.