Adapted to soem Fabric API changes

This commit is contained in:
Frank 2021-09-25 11:36:26 +02:00
parent 23bcbe1977
commit e2ab77658b
11 changed files with 74 additions and 117 deletions

View file

@ -1,41 +0,0 @@
package ru.bclib.mixin.common;
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.biome.Climate;
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 ru.bclib.world.biomes.FabricBiomesData;
@Mixin(value = InternalBiomeData.class, remap = false)
public class InternalBiomeDataMixin {
@Inject(method = "addEndBiomeReplacement", at = @At(value = "HEAD"))
private static void bclib_addEndBiomeReplacement(ResourceKey<Biome> replaced, ResourceKey<Biome> variant, double weight, CallbackInfo info) {
if (replaced == Biomes.END_BARRENS || replaced == Biomes.SMALL_END_ISLANDS) {
FabricBiomesData.END_VOID_BIOMES.put(variant, (float) weight);
}
else {
FabricBiomesData.END_LAND_BIOMES.put(variant, (float) weight);
}
}
@Inject(method = "addEndMidlandsReplacement", at = @At(value = "HEAD"))
private static void bclib_addEndMidlandsReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> midlands, double weight, CallbackInfo info) {
FabricBiomesData.END_LAND_BIOMES.put(midlands, (float) weight);
}
@Inject(method = "addEndBarrensReplacement", at = @At(value = "HEAD"))
private static void bclib_addEndBarrensReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> barrens, double weight, CallbackInfo info) {
FabricBiomesData.END_LAND_BIOMES.put(barrens, (float) weight);
FabricBiomesData.END_VOID_BIOMES.put(barrens, (float) weight);
}
@Inject(method = "addNetherBiome", at = @At(value = "HEAD"))
private static void bclib_addNetherBiome(ResourceKey<Biome> biome, Climate.ParameterPoint spawnNoisePoint, CallbackInfo info) {
FabricBiomesData.NETHER_BIOMES.add(biome);
}
}

View file

@ -0,0 +1,19 @@
package ru.bclib.mixin.common;
import net.fabricmc.fabric.impl.biome.NetherBiomeData;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Climate;
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 ru.bclib.world.biomes.FabricBiomesData;
@Mixin(value = NetherBiomeData.class, remap = false)
public class NetherBiomeDataMixin {
@Inject(method = "addNetherBiome", at = @At(value = "HEAD"))
private static void bclib_addNetherBiome(ResourceKey<Biome> biome, Climate.ParameterPoint spawnNoisePoint, CallbackInfo info) {
FabricBiomesData.NETHER_BIOMES.add(biome);
}
}

View file

@ -0,0 +1,35 @@
package ru.bclib.mixin.common;
import net.fabricmc.fabric.impl.biome.TheEndBiomeData;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
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 ru.bclib.world.biomes.FabricBiomesData;
@Mixin(value = TheEndBiomeData.class, remap = false)
public class TheEndBiomeDataMixin {
@Inject(method = "addEndBiomeReplacement", at = @At(value = "HEAD"))
private static void bclib_addEndBiomeReplacement(ResourceKey<Biome> replaced, ResourceKey<Biome> variant, double weight, CallbackInfo info) {
if (replaced == Biomes.END_BARRENS || replaced == Biomes.SMALL_END_ISLANDS) {
FabricBiomesData.END_VOID_BIOMES.put(variant, (float) weight);
}
else {
FabricBiomesData.END_LAND_BIOMES.put(variant, (float) weight);
}
}
@Inject(method = "addEndMidlandsReplacement", at = @At(value = "HEAD"))
private static void bclib_addEndMidlandsReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> midlands, double weight, CallbackInfo info) {
FabricBiomesData.END_LAND_BIOMES.put(midlands, (float) weight);
}
@Inject(method = "addEndBarrensReplacement", at = @At(value = "HEAD"))
private static void bclib_addEndBarrensReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> barrens, double weight, CallbackInfo info) {
FabricBiomesData.END_LAND_BIOMES.put(barrens, (float) weight);
FabricBiomesData.END_VOID_BIOMES.put(barrens, (float) weight);
}
}