Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-17 21:40:22 +01:00
Cache dimensions without namespace in 1.19->1.18.2 (#744)
Dieser Commit ist enthalten in:
Ursprung
e45a95c6ec
Commit
abb1803aaf
@ -133,11 +133,11 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
|
|||||||
final ListTag<CompoundTag> dimensions = TagUtil.getRegistryEntries(registry, "dimension_type");
|
final ListTag<CompoundTag> dimensions = TagUtil.getRegistryEntries(registry, "dimension_type");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final CompoundTag dimension : dimensions) {
|
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");
|
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);
|
wrapper.write(Type.NAMED_COMPOUND_TAG, dimensionData);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
|||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import com.viaversion.viaversion.util.Key;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public final class DimensionRegistryStorage implements StorableObject {
|
public final class DimensionRegistryStorage implements StorableObject {
|
||||||
@ -32,7 +33,7 @@ public final class DimensionRegistryStorage implements StorableObject {
|
|||||||
private final Int2ObjectMap<CompoundTag> chatTypes = new Int2ObjectOpenHashMap<>();
|
private final Int2ObjectMap<CompoundTag> chatTypes = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
public @Nullable CompoundTag dimension(final String dimensionKey) {
|
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;
|
return compoundTag != null ? compoundTag.copy() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren