This commit is contained in:
Zoe Gidiere
2024-10-29 14:23:45 -06:00
parent 9d91440997
commit 3ca90808f0
8 changed files with 13 additions and 13 deletions

View File

@@ -1,5 +1,7 @@
package com.dfsek.terra.bukkit.nms.v1_21;
import com.dfsek.terra.bukkit.nms.v1_21.config.VanillaBiomeProperties;
import com.google.common.collect.ImmutableMap;
import net.minecraft.core.Holder;
import net.minecraft.core.Holder.Reference;
@@ -42,7 +44,10 @@ public class AwfulBukkitHacks {
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
vanillaBukkitKey.getKey());
Biome platform = NMSBiomeInjector.createBiome(biome, biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value());
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(), vanillaBiomeProperties);
ResourceKey<Biome> delegateKey = ResourceKey.create(
Registries.BIOME,

View File

@@ -22,14 +22,12 @@ public class NMSBiomeInjector {
.flatMap(registry::get);
}
public static Biome createBiome(com.dfsek.terra.api.world.biome.Biome biome, Biome vanilla)
public static Biome createBiome(Biome vanilla, VanillaBiomeProperties vanillaBiomeProperties)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
Biome.BiomeBuilder builder = new Biome.BiomeBuilder();
BiomeSpecialEffects.Builder effects = new BiomeSpecialEffects.Builder();
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
effects.fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor()))
.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()))
.waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))

View File

@@ -28,7 +28,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
try {
return new AmbientParticleSettings(ParticleArgument.readParticle(new StringReader(particle),
(Provider) BuiltInRegistries.PARTICLE_TYPE.asLookup()), probability);
(Provider) BuiltInRegistries.PARTICLE_TYPE.asHolderIdMap()), probability);
} catch(CommandSyntaxException e) {
throw new RuntimeException(e);
}

View File

@@ -16,6 +16,6 @@ public class EntityTypeTemplate implements ObjectTemplate<EntityType<?>> {
@Override
public EntityType<?> get() {
return BuiltInRegistries.ENTITY_TYPE.get(id);
return BuiltInRegistries.ENTITY_TYPE.get(id).orElseThrow().value();
}
}

View File

@@ -18,6 +18,6 @@ public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
@Override
public VillagerType get() {
return BuiltInRegistries.VILLAGER_TYPE.get(id);
return BuiltInRegistries.VILLAGER_TYPE.get(id).orElseThrow().value();
}
}