#``` public void plant() {

1 messages · Page 1 of 1 (latest)

round condor
#

@somber cargo

gloomy lava
#

You’re missing the data parameter for Falling Dust

round condor
gloomy lava
#

Falling Dust could be Particle.DustOptions as data, you can check it in the enum

round condor
#

Okay, but I don't see how to integrate it with spawnParticle()

gloomy lava
#

Just pass it as the last parameter

round condor
#

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?

gloomy lava
#

new Particle.DustOptions

#

The data parameter is of class DustOptions

#

It’s actually T but for falling dust it should be DustOptions

round condor
#

I feel stupid I don't see where to put this Particle.DustOptions

gloomy lava
#

spawnParticle(allParameters, …, new Particle.DustOptions(color, size));

round condor
#

Oh okays

#

I'm fucking idiot

#

Thanks very much i go try

#

Java Crash 💀

gloomy lava
#

error?

round condor
#

File Java Error

#

Like hs_err_pid25604

#

Okay no it's my computer

#

Infinite Loop

gloomy lava
#

Looks like you need another data

round condor
#

Yeah I'll see if @somber cargo can help me. He seemed to know

#

Thanks for your help @gloomy lava

gloomy lava
#

You need a BlockData

#

Use a material and do .createBlockData

somber cargo
#

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 ^

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.
somber cargo
#

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

round condor
#

year but is dosen’t work

#

i tried and i have the same error with Particle.DustOption

#

@somber cargo

somber cargo
#

what error?

#

ah use 1.0 not 1

#

its wanting a float not an int

round condor
#

I try wity 1.0 same error

#

@somber cargo

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

round condor
#

I think it’s the spawn line

somber cargo
#

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

round condor
#

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?

somber cargo
#

nope

#

you need to ditch the getColor method and change it to getData

#

so LeafTypes.getData

round condor
#

so i need to change getcolor to? Or no?

somber cargo
#

you'll no longer be using color

#

teh falling dust wants a Bukkit BlockData

round condor
#

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?

somber cargo
#

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));

round condor
#

and where is set the color of particle?

somber cargo
#

its in the BlockData

round condor
#

oh yes okay

#

i try when i comeback home

somber cargo
#

I guess thats how they did it before but used nms and packets

#

ok

round condor
#

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

somber cargo
#

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

round condor
#

😪

somber cargo
#

use md5 paste and paste your leftypes class again

round condor
#

Shouldn't we use IblockData? That would explain why the creator used NMS, no?

somber cargo
#

no

#

we need BlockData not IBlockData

round condor
somber cargo
#

its missing the BlockData import and you can remove the import for Item I missed

round condor
#

I don't find the import for BlockData

somber cargo
#

org.bukkit.block.data.BlockData

somber cargo
#

ah material.createBlockData()

round condor
#

Okay, i think all good i try

somber cargo
#

paste your main leaves class

round condor
somber cargo
#

clean up any unused imports too

round condor
#

Is working

#

Man

#

You are fucking god

somber cargo
#

it should no longer use any NMS

round condor
#

You can't imagine how I want to thank you

#

A big thank-you

somber cargo
#

ha np, you have fun

round condor
#

I have to look, but I have doubts if it changes the color well

round condor
somber cargo
#

show the spawn line

round condor
#

ok...

#

I'm idiot

somber cargo
#

🙂

round condor
#

It's written BIRCH_LEAVES

somber cargo
#

yep, needs to pull from s

round condor
#

But what can I use to target the particular block?

somber cargo
#

change teh spots to hold BlockData instead of IBlockData

#

then you can read from s.

#

so LeafSpot class I think

round condor
#

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;
    
}```
somber cargo
#

x,y,z and BlockData instead of the IBlockData

#

yep

round condor
#

Yes it's alerady done

#

But s in getData(s) dosen't work

somber cargo
#

then fix anywhere it created LeafSpots

#

it shoudl be s.getData()

#

instead of LeafTypes.getData...

#

in the spawn

round condor
#

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());?

somber cargo
#
this.world.spawnParticle(Particle.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 1, 0, 0, 0, 0, s.getData());```
round condor
#

It's even better than before

#

Thanks! but why he don't need getInstance().GetMap() like before ?

somber cargo
#

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

round condor
#

Okay i see

#

Is working

#

All work you are god

somber cargo
#

cool