mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-01 07:26:09 +00:00
Finalised wolves
This commit is contained in:
parent
d71c6bb25f
commit
5446b729f9
@ -95,14 +95,15 @@ public class CommonListener implements Listener {
|
|||||||
|
|
||||||
NamespacedKey biomeKey = wolf.getWorld().getBiome(wolf.getLocation()).getKey();
|
NamespacedKey biomeKey = wolf.getWorld().getBiome(wolf.getLocation()).getKey();
|
||||||
pack.getBiomeProvider().stream()
|
pack.getBiomeProvider().stream()
|
||||||
.filter(biome -> ((BukkitPlatformBiome) biome.getPlatformBiome()).getHandle()
|
.filter(biome -> {
|
||||||
.getKey().equals(biomeKey))
|
NamespacedKey key = ((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
|
||||||
|
.get(BukkitBiomeInfo.class)
|
||||||
|
.biomeKey();
|
||||||
|
return key.equals(biomeKey);
|
||||||
|
})
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent(biome -> {
|
.ifPresent(biome -> {
|
||||||
NamespacedKey vanillaBiomeKey = ((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
|
NamespacedKey vanillaBiomeKey = ((BukkitPlatformBiome) biome.getPlatformBiome()).getHandle().getKey();
|
||||||
.get(BukkitBiomeInfo.class)
|
|
||||||
.vanillaBiomeKey();
|
|
||||||
|
|
||||||
switch(vanillaBiomeKey.toString()) {
|
switch(vanillaBiomeKey.toString()) {
|
||||||
case "minecraft:snowy_taiga" -> wolf.setVariant(Variant.ASHEN);
|
case "minecraft:snowy_taiga" -> wolf.setVariant(Variant.ASHEN);
|
||||||
case "minecraft:old_growth_pine_taiga" -> wolf.setVariant(Variant.BLACK);
|
case "minecraft:old_growth_pine_taiga" -> wolf.setVariant(Variant.BLACK);
|
||||||
|
@ -5,4 +5,4 @@ import com.dfsek.terra.api.properties.Properties;
|
|||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
|
|
||||||
|
|
||||||
public record BukkitBiomeInfo(NamespacedKey vanillaBiomeKey) implements Properties {}
|
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {}
|
||||||
|
@ -56,15 +56,14 @@ public class AwfulBukkitHacks {
|
|||||||
|
|
||||||
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(), vanillaBiomeProperties);
|
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(), vanillaBiomeProperties);
|
||||||
|
|
||||||
ResourceKey<Biome> delegateKey = ResourceKey.create(
|
ResourceLocation delegateMinecraftKey = ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key));
|
||||||
Registries.BIOME,
|
NamespacedKey delegateBukkitKey = NamespacedKey.fromString(delegateMinecraftKey.toString());
|
||||||
ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key))
|
ResourceKey<Biome> delegateKey = ResourceKey.create(Registries.BIOME, delegateMinecraftKey);
|
||||||
);
|
|
||||||
|
|
||||||
Reference<Biome> holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN);
|
Reference<Biome> holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN);
|
||||||
Reflection.REFERENCE.invokeBindValue(holder, platform); // IMPORTANT: bind holder.
|
Reflection.REFERENCE.invokeBindValue(holder, platform); // IMPORTANT: bind holder.
|
||||||
|
|
||||||
platformBiome.getContext().put(new BukkitBiomeInfo(vanillaBukkitKey));
|
platformBiome.getContext().put(new BukkitBiomeInfo(delegateBukkitKey));
|
||||||
platformBiome.getContext().put(new NMSBiomeInfo(delegateKey));
|
platformBiome.getContext().put(new NMSBiomeInfo(delegateKey));
|
||||||
|
|
||||||
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
|
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user