Fixed the nether biome mixin (#652)

Fixed the nether biome mixin on MultiNoiseBiomeSource solving #650
This commit is contained in:
Will Toll 2020-06-01 11:18:16 -05:00 committed by GitHub
parent c6ab3e1b2d
commit 31c789fd11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,8 @@ package net.fabricmc.fabric.mixin.biome;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Pair;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.ModifyArg;
@ -31,10 +33,10 @@ import net.fabricmc.fabric.impl.biome.InternalBiomeData;
@Mixin(MultiNoiseBiomeSource.class) @Mixin(MultiNoiseBiomeSource.class)
public class MixinTheNetherDimension { public class MixinTheNetherDimension {
@ModifyArg(method = "method_28467", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;<init>(JLjava/util/List;Ljava/util/Optional;)V")) @ModifyArg(method = "method_28467", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;<init>(JLjava/util/List;Ljava/util/Optional;)V"))
private static List<Biome> modifyNetherBiomes(List<Biome> list) { private static List<Pair<Biome.MixedNoisePoint, Biome>> modifyNetherBiomes(List<Pair<Biome.MixedNoisePoint, Biome>> list) {
// the provided set is immutable, so we construct our own // the provided set is immutable, so we construct our own
List<Biome> newList = new ArrayList<>(list); List<Pair<Biome.MixedNoisePoint, Biome>> newList = new ArrayList<>(list);
newList.addAll(InternalBiomeData.getNetherBiomes()); newList.addAll(InternalBiomeData.getNetherBiomes().stream().flatMap((biome) -> biome.streamNoises().map((point) -> Pair.of(point, biome))).collect(ImmutableList.toImmutableList()));
return newList; return newList;
} }
} }