#``` public void plant() {
1 messages · Page 1 of 1 (latest)
You’re missing the data parameter for Falling Dust
Oh, he need à data parameter ?
declaration: package: org.bukkit, interface: World
Falling Dust could be Particle.DustOptions as data, you can check it in the enum
Okay, but I don't see how to integrate it with spawnParticle()
Just pass it as the last parameter
Check this link
i have check
DustOptions(Color color, float size)
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, Color color, float size); So like this?
new Particle.DustOptions
The data parameter is of class DustOptions
It’s actually T but for falling dust it should be DustOptions
I feel stupid I don't see where to put this Particle.DustOptions
spawnParticle(allParameters, …, new Particle.DustOptions(color, size));
error?
Looks like you need another data
Yeah I'll see if @somber cargo can help me. He seemed to know
Thanks for your help @gloomy lava
Should not need BlockData This is what your color material map is for, to create a new Particle.DustOptions(getColor(leafMaterial), 1.0))
The whole color system is a cache so you don;t need to create BlockData every time you spawn a particle
@round condor ^
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, (Particle.DustOptions(LeafTypes.getColor(Material.BIRCH_LEAVES), 1.0)));
So this? Hum, I have the particle.dustoption line in red.
For getColor the function is in another class. But for the hardware I searched and I didn't see a function that tries to recover it
@somber cargo
https://paste.md-5.net/ohuhegucoz.rb
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, dust);```
I try these, no error in the IDE (but i use online Birch_Leaves) but error in game.
Yes IF that getColor is pulling from the Map and not processing it as a Color from the NMS MapColor
Because the plugin doesn;t actually return the color for the leaf material, it returns the color of the block you have mapped it to in your config
year but is dosen’t work
i tried and i have the same error with Particle.DustOption
@somber cargo
that makes no sense, DustOptions does not take a BlockData
oh sec, perhaps it does for falling dust
um nah that can't be it. Is it the creating the dust line that errors or the spawn line?
easy to change if it's the spawn line
If it's the spawn line we can get rid of the getColor method, so no NMS at all
I think it’s the spawn line
instead of storing the colour in LeafTypes, store teh Material#createBlockData()
then getBlockData to pull from teh map, and use that instead of color when you create the DustOptions
so your map will be storing Material, BlockData
note it's Bukkits BlockData not NMS IBlockData
Particle.DustOptions dust = new Particle.DustOptions(LeafTypes.getColor(Material#createBlockData(getBlockData)), 1.0);
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, dust);
this?
nope
you need to ditch the getColor method and change it to getData
so LeafTypes.getData
so i need to change getcolor to? Or no?
Particle.DustOptions dust = new Particle.DustOptions(LeafTypes.getData(Material#createBlockData(getBlockData)), 1.0);
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, dust);
this?
LeafTypes.getData(Material.BIRCH_LEAVES)
or whatever material you get from s
actually you'll not need a DustOptions
I'm distracted
you can put it straight into the spawn method
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, LeafTypes.getData(Material.BIRCH_LEAVES));
and where is set the color of particle?
its in the BlockData
We cannot use getData
When I put LeafTypes. I only have getColor to suggest
@somber cargo
java.lang.IllegalArgumentException: data (class org.bukkit.Color) should be interface org.bukkit.block.data.BlockData
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:445) ~[guava-32.1.2-jre.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.CraftWorld.spawnParticle(CraftWorld.java:2113) ~[purpur-1.20.2.jar:git-Purpur-2082]
at org.bukkit.craftbukkit.v1_20_R2.CraftWorld.spawnParticle(CraftWorld.java:2108) ~[purpur-1.20.2.jar:git-Purpur-2082]
at org.bukkit.craftbukkit.v1_20_R2.CraftWorld.spawnParticle(CraftWorld.java:2097) ~[purpur-1.20.2.jar:git-Purpur-2082]
at com.rappelr.leaves.chunk.LeafChunk.plant(LeafChunk.java:95) ~[Leaves-1.0-SNAPSHOT.jar:?]
at com.rappelr.leaves.map.LeafMap.lambda$aPlant$4(LeafMap.java:110) ~[Leaves-1.0-SNAPSHOT.jar:?]
at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
at com.rappelr.leaves.map.LeafMap.aPlant(LeafMap.java:110) ~[Leaves-1.0-SNAPSHOT.jar:?]
at com.rappelr.leaves.map.LeafMap.lambda$plant$3(LeafMap.java:105) ~[Leaves-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.20.2.jar:git-Purpur-2082]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.20.2.jar:git-Purpur-2082]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.20.2.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, Leaves.getInstance().getMap().getTypes().data(Material.BIRCH_LEAVES)); I tried with this, but is dosen't work
the spawn method is looking for BlockData so you need to rewrite the LeafType class and replace colors. The code we re-did is wrong
😪
use md5 paste and paste your leftypes class again
Shouldn't we use IblockData? That would explain why the creator used NMS, no?
I don't find the import for BlockData
org.bukkit.block.data.BlockData
ah material.createBlockData()
paste your main leaves class
it should no longer use any NMS
ha np, you have fun
I have to look, but I have doubts if it changes the color well
Okay, everything seems to work except the color, it doesn't seem to change depending on the block.
show the spawn line
🙂
It's written BIRCH_LEAVES
yep, needs to pull from s
But what can I use to target the particular block?
change teh spots to hold BlockData instead of IBlockData
then you can read from s.
so LeafSpot class I think
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.block.data.BlockData;
@AllArgsConstructor
public class LeafSpot {
@Getter
private final int x, y, z;
@Getter
private BlockData data;
}```
then fix anywhere it created LeafSpots
it shoudl be s.getData()
instead of LeafTypes.getData...
in the spawn
Like this this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, Leaves.getInstance().getMap().getTypes().LeafTypes.getData());?
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, s.getData());```
It's even better than before
Thanks! but why he don't need getInstance().GetMap() like before ?
its pulling from the chunk data
teh LeafTypes is just a cache
to save generating new BlockData for every leaf block
else you'd get a lot of lag in forests
cool