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

package net.minecraft.src;

 

import net.minecraft.src.*;

 

public class ItemTest extends Item

{

 

 

 

public ItemTest(int id)

{

super(id);

setHasSubtypes(true);

setMaxDamage(0);

}

 

private String[] names = new String[] {"name", "name1", "name2", "name3",};

 

public String getNameIS(ItemStack itemstack)

{

return names[itemstack.getItemDamage()];

}

 

    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)

    {

        return 5.0F;

    }

 

 

    public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)

    {

        par1ItemStack.damageItem(1, par6EntityLiving);

        return true;

    }

 

@Override

public int getIconFromDamage(int i)

{

if(i==0)

{

setMaxStackSize(64);

return mod_test.item1;

}

if(i==1)

{

setMaxStackSize(1);

return mod_test.item2;

}

if(i==2)

{

setMaxStackSize(1);

return mod_test.item3;

}

if(i==3)

{

setMaxStackSize(1);

return mod_test.item4;

}

else

{

setMaxDamage(10);

setMaxStackSize(1);

return mod_test.item5;

}

 

 

 

 

}

 

}

 

this is the code and the metadata item is like an shovel... now i need to tell it its an pickaxe... Lex it works.. like i want it! but now i need to tell it that it can breaks a rock.. how?

Crazy Brain...

  • Author

this make it to an ultimate fist:

 

    public boolean canHarvestBlock(Block par1Block)

    {

        return true;

    }

 

how can i make it for only rock?

 

Please answer...

Crazy Brain...

Do a switch of the block's ID in that statement and your item's meta.

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

  • Author

thank you for the answer. but can you show me how i have to write it? like i did my second post. thanks.

Crazy Brain...

  • Author

If i could test per day 8 ours i do not need to ask. but i can test maybe at the week 2/4 ours. the most goes to test the pickaxe thing here and installing forge which is at the moment a pain to install it. hope you help me. thank for reading this.

Crazy Brain...

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.