Skip to content

Particles not displaying correctly on Bedrock #43

Open
@Cinder4198

Description

@Cinder4198

Describe the bug

Geyser doesn't display particles that are spawned by a plugin correctly.

I was making a plugin and using my bedrock account to help with testing since I don't have an alt, and noticed that particles didn't align with what they should have, but only for the bedrock account. I did test it on multiple java accounts, it only affected the bedrock one.

To Reproduce

  1. Log into the server on Bedrock
  2. Have the plugin spawn the particles
  3. The particles won't be in the correct spot

Expected behaviour

The particles should be displayed how they are on java

Screenshots / Videos

Image:
image

Video:

2022-12-06.18-07-54.mp4

Sidenote im not actually running windows xp, its still windows 10

Server Version and Plugins

LuckPerms, WorldEdit, NBTAPI, floodgate, WorldGuard, PlugManX (PlugMan), DefClaims (the one im testing)

Geyser Dump

https://dump.geysermc.org/ftLX682s6uChU0owHWQETHPcvXJjuCgY

Geyser Version

2.1.0-SNAPSHOT (git-master-3d66d27)

Minecraft: Bedrock Edition Device/Version

1.19.50; Windows 10 Edition

Additional Context

Here's the class that I'm using for the particles, if you need the plugin itself or more of the code I can give that as well.

package net.deftera.defclaims.listeners;

import de.tr7zw.nbtapi.NBTItem;
import net.deftera.defclaims.Defclaims;
import net.deftera.defclaims.datamodels.ClaimData;
import net.deftera.defclaims.db.Database;
import net.deftera.defclaims.util.ParticleUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.block.data.type.Bed;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitScheduler;
import org.w3c.dom.ranges.Range;

import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

public class VisualizeClaims{
    public Runnable onTimer(){
        Runnable runnable = () -> {
            //List<Player> players = (List<Player>) Bukkit.getOnlinePlayers();
            try {
                Database db = Defclaims.plugin.getDatabase();
                for(Player player : Bukkit.getOnlinePlayers()) {

                    ItemStack material = new ItemStack(Material.DIAMOND_SWORD);
                    NBTItem nbtmaterial = new NBTItem(material);
                    nbtmaterial.setInteger("CustomModelData", 5);
                    material = nbtmaterial.getItem();

                    if (player.getInventory().getItemInMainHand().isSimilar(material)) {

                        long claimDataMax;
                        try {
                            claimDataMax = db.findAllClaimData().size();
                        } catch (SQLException e) {
                            throw new RuntimeException(e);
                        }

                        String maxClaimData = db.findAllClaimData().get((int) claimDataMax - 1);

                        for (long claimID = 1; claimID <= (Long.parseLong(maxClaimData)); claimID++) {

                            try {

                                if (!(db.findClaimDataByClaimID(claimID) == null)) {

                                    int claimPlayerData = db.findClaimOnePlayerTrustLevel(claimID, player.getUniqueId());

                                    Particle outline = Particle.SMOKE_NORMAL;

                                    if (claimPlayerData == 1) {
                                        outline = Particle.VILLAGER_HAPPY;
                                    }

                                    if (claimPlayerData == 2) {
                                        outline = Particle.END_ROD;
                                    }

                                    ClaimData claimData = db.findClaimDataByClaimID(claimID);
                                    long minx = claimData.getMinx();
                                    long miny = claimData.getMiny();
                                    long minz = claimData.getMinz();
                                    long maxx = claimData.getMaxx() + 1;
                                    long maxy = claimData.getMaxy() + 1;
                                    long maxz = claimData.getMaxz() + 1;

                                    for (long x = minx; x <= maxx; x++) {
                                        for (long y = miny; y <= maxy; y++) {
                                            for (long z = minz; z <= maxz; z++) {
                                                if (x == minx) {
                                                    if (player.getLocation().getX() >= x - 15) {
                                                        if (player.getLocation().getX() <= x + 15) {
                                                            player.spawnParticle(outline, x, y, z, 0);
                                                        }
                                                    }
                                                }
                                                if (x == maxx) {
                                                    if (player.getLocation().getX() >= x - 15) {
                                                        if (player.getLocation().getX() <= x + 15) {
                                                            player.spawnParticle(outline, x, y, z, 0);
                                                        }
                                                    }
                                                }
                                                if (y == miny) {
                                                    if (player.getLocation().getX() >= x - 15) {
                                                        if (player.getLocation().getX() <= x + 15) {
                                                            player.spawnParticle(outline, x, y, z, 0);
                                                        }
                                                    }
                                                }
                                                if (y == maxy) {
                                                    if (player.getLocation().getX() >= x - 15) {
                                                        if (player.getLocation().getX() <= x + 15) {
                                                            player.spawnParticle(outline, x, y, z, 0);
                                                        }
                                                    }
                                                }
                                                if (z == minz) {
                                                    if (player.getLocation().getX() >= x - 15) {
                                                        if (player.getLocation().getX() <= x + 15) {
                                                            player.spawnParticle(outline, x, y, z, 0);
                                                        }
                                                    }
                                                }
                                                if (z == maxz) {
                                                    if (player.getLocation().getX() >= x - 15) {
                                                        if (player.getLocation().getX() <= x + 15) {
                                                            player.spawnParticle(outline, x, y, z, 0);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }catch (SQLException ignore){}
                        }
                    }
                }
            }catch (Exception ex){
                ex.printStackTrace();
            }
        };
        return runnable;
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions