Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.0' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
retrooper committed Sep 20, 2024
2 parents d4f7bce + 8037e65 commit 350d33a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ public static ParticleDustColorTransitionData decode(NBTCompound compound, Clien
String fromColorKey = "from_color";
String toColorKey = "to_color";
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
compound = compound.getCompoundTagOrThrow("value");
fromColorKey = "fromColor";
toColorKey = "toColor";
}
Expand All @@ -173,9 +172,6 @@ public static void encode(ParticleDustColorTransitionData data, ClientVersion ve
String fromColorKey = "from_color";
String toColorKey = "to_color";
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
NBTCompound innerCompound = new NBTCompound();
compound.setTag("value", innerCompound);
compound = innerCompound;
fromColorKey = "fromColor";
toColorKey = "toColor";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,13 @@ public static NBT encodeColor(@Nullable Float alpha, float red, float green, flo
}

public static ParticleDustData decode(NBTCompound compound, ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
compound = compound.getCompoundTagOrThrow("value");
}
NBT colorNBT = compound.getTagOrNull("color");
float[] color = decodeColor(colorNBT);
float scale = compound.getNumberTagOrThrow("scale").getAsFloat();
return new ParticleDustData(scale, color);
}

public static void encode(ParticleDustData data, ClientVersion version, NBTCompound compound) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
NBTCompound innerCompound = new NBTCompound();
compound.setTag("value", innerCompound);
compound = innerCompound;
}
compound.setTag("color", encodeColor(null, data.red, data.green, data.blue));
compound.setTag("scale", new NBTFloat(data.scale));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,11 @@ public static void write(PacketWrapper<?> wrapper, ParticleSculkChargeData data)
}

public static ParticleSculkChargeData decode(NBTCompound compound, ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
compound = compound.getCompoundTagOrThrow("value");
}
float roll = compound.getNumberTagOrThrow("roll").getAsFloat();
return new ParticleSculkChargeData(roll);
}

public static void encode(ParticleSculkChargeData data, ClientVersion version, NBTCompound compound) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
NBTCompound innerCompound = new NBTCompound();
compound.setTag("value", innerCompound);
compound = innerCompound;
}
compound.setTag("roll", new NBTFloat(data.roll));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,11 @@ public static void write(PacketWrapper<?> wrapper, ParticleShriekData data) {
}

public static ParticleShriekData decode(NBTCompound compound, ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
compound = compound.getCompoundTagOrThrow("value");
}
int delay = compound.getNumberTagOrThrow("delay").getAsInt();
return new ParticleShriekData(delay);
}

public static void encode(ParticleShriekData data, ClientVersion version, NBTCompound compound) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
NBTCompound innerCompound = new NBTCompound();
compound.setTag("value", innerCompound);
compound = innerCompound;
}
compound.setTag("delay", new NBTInt(data.delay));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ public static void write(PacketWrapper<?> wrapper, ParticleVibrationData data) {
}

public static ParticleVibrationData decode(NBTCompound compound, ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
compound = compound.getCompoundTagOrThrow("value");
}
Vector3i origin = version.isNewerThanOrEquals(ClientVersion.V_1_19) ? null :
new Vector3i(compound.getTagOfTypeOrThrow("origin", NBTIntArray.class).getValue());
PositionSource destination = PositionSource.decode(compound.getCompoundTagOrThrow("destination"), version);
Expand All @@ -167,11 +164,6 @@ public static ParticleVibrationData decode(NBTCompound compound, ClientVersion v
}

public static void encode(ParticleVibrationData data, ClientVersion version, NBTCompound compound) {
if (version.isOlderThan(ClientVersion.V_1_20_5)) {
NBTCompound innerCompound = new NBTCompound();
compound.setTag("value", innerCompound);
compound = innerCompound;
}
if (version.isOlderThan(ClientVersion.V_1_19)) {
Vector3i startPos = data.getStartingPosition();
if (startPos != null) {
Expand Down

0 comments on commit 350d33a

Please sign in to comment.