3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00

Cache dimensions without namespace in 1.19->1.18.2 (#744)

Dieser Commit ist enthalten in:
EnZaXD 2024-05-10 21:47:45 +02:00 committet von GitHub
Ursprung e45a95c6ec
Commit abb1803aaf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
2 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -133,11 +133,11 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
final ListTag<CompoundTag> dimensions = TagUtil.getRegistryEntries(registry, "dimension_type");
boolean found = false;
for (final CompoundTag dimension : dimensions) {
final StringTag nameTag = dimension.getStringTag("name");
final String name = Key.stripMinecraftNamespace(dimension.getString("name"));
final CompoundTag dimensionData = dimension.getCompoundTag("element");
dimensionRegistryStorage.addDimension(nameTag.getValue(), dimensionData.copy());
dimensionRegistryStorage.addDimension(name, dimensionData.copy());
if (!found && Key.stripMinecraftNamespace(nameTag.getValue()).equals(dimensionKey)) {
if (!found && name.equals(dimensionKey)) {
wrapper.write(Type.NAMED_COMPOUND_TAG, dimensionData);
found = true;
}

Datei anzeigen

@ -24,6 +24,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import java.util.HashMap;
import java.util.Map;
import com.viaversion.viaversion.util.Key;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class DimensionRegistryStorage implements StorableObject {
@ -32,7 +33,7 @@ public final class DimensionRegistryStorage implements StorableObject {
private final Int2ObjectMap<CompoundTag> chatTypes = new Int2ObjectOpenHashMap<>();
public @Nullable CompoundTag dimension(final String dimensionKey) {
final CompoundTag compoundTag = dimensions.get(dimensionKey);
final CompoundTag compoundTag = dimensions.get(Key.stripMinecraftNamespace(dimensionKey));
return compoundTag != null ? compoundTag.copy() : null;
}