Upstream has released updates that appear to apply and compile correctly. [Purpur Changes] PurpurMC/Purpur@e86a1b6: Updated Upstream (Paper) PurpurMC/Purpur@962ee30: Updated Upstream (Paper) PurpurMC/Purpur@74d1b4c: Updated Upstream (Paper) PurpurMC/Purpur@e2e8c61: Updated Upstream (Paper) PurpurMC/Purpur@7a01fd8: Updated Upstream (Paper) PurpurMC/Purpur@34c18f0: Updated Upstream (Paper) PurpurMC/Purpur@ca668ab: Updated Upstream (Paper) PurpurMC/Purpur@200178d: Updated Upstream (Paper) PurpurMC/Purpur@9968cbb: Updated Upstream (Paper) PurpurMC/Purpur@db09358: Fix clamp-levels option not being true by default (#1609) PurpurMC/Purpur@f289b6a: Updated Upstream (Paper) PurpurMC/Purpur@959c29d: Fix Tridents giving errors without having an Elytra equipped (#1612) PurpurMC/Purpur@68c1612: Fix villagers not spawning when the `follow-emerald-blocks` option is enabled (#1611) PurpurMC/Purpur@5b75c68: fix `bypass-mob-griefing` not being the inverse of mobgriefing gamerule, closes #1603 PurpurMC/Purpur@55d4309: Updated Upstream (Paper) PurpurMC/Purpur@0601f87: Updated Upstream (Paper) PurpurMC/Purpur@06dde9d: Add Ridable and Attribute options for Creaking mob (#1613) PurpurMC/Purpur@420a1ce: Set the bee's `takes-damage-from-water` option to true by default (#1614) PurpurMC/Purpur@2b6f273: Updated Upstream (Paper) PurpurMC/Purpur@504f311: Updated Upstream (Paper) PurpurMC/Purpur@2b694c9: Updated Upstream (Paper) PurpurMC/Purpur@96d7ef7: Updated Upstream (Paper) PurpurMC/Purpur@e141f68: Updated Upstream (Paper) PurpurMC/Purpur@7f6f667: Updated Upstream (Pufferfish) PurpurMC/Purpur@de20ba9: ignore `minecart.max-speed` config value if using minecart experiment, closes #1618 PurpurMC/Purpur@03062a8: fix ridable mobs not being controllable, closes #1620 PurpurMC/Purpur@0493ac3: Updated Upstream (Paper) PurpurMC/Purpur@16ce24a: fix(ridables/creaking): override tick method in look/move control
145 lines
8.5 KiB
Diff
145 lines
8.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
|
Date: Mon, 10 Jun 2024 13:06:30 -0300
|
|
Subject: [PATCH] Helpful NMS packet changes
|
|
|
|
Some nice changes to the packet internals to make packet sending and manipulation easier for us to avoid Reflection and JVM internals (ooo theUnsafe spooky) usage
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java
|
|
index f66e40326c510aa3267542b1a24ed75d1ed6d3f1..797640c4f26abb32a480a611820bbcd72e43d1ac 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java
|
|
@@ -22,7 +22,7 @@ public class ClientboundAddEntityPacket implements Packet<ClientGamePacketListen
|
|
private static final double LIMIT = 3.9;
|
|
private final int id;
|
|
private final UUID uuid;
|
|
- private final EntityType<?> type;
|
|
+ public EntityType<?> type; // SparklyPaper - Helpful NMS packet changes: remove final and make public
|
|
private final double x;
|
|
private final double y;
|
|
private final double z;
|
|
@@ -180,6 +180,32 @@ public class ClientboundAddEntityPacket implements Packet<ClientGamePacketListen
|
|
return Mth.unpackDegrees(this.yHeadRot);
|
|
}
|
|
|
|
+ // SparklyPaper - Helpful NMS packet changes: expose raw rotational fields
|
|
+ public int getXaRaw() {
|
|
+ return this.xa;
|
|
+ }
|
|
+
|
|
+ public int getYaRaw() {
|
|
+ return this.ya;
|
|
+ }
|
|
+
|
|
+ public int getZaRaw() {
|
|
+ return this.za;
|
|
+ }
|
|
+
|
|
+ public byte getXRotRaw() {
|
|
+ return this.xRot;
|
|
+ }
|
|
+
|
|
+ public byte getYRotRaw() {
|
|
+ return this.yRot;
|
|
+ }
|
|
+
|
|
+ public byte getYHeadRotRaw() {
|
|
+ return this.yHeadRot;
|
|
+ }
|
|
+ // SparklyPaper end
|
|
+
|
|
public int getData() {
|
|
return this.data;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
|
|
index 1e8fad30c5f5be48501c7d8584caedcdc232f6c8..772848cf83a92a8ef8d734949b21f2f1d13e3fcb 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
|
|
@@ -19,7 +19,7 @@ public class ClientboundBlockUpdatePacket implements Packet<ClientGamePacketList
|
|
ClientboundBlockUpdatePacket::new
|
|
);
|
|
private final BlockPos pos;
|
|
- public final BlockState blockState;
|
|
+ public BlockState blockState; // SparklyPaper - Helpful NMS packet changes: remove final
|
|
|
|
public ClientboundBlockUpdatePacket(BlockPos pos, BlockState state) {
|
|
this.pos = pos;
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
|
index 0a8d07bf68b0ceabd13c70196d357fce79dcc2c3..0b5abaf11508fa6c6809b73f53d6854aa3b3247c 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
|
@@ -25,7 +25,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
|
public class ClientboundLevelChunkPacketData {
|
|
private static final int TWO_MEGABYTES = 2097152;
|
|
private final CompoundTag heightmaps;
|
|
- private final byte[] buffer;
|
|
+ public byte[] buffer; // SparklyPaper - Helpful NMS packet changes: remove final and make public
|
|
private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData;
|
|
// Paper start - Handle oversized block entities in chunks
|
|
private final java.util.List<net.minecraft.network.protocol.Packet<?>> extraPackets = new java.util.ArrayList<>();
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java
|
|
index ab44c24ce5f4570dee9d84b4216299bedfa800d8..99fbb958b82a3398564febb1e87e3ef4efca5b1a 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java
|
|
@@ -20,6 +20,13 @@ public class ClientboundRotateHeadPacket implements Packet<ClientGamePacketListe
|
|
this.yHeadRot = headYaw;
|
|
}
|
|
|
|
+ // SparklyPaper start - Helpful NMS packet changes: add entity ID constructor
|
|
+ public ClientboundRotateHeadPacket(int entityId, byte headYaw) {
|
|
+ this.entityId = entityId;
|
|
+ this.yHeadRot = headYaw;
|
|
+ }
|
|
+ // SparklyPaper end
|
|
+
|
|
private ClientboundRotateHeadPacket(FriendlyByteBuf buf) {
|
|
this.entityId = buf.readVarInt();
|
|
this.yHeadRot = buf.readByte();
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
|
index 1a37654aff9a9c86c9f7af10a1cf721371f0c5ec..e69ff4e6bb3919340a93ed4c68bdd6c4778669a9 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
|
@@ -17,9 +17,9 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet<ClientGamePa
|
|
|
|
public static final StreamCodec<FriendlyByteBuf, ClientboundSectionBlocksUpdatePacket> STREAM_CODEC = Packet.codec(ClientboundSectionBlocksUpdatePacket::write, ClientboundSectionBlocksUpdatePacket::new);
|
|
private static final int POS_IN_SECTION_BITS = 12;
|
|
- private final SectionPos sectionPos;
|
|
- private final short[] positions;
|
|
- private final BlockState[] states;
|
|
+ public SectionPos sectionPos; // SparklyPaper - Helpful NMS packet changes: remove final and make public
|
|
+ public short[] positions; // SparklyPaper - Helpful NMS packet changes: remove final and make public
|
|
+ public BlockState[] states; // SparklyPaper - Helpful NMS packet changes: remove final and make public
|
|
|
|
public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, ShortSet positions, LevelChunkSection section) {
|
|
this.sectionPos = sectionPos;
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java
|
|
index 799f5a8c69f295216997d52fb4bc6c56d3a18115..633f10f17eebd43e8dc7c878b9101decf31190a9 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java
|
|
@@ -18,6 +18,12 @@ public class ClientboundSetCameraPacket implements Packet<ClientGamePacketListen
|
|
this.cameraId = entity.getId();
|
|
}
|
|
|
|
+ // SparklyPaper - Helpful NMS packet changes: add direct entityId constructor
|
|
+ public ClientboundSetCameraPacket(int entityId) {
|
|
+ this.cameraId = entityId;
|
|
+ }
|
|
+ // SparklyPaper end
|
|
+
|
|
private ClientboundSetCameraPacket(FriendlyByteBuf buf) {
|
|
this.cameraId = buf.readVarInt();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java
|
|
index e6cbf4506c75046a89fad778e138b448fb4a29a9..3b705c75b840dbb0e741f46aaa3b98180a27ecf5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Display.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Display.java
|
|
@@ -802,7 +802,7 @@ public abstract class Display extends Entity {
|
|
public static final byte FLAG_ALIGN_RIGHT = 16;
|
|
private static final byte INITIAL_TEXT_OPACITY = -1;
|
|
public static final int INITIAL_BACKGROUND = 1073741824;
|
|
- private static final EntityDataAccessor<Component> DATA_TEXT_ID = SynchedEntityData.defineId(Display.TextDisplay.class, EntityDataSerializers.COMPONENT);
|
|
+ public static final EntityDataAccessor<Component> DATA_TEXT_ID = SynchedEntityData.defineId(Display.TextDisplay.class, EntityDataSerializers.COMPONENT); // SparklyPaper - Helpful NMS packet changes: make public
|
|
public static final EntityDataAccessor<Integer> DATA_LINE_WIDTH_ID = SynchedEntityData.defineId(Display.TextDisplay.class, EntityDataSerializers.INT);
|
|
public static final EntityDataAccessor<Integer> DATA_BACKGROUND_COLOR_ID = SynchedEntityData.defineId(
|
|
Display.TextDisplay.class, EntityDataSerializers.INT
|