Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +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);
|
||||
}
|
||||
|
||||
final CompoundTag lodestonePosTag = tag.getCompoundTag("LodestonePos");
|
||||
final String lodestoneDimension = tag.getString("LodestoneDimension");
|
||||
if (lodestonePosTag != null && lodestoneDimension != null) {
|
||||
updateLodestoneTracker(tag, lodestonePosTag, lodestoneDimension, data);
|
||||
final NumberTag trackedTag = tag.getNumberTag("LodestoneTracked");
|
||||
if (trackedTag != null) {
|
||||
final CompoundTag lodestonePosTag = tag.getCompoundTag("LodestonePos");
|
||||
final String lodestoneDimension = tag.getString("LodestoneDimension");
|
||||
updateLodestoneTracker(trackedTag.asBoolean(), lodestonePosTag, lodestoneDimension, data);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private void updateLodestoneTracker(final CompoundTag tag, final CompoundTag lodestonePosTag, final String lodestoneDimensionTag, final StructuredDataContainer data) {
|
||||
final boolean tracked = tag.getBoolean("LodestoneTracked");
|
||||
final int x = lodestonePosTag.getInt("X");
|
||||
final int y = lodestonePosTag.getInt("Y");
|
||||
final int z = lodestonePosTag.getInt("Z");
|
||||
final GlobalPosition position = new GlobalPosition(lodestoneDimensionTag, x, y, z);
|
||||
private void updateLodestoneTracker(final boolean tracked, final CompoundTag lodestonePosTag, final String lodestoneDimensionTag, final StructuredDataContainer data) {
|
||||
GlobalPosition position = null;
|
||||
if (lodestonePosTag != null && lodestoneDimensionTag != null) {
|
||||
final int x = lodestonePosTag.getInt("X");
|
||||
final int y = lodestonePosTag.getInt("Y");
|
||||
final int z = lodestonePosTag.getInt("Z");
|
||||
position = new GlobalPosition(lodestoneDimensionTag, x, y, z);
|
||||
}
|
||||
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.BUNDLE_CONTENTS, (connection, data, tag) -> convertItemList(connection, data, tag, "Items"));
|
||||
register(StructuredDataKey.LODESTONE_TRACKER, (data, tag) -> {
|
||||
final CompoundTag positionTag = new CompoundTag();
|
||||
tag.put("LodestonePos", positionTag);
|
||||
tag.putBoolean("LodestoneTracked", data.tracked());
|
||||
tag.putString("LodestoneDimension", data.position().dimension());
|
||||
positionTag.putInt("X", data.position().x());
|
||||
positionTag.putInt("Y", data.position().y());
|
||||
positionTag.putInt("Z", data.position().z());
|
||||
if (data.position() != null) {
|
||||
final CompoundTag positionTag = new CompoundTag();
|
||||
positionTag.putInt("X", data.position().x());
|
||||
positionTag.putInt("Y", data.position().y());
|
||||
positionTag.putInt("Z", data.position().z());
|
||||
tag.put("LodestonePos", positionTag);
|
||||
tag.putString("LodestoneDimension", data.position().dimension());
|
||||
}
|
||||
});
|
||||
register(StructuredDataKey.FIREWORKS, (data, tag) -> {
|
||||
final CompoundTag fireworksTag = new CompoundTag();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren