mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-22 20:44:54 +02:00
Cleanup
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
8c72bee1dd
commit
9e24aaab77
|
@ -8,8 +8,8 @@ import net.minestom.server.utils.binary.BinaryReader;
|
|||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public record BlockActionPacket(Point blockPosition, byte actionId, byte actionParam,
|
||||
int blockId) implements ServerPacket {
|
||||
public record BlockActionPacket(@NotNull Point blockPosition, byte actionId,
|
||||
byte actionParam, int blockId) implements ServerPacket {
|
||||
public BlockActionPacket(Point blockPosition, byte actionId, byte actionParam, Block block) {
|
||||
this(blockPosition, actionId, actionParam, block.id());
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import net.minestom.server.utils.binary.BinaryReader;
|
|||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public record BlockChangePacket(Point blockPosition, int blockStateId) implements ServerPacket {
|
||||
public BlockChangePacket(Point blockPosition, Block block) {
|
||||
public record BlockChangePacket(@NotNull Point blockPosition, int blockStateId) implements ServerPacket {
|
||||
public BlockChangePacket(@NotNull Point blockPosition, @NotNull Block block) {
|
||||
this(blockPosition, block.stateId());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,11 @@ import java.util.function.UnaryOperator;
|
|||
/**
|
||||
* Represents an outgoing chat message packet.
|
||||
*/
|
||||
public record ChatMessagePacket(Component message, ChatPosition position,
|
||||
UUID uuid) implements ComponentHoldingServerPacket {
|
||||
public record ChatMessagePacket(@NotNull Component message, @NotNull ChatPosition position,
|
||||
@NotNull UUID uuid) implements ComponentHoldingServerPacket {
|
||||
public ChatMessagePacket(BinaryReader reader) {
|
||||
this(reader.readComponent(), ChatPosition.fromPacketID(reader.readByte()), reader.readUuid());
|
||||
this(reader.readComponent(), ChatPosition.fromPacketID(reader.readByte()),
|
||||
reader.readUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,10 +2,15 @@ package net.minestom.server.network.packet.server.play;
|
|||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public record EnterCombatEventPacket() implements ServerPacket {
|
||||
public EnterCombatEventPacket(BinaryReader reader) {
|
||||
this();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@NotNull BinaryWriter writer) {
|
||||
// Empty
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minestom.server.utils.binary.BinaryReader;
|
|||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public record EntityAnimationPacket(int entityId, Animation animation) implements ServerPacket {
|
||||
public record EntityAnimationPacket(int entityId, @NotNull Animation animation) implements ServerPacket {
|
||||
public EntityAnimationPacket(BinaryReader reader) {
|
||||
this(reader.readVarInt(), Animation.values()[reader.readByte()]);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minestom.server.utils.binary.BinaryReader;
|
|||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public record UpdateLightPacket(int chunkX, int chunkZ, LightData lightData)
|
||||
implements ServerPacket {
|
||||
public record UpdateLightPacket(int chunkX, int chunkZ,
|
||||
@NotNull LightData lightData) implements ServerPacket {
|
||||
public UpdateLightPacket(BinaryReader reader) {
|
||||
this(reader.readVarInt(), reader.readVarInt(), new LightData(reader));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public record UpdateLightPacket(int chunkX, int chunkZ, LightData lightData)
|
|||
public void write(@NotNull BinaryWriter writer) {
|
||||
writer.writeVarInt(chunkX);
|
||||
writer.writeVarInt(chunkZ);
|
||||
this.lightData.write(writer);
|
||||
writer.write(lightData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user