mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-21 16:47:57 +01:00
Cache dimensions without namespace in 1.19->1.18.2 (#744)
This commit is contained in:
parent
e45a95c6ec
commit
abb1803aaf
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user