I would like to spawn a flower with a command. But only the red one comes out. How can I spawn others? ItemStacks is not possible because I can only specify one material when setting.
How I try:
p.getWorld (). GetBlockAt (location) .setType (Material.RED_FLOWER);
Where is the problem?
Simply use the respective flower name instead of RED_FLOWER.
e.g. Dandelion:
p.getWorld (). GetBlockAt (location) .setType (Material.DANDELION);
Here is a list of all flowers: https://minecraft.gamepedia.com/...com/Flower
Here is a list of all materials (including all flowers): https://hub.spigotmc.org/...erial.html
I mean flowers like "RED_FLOWER (short) 1"
Ingame: Blue Orchid
What?
I've never heard of a flower called "RED_FLOWER (short) 1".
If you want a Blue Orchid, just enter BLUE_ORCHID?
Is your server on 1.8?
The material doesn't exist. (1.8.8)
Then please indicate in your question that your server is running on an outdated version. We're not clairvoyants.
You have to specify RED_ROSE with the short 1. That is not a material. Can you convert it now?
New ItemStack (Material.RED_FLOWER, 1, (byte) X)
Instead of the X the number behind the colon, i.e. For a blue orchid e.g. 1.
You can convert the ItemStack into a material by clicking
.getType ()
do.
So:
p.getWorld (). GetBlockAt (location) .setType ((new ItemStack (Material.RED_FLOWER, 1, (byte) 0)). GetType ());
I've already been that far. I just don't know how to turn it into a material. XD
Look here:
https://hub.spigotmc.org/...Stack.html
With .getType ()
But you could have just googled for a short time xD
https://www.spigotmc.org/...ck.156989/
Or just have a look in Intellij / Eclipse, which methods ItemStack has and what they return.
Then it becomes the normal red rose again.
Hööö sure? XD Shouldn't be xD
p.getWorld (). GetBlockAt (location) .setType ((new ItemStack (Material.RED_FLOWER, 1, (byte) 1)). GetType ());
That should spawn a blue orchid.
Already got it. Works differently.
I've now come up with Finally.
For everyone who has the same problem:
p.getWorld (). GetBlockAt (location) .setType (Material.RED_ROSE);
p.getWorld (). GetBlockAt (location) .setData ((byte) 1);
With setData () or?
Apparently you have to set the rose first with setType () and then change it with setData (). Source:
That's when I came up with it lul.