chore: point position/offset particle packet construtors

This commit is contained in:
DeidaraMC 2024-03-31 01:28:12 -04:00 committed by iam
parent b71edf2706
commit 63f02929ed
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package net.minestom.server.network.packet.server.play;
import net.minestom.server.coordinate.Point;
import net.minestom.server.network.NetworkBuffer;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
@ -28,6 +29,14 @@ public record ParticlePacket(int particleId, boolean longDistance, double x, dou
this(particle.id(), false, x, y, z, offsetX, offsetY, offsetZ, maxSpeed, particleCount, particle.data());
}
public ParticlePacket(@NotNull Particle particle, boolean longDistance, @NotNull Point position, @NotNull Point offset, float maxSpeed, int particleCount) {
this(particle, longDistance, position.x(), position.y(), position.z(), (float)offset.x(), (float)offset.y(), (float)offset.z(), maxSpeed, particleCount);
}
public ParticlePacket(@NotNull Particle particle, @NotNull Point position, @NotNull Point offset, float maxSpeed, int particleCount) {
this(particle, false, position, offset, maxSpeed, particleCount);
}
private static ParticlePacket readPacket(NetworkBuffer reader) {
int particleId = reader.read(VAR_INT);
Boolean longDistance = reader.read(BOOLEAN);