[英]Redstone particles don't change their color
I'm trying to send colored redstone particles to player via packets using ProtocolLib. 我正在尝试使用ProtocolLib通过数据包向玩家发送彩色红石粒子。 I Googled that to make them colored, I need use the offset
parameters as the RGB system. 我用谷歌搜索它使它们着色,我需要使用offset
参数作为RGB系统。 However, it didn't work as intended; 但是,它没有按预期工作; particles are still red or have random color (see below), and offset
still is used as randomizer of each particle from the given location. 粒子仍然是红色或具有随机颜色(见下文),并且offset
仍然用作来自给定位置的每个粒子的随机化器。 My code: 我的代码:
PacketContainer packet = new PacketContainer(PacketType.Play.Server.WORLD_PARTICLES);
packet.getModifier().writeDefaults();
packet.getParticles().write(0, Particle.REDSTONE);
float x = (float) loc.getX();
float y = (float) loc.getY() + 3;
float z = (float) loc.getZ();
float red = 0;
float green = 0;
float blue = 1;
packet.getFloat().write(0, x).write(1, y).write(2, z); // Location
packet.getFloat().write(3, red).write(4, green).write(5, blue); // Offset
packet.getFloat().write(6, 0F); // Particle data ?
packet.getIntegers().write(0, 1); // Amount
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
try {
for (Player player : getters) manager.sendServerPacket(player, packet);
} catch (Exception ex) {ex.printStackTrace();}
I tried to change amount
and particle data
. 我试图改变amount
和粒子data
。 If particle data
is 0
, then particles are red, in other cases up to 1
particles are random colored. 如果粒子data
为0
,则粒子为红色,在其他情况下,最多1
粒子是随机着色的。
I'm using ProtocolLib 4.3.0 and Spigot 1.12.2 我正在使用ProtocolLib 4.3.0和Spigot 1.12.2
I solved my problem, to spawn colored true redstone particle there must be 3 things: 我解决了我的问题,产生彩色真正的红石粒子必须有3件事:
Amount
must be 0
Amount
必须为0
Data
must be 1
Data
必须为1
x - 1
(because this component automatically increased by 1 before pushing into the packet) 红色分量(x偏移量)必须为x - 1
(因为该分量在推入数据包之前会自动增加1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.