9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00

More patch changes, migrate the Helpful NMS Changes

This commit is contained in:
MrPowerGamerBR
2025-05-26 00:45:01 -03:00
parent 9535eaddb6
commit e1d77fda3e
8 changed files with 136 additions and 5 deletions

View File

@@ -8,11 +8,19 @@
.ensureSize("CONCRETES", 16).lock(); .ensureSize("CONCRETES", 16).lock();
/** /**
@@ -152,6 +_,7 @@ @@ -161,6 +_,7 @@
*/ .endsWith("TERRACOTTA")
public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta")) .not(Material.TERRACOTTA)
.endsWith("GLAZED_TERRACOTTA") .notEndsWith("GLAZED_TERRACOTTA")
+ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks + .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks
.ensureSize("GLAZED_TERRACOTTA", 16).lock(); .ensureSize("STAINED_TERRACOTTA", 16).lock();
/**
@@ -168,6 +_,7 @@
*/
public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta"))
.endsWith("TERRACOTTA")
+ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks
.ensureSize("TERRACOTTA", 33).lock();
/** /**

View File

@@ -0,0 +1,44 @@
--- a/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java
@@ -22,7 +_,7 @@
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;
@@ -179,6 +_,32 @@
public float getYHeadRot() {
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;

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundBlockUpdatePacket.java
@@ -19,7 +_,7 @@
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 blockState) {
this.pos = pos;

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -30,7 +_,7 @@
);
private static final int TWO_MEGABYTES = 2097152;
private final Map<Heightmap.Types, long[]> 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<>();

View File

@@ -0,0 +1,16 @@
--- a/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java
@@ -20,6 +_,13 @@
this.yHeadRot = yHeadRot;
}
+ // 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 buffer) {
this.entityId = buffer.readVarInt();
this.yHeadRot = buffer.readByte();

View File

@@ -0,0 +1,15 @@
--- a/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
@@ -17,9 +_,9 @@
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;

View File

@@ -0,0 +1,15 @@
--- a/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java
@@ -22,6 +_,12 @@
this.cameraId = buffer.readVarInt();
}
+ // SparklyPaper - Helpful NMS packet changes: add direct entityId constructor
+ public ClientboundSetCameraPacket(int entityId) {
+ this.cameraId = entityId;
+ }
+ // SparklyPaper end
+
private void write(FriendlyByteBuf buffer) {
buffer.writeVarInt(this.cameraId);
}

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/Display.java
+++ b/net/minecraft/world/entity/Display.java
@@ -681,7 +_,7 @@
private static final byte INITIAL_TEXT_OPACITY = -1;
public static final int INITIAL_BACKGROUND = 1073741824;
private static final int INITIAL_LINE_WIDTH = 200;
- 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