Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ object Versions {
}

object Minestom {
const val minestom = "1_21_5-4d91778331"
const val minestom = "1_21_5-1e8b8693ac"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import com.dfsek.terra.api.world.biome.PlatformBiome;

import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;
import net.minestom.server.world.biome.Biome;


public class MinestomBiome implements PlatformBiome {
private final DynamicRegistry.Key<Biome> biome;
private final RegistryKey<Biome> biome;

public MinestomBiome(DynamicRegistry.Key<Biome> biome) { this.biome = biome; }
public MinestomBiome(RegistryKey<Biome> biome) { this.biome = biome; }

@Override
public DynamicRegistry.Key<Biome> getHandle() {
public RegistryKey<Biome> getHandle() {
return biome;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.dfsek.terra.api.world.biome.PlatformBiome;

import net.kyori.adventure.key.Key;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;
import org.intellij.lang.annotations.Subst;
import org.jetbrains.annotations.NotNull;

Expand All @@ -21,6 +21,6 @@ public PlatformBiome load(@NotNull AnnotatedType annotatedType, @NotNull Object
@Subst("name:value")
String id = (String) o;
Key key = Key.key(id);
return new MinestomBiome(DynamicRegistry.Key.of(key));
return new MinestomBiome(RegistryKey.unsafeOf(key));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minestom.server.MinecraftServer;
import net.minestom.server.color.Color;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;
import net.minestom.server.world.biome.Biome;
import net.minestom.server.world.biome.BiomeEffects;
import org.intellij.lang.annotations.Subst;
Expand All @@ -24,7 +25,7 @@ public class MinestomUserDefinedBiomeFactory implements BiomeFactory {
@Override
public UserDefinedBiome create(ConfigPack pack, com.dfsek.terra.api.world.biome.Biome source) {
VanillaBiomeProperties properties = source.getContext().get(VanillaBiomeProperties.class);
DynamicRegistry.Key<Biome> parentKey = ((MinestomBiome) source.getPlatformBiome()).getHandle();
RegistryKey<Biome> parentKey = ((MinestomBiome) source.getPlatformBiome()).getHandle();
Biome parent = mergeNullable(biomeRegistry.get(parentKey), plainsBiome);
BiomeEffects parentEffects = parent.effects();
Key key = Key.key("terra", createBiomeID(pack, source.getID()));
Expand Down Expand Up @@ -57,7 +58,7 @@ public UserDefinedBiome create(ConfigPack pack, com.dfsek.terra.api.world.biome.
.effects(effectsBuilder.build())
.build();

DynamicRegistry.Key<Biome> registryKey = MinecraftServer.getBiomeRegistry().register(key, target);
RegistryKey<Biome> registryKey = MinecraftServer.getBiomeRegistry().register(key, target);
return new UserDefinedBiome(key, registryKey, source.getID(), target);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.dfsek.terra.minestom.biome;

import net.kyori.adventure.key.Key;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;
import net.minestom.server.world.biome.Biome;


public record UserDefinedBiome(Key key, DynamicRegistry.Key<Biome> registry, String id, Biome biome) {
public record UserDefinedBiome(Key key, RegistryKey<Biome> registry, String id, Biome biome) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minestom.server.MinecraftServer;
import net.minestom.server.item.Material;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;

import java.util.Objects;

Expand Down Expand Up @@ -40,7 +41,7 @@ public boolean conflictsWith(Enchantment other) {
// Get the registry key for the other enchantment to use in contains
try {
DynamicRegistry<net.minestom.server.item.enchant.Enchantment> registry = MinecraftServer.getEnchantmentRegistry();
DynamicRegistry.Key<net.minestom.server.item.enchant.Enchantment> otherKey = registry.getKey(otherDelegate);
RegistryKey<net.minestom.server.item.enchant.Enchantment> otherKey = registry.getKey(otherDelegate);
return delegate.exclusiveSet().contains(otherKey);
} catch (Exception e) {
// If the key approach fails, fall back to a more basic implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.component.EnchantmentList;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.DynamicRegistry.Key;
import net.minestom.server.registry.RegistryKey;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
Expand Down Expand Up @@ -59,7 +59,7 @@ public ItemMeta getItemMeta() {

@Override
public void setItemMeta(ItemMeta meta) {
HashMap<Key<net.minestom.server.item.enchant.Enchantment>, Integer> enchantments = new HashMap<>();
HashMap<RegistryKey<net.minestom.server.item.enchant.Enchantment>, Integer> enchantments = new HashMap<>();
DynamicRegistry<net.minestom.server.item.enchant.Enchantment> registry = MinecraftServer.getEnchantmentRegistry();
meta.getEnchantments().forEach((key, value) -> {
MinestomEnchantment enchantment = (MinestomEnchantment) key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ public void setPack(ConfigPack pack) {

private void preloadBiomes() {
this.biomePool.preloadBiomes(world.getBiomeProvider().getBiomes());
for(Player player : MinecraftServer.getConnectionManager().getOnlinePlayers()) {
player.startConfigurationPhase();
}
}

public void displayStats() {
Expand Down