3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Different registry implementation; fix banner blocks with ViaVersion

Dieser Commit ist enthalten in:
Camotoy 2024-05-01 15:35:30 -04:00
Ursprung abb1d7d9e9
Commit 1e8d6b23cf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
8 geänderte Dateien mit 166 neuen und 63 gelöschten Zeilen

Datei anzeigen

@ -113,7 +113,7 @@ public class WolfEntity extends TameableEntity {
// 1.20.5+ // 1.20.5+
public void setWolfVariant(IntEntityMetadata entityMetadata) { public void setWolfVariant(IntEntityMetadata entityMetadata) {
WolfVariant wolfVariant = session.getRegistryCache().wolfVariants().get(entityMetadata.getPrimitiveValue()); WolfVariant wolfVariant = session.getRegistryCache().wolfVariants().byId(entityMetadata.getPrimitiveValue());
if (wolfVariant == null) { if (wolfVariant == null) {
wolfVariant = WolfVariant.PALE; wolfVariant = WolfVariant.PALE;
} }

Datei anzeigen

@ -56,8 +56,8 @@ public class ArmorItem extends Item {
return; return;
} }
TrimMaterial material = session.getRegistryCache().trimMaterials().get(trim.material().id()); TrimMaterial material = session.getRegistryCache().trimMaterials().byId(trim.material().id());
TrimPattern pattern = session.getRegistryCache().trimPatterns().get(trim.pattern().id()); TrimPattern pattern = session.getRegistryCache().trimPatterns().byId(trim.pattern().id());
NbtMapBuilder trimBuilder = NbtMap.builder(); NbtMapBuilder trimBuilder = NbtMap.builder();
// bedrock has an uppercase first letter key, and the value is not namespaced // bedrock has an uppercase first letter key, and the value is not namespaced

Datei anzeigen

@ -33,13 +33,14 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import org.cloudburstmc.nbt.NbtList; import org.cloudburstmc.nbt.NbtList;
import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.nbt.NbtType;
import org.cloudburstmc.protocol.common.util.Int2ObjectBiMap;
import org.geysermc.geyser.inventory.item.BannerPattern; import org.geysermc.geyser.inventory.item.BannerPattern;
import org.geysermc.geyser.inventory.item.DyeColor; import org.geysermc.geyser.inventory.item.DyeColor;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.cache.registry.JavaRegistry;
import org.geysermc.geyser.translator.item.BedrockItemBuilder; import org.geysermc.geyser.translator.item.BedrockItemBuilder;
import org.geysermc.mcprotocollib.protocol.data.game.Holder; import org.geysermc.mcprotocollib.protocol.data.game.Holder;
import org.geysermc.mcprotocollib.protocol.data.game.Identifier;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.BannerPatternLayer; import org.geysermc.mcprotocollib.protocol.data.game.item.component.BannerPatternLayer;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
@ -57,7 +58,6 @@ public class BannerItem extends BlockItem {
* the correct ominous banner pattern if Bedrock pulls the item from creative. * the correct ominous banner pattern if Bedrock pulls the item from creative.
*/ */
private static final List<Pair<BannerPattern, DyeColor>> OMINOUS_BANNER_PATTERN; private static final List<Pair<BannerPattern, DyeColor>> OMINOUS_BANNER_PATTERN;
private static final List<NbtMap> OMINOUS_BANNER_PATTERN_BLOCK;
// TODO fix - we somehow need to be able to get the sessions banner pattern registry, which we don't have where we need this :/ // TODO fix - we somehow need to be able to get the sessions banner pattern registry, which we don't have where we need this :/
private static final int[] ominousBannerPattern = new int[] { 21, 29, 30, 1, 34, 15, 3, 1 }; private static final int[] ominousBannerPattern = new int[] { 21, 29, 30, 1, 34, 15, 3, 1 };
@ -74,11 +74,6 @@ public class BannerItem extends BlockItem {
Pair.of(BannerPattern.CIRCLE, DyeColor.LIGHT_GRAY), Pair.of(BannerPattern.CIRCLE, DyeColor.LIGHT_GRAY),
Pair.of(BannerPattern.BORDER, DyeColor.BLACK) Pair.of(BannerPattern.BORDER, DyeColor.BLACK)
); );
OMINOUS_BANNER_PATTERN_BLOCK = new ArrayList<>();
for (Pair<BannerPattern, DyeColor> pair : OMINOUS_BANNER_PATTERN) {
OMINOUS_BANNER_PATTERN_BLOCK.add(getJavaBannerPatternTag(pair.left(), pair.right()));
}
} }
public static boolean isOminous(GeyserSession session, List<BannerPatternLayer> patternLayers) { public static boolean isOminous(GeyserSession session, List<BannerPatternLayer> patternLayers) {
@ -92,7 +87,7 @@ public class BannerItem extends BlockItem {
!patternLayer.getPattern().isId()) { !patternLayer.getPattern().isId()) {
return false; return false;
} }
BannerPattern bannerPattern = session.getRegistryCache().bannerPatterns().get(patternLayer.getPattern().id()); BannerPattern bannerPattern = session.getRegistryCache().bannerPatterns().byId(patternLayer.getPattern().id());
if (bannerPattern != pair.left()) { if (bannerPattern != pair.left()) {
return false; return false;
} }
@ -101,7 +96,25 @@ public class BannerItem extends BlockItem {
} }
public static boolean isOminous(List<NbtMap> blockEntityPatterns) { public static boolean isOminous(List<NbtMap> blockEntityPatterns) {
return OMINOUS_BANNER_PATTERN_BLOCK.equals(blockEntityPatterns); // Cannot do a simple NBT equals check here because the IDs may not be full resource locations
// ViaVersion's fault, 1.20.4 -> 1.20.5, but it works on Java so we need to support it.
if (OMINOUS_BANNER_PATTERN.size() != blockEntityPatterns.size()) {
return false;
}
for (int i = 0; i < OMINOUS_BANNER_PATTERN.size(); i++) {
NbtMap patternLayer = blockEntityPatterns.get(i);
Pair<BannerPattern, DyeColor> pair = OMINOUS_BANNER_PATTERN.get(i);
DyeColor color = DyeColor.getByJavaIdentifier(patternLayer.getString("color"));
if (color != pair.right()) {
return false;
}
String id = Identifier.formalize(patternLayer.getString("pattern")); // Ouch
BannerPattern bannerPattern = BannerPattern.getByJavaIdentifier(id);
if (bannerPattern != pair.left()) {
return false;
}
}
return true;
} }
/** /**
@ -133,7 +146,7 @@ public class BannerItem extends BlockItem {
List<NbtMap> patternList = new ArrayList<>(patterns.size()); List<NbtMap> patternList = new ArrayList<>(patterns.size());
for (BannerPatternLayer patternLayer : patterns) { for (BannerPatternLayer patternLayer : patterns) {
patternLayer.getPattern().ifId(holder -> { patternLayer.getPattern().ifId(holder -> {
BannerPattern bannerPattern = session.getRegistryCache().bannerPatterns().get(holder.id()); BannerPattern bannerPattern = session.getRegistryCache().bannerPatterns().byId(holder.id());
if (bannerPattern != null) { if (bannerPattern != null) {
NbtMap tag = NbtMap.builder() NbtMap tag = NbtMap.builder()
.putString("Pattern", bannerPattern.getBedrockIdentifier()) .putString("Pattern", bannerPattern.getBedrockIdentifier())
@ -154,7 +167,8 @@ public class BannerItem extends BlockItem {
* @return The Bedrock edition format pattern nbt * @return The Bedrock edition format pattern nbt
*/ */
private static NbtMap getBedrockBannerPattern(NbtMap pattern) { private static NbtMap getBedrockBannerPattern(NbtMap pattern) {
BannerPattern bannerPattern = BannerPattern.getByJavaIdentifier(pattern.getString("pattern")); // ViaVersion 1.20.4 -> 1.20.5 can send without the namespace
BannerPattern bannerPattern = BannerPattern.getByJavaIdentifier(Identifier.formalize(pattern.getString("pattern")));
DyeColor dyeColor = DyeColor.getByJavaIdentifier(pattern.getString("color")); DyeColor dyeColor = DyeColor.getByJavaIdentifier(pattern.getString("color"));
if (bannerPattern == null || dyeColor == null) { if (bannerPattern == null || dyeColor == null) {
return null; return null;
@ -166,13 +180,6 @@ public class BannerItem extends BlockItem {
.build(); .build();
} }
public static NbtMap getJavaBannerPatternTag(BannerPattern bannerPattern, DyeColor dyeColor) {
return NbtMap.builder()
.putString("pattern", bannerPattern.getJavaIdentifier())
.putString("color", dyeColor.getJavaIdentifier())
.build();
}
/** /**
* Convert the Bedrock edition banner pattern nbt to Java edition * Convert the Bedrock edition banner pattern nbt to Java edition
* *
@ -180,11 +187,14 @@ public class BannerItem extends BlockItem {
* @return The Java edition format pattern layer * @return The Java edition format pattern layer
*/ */
public static BannerPatternLayer getJavaBannerPattern(GeyserSession session, NbtMap pattern) { public static BannerPatternLayer getJavaBannerPattern(GeyserSession session, NbtMap pattern) {
Int2ObjectBiMap<BannerPattern> registry = session.getRegistryCache().bannerPatterns(); JavaRegistry<BannerPattern> registry = session.getRegistryCache().bannerPatterns();
BannerPattern bannerPattern = BannerPattern.getByBedrockIdentifier(pattern.getString("Pattern")); BannerPattern bannerPattern = BannerPattern.getByBedrockIdentifier(pattern.getString("Pattern"));
DyeColor dyeColor = DyeColor.getById(15 - pattern.getInt("Color")); DyeColor dyeColor = DyeColor.getById(15 - pattern.getInt("Color"));
if (bannerPattern != null && dyeColor != null && registry.containsValue(bannerPattern)) { if (bannerPattern != null && dyeColor != null) {
return new BannerPatternLayer(Holder.ofId(registry.get(bannerPattern)), dyeColor.ordinal()); int id = registry.byValue(bannerPattern);
if (id != -1) {
return new BannerPatternLayer(Holder.ofId(id), dyeColor.ordinal());
}
} }
return null; return null;
} }

Datei anzeigen

@ -27,25 +27,25 @@ package org.geysermc.geyser.session.cache;
import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.cloudburstmc.protocol.bedrock.data.TrimMaterial; import org.cloudburstmc.protocol.bedrock.data.TrimMaterial;
import org.cloudburstmc.protocol.bedrock.data.TrimPattern; import org.cloudburstmc.protocol.bedrock.data.TrimPattern;
import org.cloudburstmc.protocol.common.util.Int2ObjectBiMap;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity;
import org.geysermc.geyser.inventory.item.BannerPattern; import org.geysermc.geyser.inventory.item.BannerPattern;
import org.geysermc.geyser.inventory.recipe.TrimRecipe; import org.geysermc.geyser.inventory.recipe.TrimRecipe;
import org.geysermc.geyser.level.JavaDimension; import org.geysermc.geyser.level.JavaDimension;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.cache.registry.JavaRegistry;
import org.geysermc.geyser.session.cache.registry.SimpleJavaRegistry;
import org.geysermc.geyser.text.TextDecoration; import org.geysermc.geyser.text.TextDecoration;
import org.geysermc.geyser.translator.level.BiomeTranslator; import org.geysermc.geyser.translator.level.BiomeTranslator;
import org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry; import org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry;
import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket; import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -71,7 +71,7 @@ public final class RegistryCache {
register("trim_material", cache -> cache.trimMaterials, TrimRecipe::readTrimMaterial); register("trim_material", cache -> cache.trimMaterials, TrimRecipe::readTrimMaterial);
register("trim_pattern", cache -> cache.trimPatterns, TrimRecipe::readTrimPattern); register("trim_pattern", cache -> cache.trimPatterns, TrimRecipe::readTrimPattern);
register("worldgen/biome", (cache, array) -> cache.biomeTranslations = array, BiomeTranslator::loadServerBiome); register("worldgen/biome", (cache, array) -> cache.biomeTranslations = array, BiomeTranslator::loadServerBiome);
registerBannerRegistry(($, entry) -> BannerPattern.getByJavaIdentifier(entry.getId())); register("banner_pattern", cache -> cache.bannerPatterns, ($, entry) -> BannerPattern.getByJavaIdentifier(entry.getId()));
register("wolf_variant", cache -> cache.wolfVariants, ($, entry) -> WolfEntity.WolfVariant.getByJavaIdentifier(entry.getId())); register("wolf_variant", cache -> cache.wolfVariants, ($, entry) -> WolfEntity.WolfVariant.getByJavaIdentifier(entry.getId()));
} }
@ -82,16 +82,16 @@ public final class RegistryCache {
* Java -> Bedrock biome network IDs. * Java -> Bedrock biome network IDs.
*/ */
private int[] biomeTranslations; private int[] biomeTranslations;
private final Int2ObjectMap<TextDecoration> chatTypes = new Int2ObjectOpenHashMap<>(7); private final JavaRegistry<TextDecoration> chatTypes = new SimpleJavaRegistry<>();
/** /**
* All dimensions that the client could possibly connect to. * All dimensions that the client could possibly connect to.
*/ */
private final Int2ObjectMap<JavaDimension> dimensions = new Int2ObjectOpenHashMap<>(4); private final JavaRegistry<JavaDimension> dimensions = new SimpleJavaRegistry<>();
private final Int2ObjectMap<TrimMaterial> trimMaterials = new Int2ObjectOpenHashMap<>(); private final JavaRegistry<TrimMaterial> trimMaterials = new SimpleJavaRegistry<>();
private final Int2ObjectMap<TrimPattern> trimPatterns = new Int2ObjectOpenHashMap<>(); private final JavaRegistry<TrimPattern> trimPatterns = new SimpleJavaRegistry<>();
private Int2ObjectBiMap<BannerPattern> bannerPatterns = new Int2ObjectBiMap<>(); private final JavaRegistry<BannerPattern> bannerPatterns = new SimpleJavaRegistry<>();
private final Int2ObjectMap<WolfEntity.WolfVariant> wolfVariants = new Int2ObjectOpenHashMap<>(); private final JavaRegistry<WolfEntity.WolfVariant> wolfVariants = new SimpleJavaRegistry<>();
public RegistryCache(GeyserSession session) { public RegistryCache(GeyserSession session) {
this.session = session; this.session = session;
@ -109,47 +109,25 @@ public final class RegistryCache {
} }
} }
private static <T> void registerBannerRegistry(BiFunction<GeyserSession, RegistryEntry, T> reader) {
REGISTRIES.put("minecraft:banner_pattern", ((registryCache, entries) -> {
// Clear each local cache every time a new registry entry is given to us
// (e.g. proxy server switches)
registryCache.bannerPatterns = new Int2ObjectBiMap<>(); // Cannot clear it, must re-create :(
for (int i = 0; i < entries.size(); i++) {
RegistryEntry entry = entries.get(i);
// This is what Geyser wants to keep as a value for this registry.
T cacheEntry = reader.apply(registryCache.session, entry);
if (cacheEntry != null) {
registryCache.bannerPatterns.put(i, (BannerPattern) cacheEntry);
} else {
// TODO - seems to be possible with viaversion :/
GeyserImpl.getInstance().getLogger().warning("Was not able to translate entry: ");
}
}
}));
}
/** /**
* @param registry the Java registry resource location, without the "minecraft:" prefix. * @param registry the Java registry resource location, without the "minecraft:" prefix.
* @param localCacheFunction which local field in RegistryCache are we caching entries for this registry? * @param localCacheFunction which local field in RegistryCache are we caching entries for this registry?
* @param reader converts the RegistryEntry NBT into a class file * @param reader converts the RegistryEntry NBT into a class file
* @param <T> the class that represents these entries. * @param <T> the class that represents these entries.
*/ */
private static <T> void register(String registry, Function<RegistryCache, Int2ObjectMap<T>> localCacheFunction, BiFunction<GeyserSession, RegistryEntry, T> reader) { private static <T> void register(String registry, Function<RegistryCache, JavaRegistry<T>> localCacheFunction, BiFunction<GeyserSession, RegistryEntry, T> reader) {
REGISTRIES.put("minecraft:" + registry, (registryCache, entries) -> { REGISTRIES.put("minecraft:" + registry, (registryCache, entries) -> {
Int2ObjectMap<T> localCache = localCacheFunction.apply(registryCache); JavaRegistry<T> localCache = localCacheFunction.apply(registryCache);
// Clear each local cache every time a new registry entry is given to us // Clear each local cache every time a new registry entry is given to us
// (e.g. proxy server switches) // (e.g. proxy server switches)
localCache.clear(); List<T> builder = new ArrayList<>(entries.size());
for (int i = 0; i < entries.size(); i++) { for (int i = 0; i < entries.size(); i++) {
RegistryEntry entry = entries.get(i); RegistryEntry entry = entries.get(i);
// This is what Geyser wants to keep as a value for this registry. // This is what Geyser wants to keep as a value for this registry.
T cacheEntry = reader.apply(registryCache.session, entry); T cacheEntry = reader.apply(registryCache.session, entry);
localCache.put(i, cacheEntry); builder.add(i, cacheEntry);
}
// Trim registry down to needed size
if (localCache instanceof Int2ObjectOpenHashMap<T> hashMap) {
hashMap.trim();
} }
localCache.reset(builder);
}); });
} }

Datei anzeigen

@ -0,0 +1,56 @@
/*
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.session.cache.registry;
import org.checkerframework.checker.index.qual.NonNegative;
import java.util.List;
/**
* A wrapper for a list, holding Java registry values.
*/
public interface JavaRegistry<T> {
/**
* Looks up a registry entry by its ID. The object can be null, or not present.
*/
T byId(@NonNegative int id);
/**
* Reverse looks-up an object to return its network ID, or -1.
*/
int byValue(T value);
/**
* Resets the objects by these IDs.
*/
void reset(List<T> values);
/**
* All values of this registry, as a list.
*/
List<T> values();
}

Datei anzeigen

@ -0,0 +1,59 @@
/*
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.session.cache.registry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.checkerframework.checker.index.qual.NonNegative;
import java.util.List;
public class SimpleJavaRegistry<T> implements JavaRegistry<T> {
protected final ObjectArrayList<T> values = new ObjectArrayList<>();
@Override
public T byId(@NonNegative int id) {
if (id < 0 || id >= this.values.size()) {
return null;
}
return this.values.get(id);
}
@Override
public int byValue(T value) {
return this.values.indexOf(value);
}
@Override
public void reset(List<T> values) {
this.values.addAll(values);
this.values.trim();
}
@Override
public List<T> values() {
return this.values;
}
}

Datei anzeigen

@ -330,7 +330,7 @@ public class MessageTranslator {
textPacket.setNeedsTranslation(false); textPacket.setNeedsTranslation(false);
TextDecoration decoration = session.getRegistryCache().chatTypes().get(chatType); TextDecoration decoration = session.getRegistryCache().chatTypes().byId(chatType);
if (decoration != null) { if (decoration != null) {
// As of 1.19 - do this to apply all the styling for signed messages // As of 1.19 - do this to apply all the styling for signed messages
// Though, Bedrock cannot care about the signed stuff. // Though, Bedrock cannot care about the signed stuff.

Datei anzeigen

@ -280,7 +280,7 @@ public class ChunkUtils {
* This must be done after the player has switched dimensions so we know what their dimension is * This must be done after the player has switched dimensions so we know what their dimension is
*/ */
public static void loadDimension(GeyserSession session) { public static void loadDimension(GeyserSession session) {
JavaDimension dimension = session.getRegistryCache().dimensions().get(session.getDimension()); JavaDimension dimension = session.getRegistryCache().dimensions().byId(session.getDimension());
session.setDimensionType(dimension); session.setDimensionType(dimension);
int minY = dimension.minY(); int minY = dimension.minY();
int maxY = dimension.maxY(); int maxY = dimension.maxY();