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

if u know java well this is the only help i can help u

 

ex. metadata

public class ItemX extends Item

public int m;

public ItemX(int metaData)
super();
m = metaData;
setUnlocalizedName("texturename" + m);

Items do not have metadata - the getMetadata(int param) is passed the ItemStacks.itemDamage value and the method converts it to the "metadata" desired. So, this call is not for actual metadata, it is to filter out the useless part of the ItemStack's damage value. Normally useful more for ItemBlocks.

  • Author

I got it working :D , i got some ideas from Heltrato about ints and its awesome what i did is my localized name andtexture are gone to this

 

String[] texture = {"blue","yellow"};

 

and i use ints to connect

Just so you understand the bug you are creating... the Item class creates any number of items (all completely different even if given the same name) and each Item (instancde) created is only a prototype of all such items. Therefore, any fields created in the Item class are shared with every item in the game. That includes yours and every other player who has on in their inventory. So, if you create an ItemX (and assign any 'metadata' to that object) then every itemX in the game will have the same metadata.  In other words, every player and every ItemX-based item anywhere in the world will be changed when you change yours. Even the ones in players inventories and chests.

I don't think that is what you want.

  • Author

I dont get how come if a player remove an item like this with metadata removes the same as others. I mean i only use a custom item which is useless for my practice and i use only int so they will become unique

 

i have blue ingot , yellow ingot <-- wth wrong?

I dont get how come if a player remove an item like this with metadata removes the same as others. I mean i only use a custom item which is useless for my practice and i use only int so they will become unique

 

i have blue ingot , yellow ingot <-- wth wrong?

 

The proper way to do what you seem to want (see ItemDye class) is to assign subtypes via Item#hasSubtypes and getIconFromDamage() as well as getSubItems(). The itemStack contains the damage value from which the subItem is determined, not some added field that has no meaning to minecraft.

I told u man if u know java well u can use that but that doesnt mean u only wrote that code yes i do that but i also got some other methods like what the upper guy says. It needs a meaning to minecraft in short

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.