The Meaning of Life, the Universe, and Everything.
Location:
The Island of Koridai
Join Date:
8/7/2013
Posts:
78
Location:
Look behind you...
Minecraft:
RandomMcSomethin
Member Details
How would one detect whether a player has a block in their inventory? I'm aware of hasItem, but that's just for items, it seems. On that subject, how can you use blocks in place of items?
Use Item.getItemFromBlock to get the Item form of a Block (if any).
Side note: 1.7.10 is very outdated at this point, I strongly recommend updating to 1.9.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Use InventoryPlayer#hasItemStack to check if the player's inventory contains an ItemStack with the specified Item and metadata.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Upload your code to Gist or Pastebin with syntax highlighting and describe in more detail how it isn't working.
To get syntax highlighting on Gist, give each file the appropriate extension (.java for Java code). To get syntax highlighting on Pastebin, select the language from the dropdown at the bottom of the page.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
How would one detect whether a player has a block in their inventory? I'm aware of hasItem, but that's just for items, it seems. On that subject, how can you use blocks in place of items?
Insert generic overused signature here
Make a custom ItemBlock class
Thanks for the quick reply; I'll try that and see if it works
Insert generic overused signature here
Actually, could you please go into detail on what I need to do once I've created the class?
Insert generic overused signature here
Use Item.getItemFromBlock to get the Item form of a Block (if any).
Side note: 1.7.10 is very outdated at this point, I strongly recommend updating to 1.9.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Thanks
Insert generic overused signature here
Is there a way to detect block metadata as well?
Insert generic overused signature here
Use InventoryPlayer#hasItemStack to check if the player's inventory contains an ItemStack with the specified Item and metadata.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I can't get this to work with blocks for some reason
Insert generic overused signature here
Upload your code to Gist or Pastebin with syntax highlighting and describe in more detail how it isn't working.
To get syntax highlighting on Gist, give each file the appropriate extension (.java for Java code). To get syntax highlighting on Pastebin, select the language from the dropdown at the bottom of the page.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Thanks, I'll do that tomorrow
Insert generic overused signature here