Fabric End Biome API support

This commit is contained in:
paulevsGitch 2020-12-12 21:45:49 +03:00
parent 74e9adf42e
commit f5b297b1bc
4 changed files with 58 additions and 1 deletions

View file

@ -0,0 +1,30 @@
package ru.betterend.mixin.common;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndBiomes;
@Mixin(InternalBiomeData.class)
public class InternalBiomeDataMixin {
@Inject(method = "addEndBiomeReplacement", at = @At("TAIL"))
private static void beAddIslandsBiomeFromFabric(RegistryKey<Biome> replaced, RegistryKey<Biome> variant, double weight, CallbackInfo info) {
if (replaced == BiomeKeys.SMALL_END_ISLANDS) {
Biome biome = BuiltinRegistries.BIOME.get(variant);
Identifier id = BuiltinRegistries.BIOME.getId(biome);
EndBiomes.FABRIC_VOID.add(id);
if (BetterEnd.isDevEnvironment()) {
System.out.println("Added " + id + " from Fabric small islands biome map");
}
}
}
}