Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Fixup LODESTONE_TRACKER rewriting in 1.20.3->.5 and backwards (#3862)
Dieser Commit ist enthalten in:
Ursprung
7d9c6fea69
Commit
052fb6e366
@ -469,10 +469,11 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
|||||||
data.set(StructuredDataKey.RECIPES, recipesTag);
|
data.set(StructuredDataKey.RECIPES, recipesTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final NumberTag trackedTag = tag.getNumberTag("LodestoneTracked");
|
||||||
|
if (trackedTag != null) {
|
||||||
final CompoundTag lodestonePosTag = tag.getCompoundTag("LodestonePos");
|
final CompoundTag lodestonePosTag = tag.getCompoundTag("LodestonePos");
|
||||||
final String lodestoneDimension = tag.getString("LodestoneDimension");
|
final String lodestoneDimension = tag.getString("LodestoneDimension");
|
||||||
if (lodestonePosTag != null && lodestoneDimension != null) {
|
updateLodestoneTracker(trackedTag.asBoolean(), lodestonePosTag, lodestoneDimension, data);
|
||||||
updateLodestoneTracker(tag, lodestonePosTag, lodestoneDimension, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ListTag<CompoundTag> effectsTag = tag.getListTag("effects", CompoundTag.class);
|
final ListTag<CompoundTag> effectsTag = tag.getListTag("effects", CompoundTag.class);
|
||||||
@ -1047,12 +1048,14 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
|||||||
data.set(StructuredDataKey.SUSPICIOUS_STEW_EFFECTS, suspiciousStewEffects);
|
data.set(StructuredDataKey.SUSPICIOUS_STEW_EFFECTS, suspiciousStewEffects);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLodestoneTracker(final CompoundTag tag, final CompoundTag lodestonePosTag, final String lodestoneDimensionTag, final StructuredDataContainer data) {
|
private void updateLodestoneTracker(final boolean tracked, final CompoundTag lodestonePosTag, final String lodestoneDimensionTag, final StructuredDataContainer data) {
|
||||||
final boolean tracked = tag.getBoolean("LodestoneTracked");
|
GlobalPosition position = null;
|
||||||
|
if (lodestonePosTag != null && lodestoneDimensionTag != null) {
|
||||||
final int x = lodestonePosTag.getInt("X");
|
final int x = lodestonePosTag.getInt("X");
|
||||||
final int y = lodestonePosTag.getInt("Y");
|
final int y = lodestonePosTag.getInt("Y");
|
||||||
final int z = lodestonePosTag.getInt("Z");
|
final int z = lodestonePosTag.getInt("Z");
|
||||||
final GlobalPosition position = new GlobalPosition(lodestoneDimensionTag, x, y, z);
|
position = new GlobalPosition(lodestoneDimensionTag, x, y, z);
|
||||||
|
}
|
||||||
data.set(StructuredDataKey.LODESTONE_TRACKER, new LodestoneTracker(position, tracked));
|
data.set(StructuredDataKey.LODESTONE_TRACKER, new LodestoneTracker(position, tracked));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,13 +220,15 @@ public final class StructuredDataConverter {
|
|||||||
register(StructuredDataKey.CHARGED_PROJECTILES, (connection, data, tag) -> convertItemList(connection, data, tag, "ChargedProjectiles"));
|
register(StructuredDataKey.CHARGED_PROJECTILES, (connection, data, tag) -> convertItemList(connection, data, tag, "ChargedProjectiles"));
|
||||||
register(StructuredDataKey.BUNDLE_CONTENTS, (connection, data, tag) -> convertItemList(connection, data, tag, "Items"));
|
register(StructuredDataKey.BUNDLE_CONTENTS, (connection, data, tag) -> convertItemList(connection, data, tag, "Items"));
|
||||||
register(StructuredDataKey.LODESTONE_TRACKER, (data, tag) -> {
|
register(StructuredDataKey.LODESTONE_TRACKER, (data, tag) -> {
|
||||||
final CompoundTag positionTag = new CompoundTag();
|
|
||||||
tag.put("LodestonePos", positionTag);
|
|
||||||
tag.putBoolean("LodestoneTracked", data.tracked());
|
tag.putBoolean("LodestoneTracked", data.tracked());
|
||||||
tag.putString("LodestoneDimension", data.position().dimension());
|
if (data.position() != null) {
|
||||||
|
final CompoundTag positionTag = new CompoundTag();
|
||||||
positionTag.putInt("X", data.position().x());
|
positionTag.putInt("X", data.position().x());
|
||||||
positionTag.putInt("Y", data.position().y());
|
positionTag.putInt("Y", data.position().y());
|
||||||
positionTag.putInt("Z", data.position().z());
|
positionTag.putInt("Z", data.position().z());
|
||||||
|
tag.put("LodestonePos", positionTag);
|
||||||
|
tag.putString("LodestoneDimension", data.position().dimension());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
register(StructuredDataKey.FIREWORKS, (data, tag) -> {
|
register(StructuredDataKey.FIREWORKS, (data, tag) -> {
|
||||||
final CompoundTag fireworksTag = new CompoundTag();
|
final CompoundTag fireworksTag = new CompoundTag();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren