Shark people
I'm currently programming a Minecraft lobby system and of course this also includes a player hider.
My question:
How can I in the item stack e.g. Add green dye?
Things like Dye_green / green_dye etc. Didn't work.
Which Minecraft version?
Depending on the version, it works differently.
1.8. *
Would the IDs go too?
I don't know - depending on how you integrate them into the plugin
By passing a subID when creating the item stack. Example:
ItemStack itemStack = new ItemStack (Material, amount, (short) subId);
Try lime_dye and dye: 2
Can you give an example please
Does not work…
When I search for dye, come only dye and no color selection
SubId should be (byte) or not?
Um, then I have no idea: /
Sry am a beginner…
You just have to take the dye material for the material, instead of writing down the number, and instead of subId the number for the color…
ItemStack color = new ItemStack (Material.DYE, 1, (byte) 5);
gives you e.g. A purple color.
Maybe instead of that
(short) have to write a (byte). Like my answer.
ItemStack redcolor = new ItemStack (Material.DYE, 1, (byte) 1);
for red color.
ItemStack greencolor = new ItemStack (Material.DYE, 1, (byte) 10);
for green color.
If you want any other color, just swap the number behind byte. You can see which color has which number here, in "Item Data": https://minecraftitemids.com/types/dye
When asked, he stands on 1.8 …
Then why do you give him an answer for 1.13 …
How should I use / change this:
if (e.getItem (). GetType () == Material.BLAZE_ROD && e.getItem (). GetItemMeta (). GetDisplayName (). EqualsIgnoreCase ("6lHide player")) {
final inventory inv = Bukkit.createInventory ((InventoryHolder) e.getPlayer (), 27, this.nameHide);
final ItemStack itemSee = new ItemStack (Material.BLAZE_ROD);
final ItemMeta itemmetaSee = itemSee.getItemMeta ();
itemmetaSee.setDisplayName (this.nameHideSee);
itemSee.setItemMeta (itemmetaSee);
final ItemStack itemVIP = new ItemStack (Material.NETHER_STAR);
final ItemMeta itemmetaVIP = itemVIP.getItemMeta ();
itemmetaVIP.setDisplayName (this.nameHideVIP);
itemVIP.setItemMeta (itemmetaVIP);
final ItemStack itemNone = new ItemStack (Material.BARRIER);
final ItemMeta itemmetaNone = itemNone.getItemMeta ();
itemmetaNone.setDisplayName (this.nameHideVIP);
itemNone.setItemMeta (itemmetaNone);
Should be both - I always use a short anyway.
It does not work
DYE can't be resolved or is not a field
Oh sorry!
take
Material.INK_SACK
instead of Material.DYE
No problem.
Then can I also dye it green? So in the code yk wim
Jo, you can.
Simply the same code as above.
Just INK_SACK instead of DYE
So?:
ItemStack greencolor = new ItemStack (Material.INK_SACK, 1, (byte) 10);
ItemStack purplecolor = new ItemStack (Material.INK_SACK, 1, (byte) 5);
ItemStack redcolor = new ItemStack (Material.INK_SACK, 1, (byte) 1);
How am I supposed to get this in here?
if (e.getItem (). GetType () == Material.BLAZE_ROD && e.getItem (). GetItemMeta (). GetDisplayName (). EqualsIgnoreCase ("6lHide player")) {
final inventory inv = Bukkit.createInventory ((InventoryHolder) e.getPlayer (), 27, this.nameHide);
final ItemStack itemSee = new ItemStack (Material.BLAZE_ROD);
final ItemMeta itemmetaSee = itemSee.getItemMeta ();
itemmetaSee.setDisplayName (this.nameHideSee);
itemSee.setItemMeta (itemmetaSee);
final ItemStack itemVIP = new ItemStack (Material.NETHER_STAR);
final ItemMeta itemmetaVIP = itemVIP.getItemMeta ();
itemmetaVIP.setDisplayName (this.nameHideVIP);
itemVIP.setItemMeta (itemmetaVIP);
final ItemStack itemNone = new ItemStack (Material.BARRIER);
final ItemMeta itemmetaNone = itemNone.getItemMeta ();
itemmetaNone.setDisplayName (this.nameHideVIP);
itemNone.setItemMeta (itemmetaNone);
Simply replace all three "final item stack name = new item stack (…)" in brackets.
so (Material.BLAZE_ROD) with (Material.INK_SACK, 1, (byte) 10)
Jo, exactly like that
I just googled. I don't play Minecraft anymore.
Exactly. Byte is just too short compatible