I am trying to put something in a players hands during an interaction with a sign. The old ID I had for a saddle was 900. Is there are list of the ID numbers anywhere or do I have to make a routine and look at them one by one. Maybe I need to look at a SQLdatabase? If so point me in the right direction. Thanks.
Is there a list of the item numbers?
- angriff
- Thread is marked as Resolved.
-
-
keep in mind some of these items are not currently in game. also some you may have to add a variation to.
-
I wouldn't recommend using IDs for items and objects. These may change in the future, so it's better to work with the internal item name (which will never change). The API provides access to the item definitions, so if you know the internal item name (the same name that's used ingame to spawn an item), you can get the item definition for that:
If you want to compare items or item definitions, it's safe to use the id field of course.
If you have an Item instance, there is also a getDefinition() method to get the definition of that item. This way you can easily check what kind of item that is.
Example: if a player picks up an item from the ground and you want to check if it's a saddle:
Alternatively you can also check the item name of course. Saddles for horses are called "saddlehorse", so the check would look like this:
Or alternatively get the related clothing definition (since saddles are considered "Clothing" items) and check if it's a saddle (clothing defs have a so called "function" which defines special behaviour):
JavaTo give a new item to the player (e.g. a torch), it could look like this:
-
Oh I thought that was why you left gaps in the item number list for additions and changes. I used the item numbers in my older JAVA day routines. Thanks for the pointers.
-
So to Give a player something I was trying to put it into their equipped hand slot but I keep getting a lossy conversion error with the getQuckslotFocu. I was using the item id (not def) because it allowed for slot
This was giving back the player some like leather, which had to be in his hands when he was making it, if the routine was not able to make what he was buying for some reason like full inventory.
player.getInventory().addItemToSlot((short)178, 0, 10, inventory.getQuickslotFocus(), Inventory.SlotType.Quickslot);
additemtoslot calls for an int for slot number. Are they returned in long or short from getQuickslotFocus()? The API is not clear to me what precision format is returned from getQuickslotFocus().
-
Nevermind I got this to work and likely it was the problem of Properties being set to Java8 or that it tried to pull in the old RisingworldAPI933 that was in the old Netbeans project I was modifying.
I do have a question on chat colors. Can you still imbed them in chat statements?
player.sendTextMessage("[#cc0000] Checking");
What did it change too? Can you force the chat screen open to show messages. Seems when I send them they are not showing unless I hit T.
-
Nevermind I got this to work and likely it was the problem of Properties being set to Java8 or that it tried to pull in the old RisingworldAPI933 that was in the old Netbeans project I was modifying.
I do have a question on chat colors. Can you still imbed them in chat statements?
player.sendTextMessage("[#cc0000] Checking");
What did it change too? Can you force the chat screen open to show messages. Seems when I send them they are not showing unless I hit T.
they should show automatically. i believe to set chat color it would be something like
im not sure if you can use color(int) for text in chat. if your setting font color to a UIElement i do
if you use an rgba to hex color picker it will show as #ffffffff but you can remove the # and add 0x to get your color.
-
take a look at this New Plugin UI ant this New API vs. old API
-
take a look at this New Plugin UI ant this New API vs. old API
Ya I did see that.. but this font color used to work directly in the message statement.
-
OH drat I just missed it in the API, Sorry, you have to add color = and turn it off /color
player.sendTextMessage("<color=#FF0000>This is a red text</color>");
-
Oh I thought that was why you left gaps in the item number list for additions and changes. I used the item numbers in my older JAVA day routines. Thanks for the pointers.
Yes, but if a certain update adds lots of new items, for example, the existing IDs may change. My previous post was perhaps a bit misleading: You still have to work with the IDs, but I just wouldn't recommend to use hard-coded IDs. So instead of
It's usually better to do it this way:
That code will remain compatible with future updates (and it's also obvious which item is about to be added, while the first snippet doesn't provide this information unless you add comments)
OH drat I just missed it in the API, Sorry, you have to add color = and turn it off /color
You don't necessarily have to add a closing tag (unless you want the remaining text to be drawn with default color). But apart from color changes, the new version also supports a lot more rich text tags (identical to the ones that are shown in the sign editor formatting help)
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!