Skip to content

Commit

Permalink
Updated biomeList
Browse files Browse the repository at this point in the history
  • Loading branch information
LudoCrypt committed Nov 16, 2020
1 parent 2f1f1ad commit 8b36e3a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 56 deletions.
33 changes: 33 additions & 0 deletions src/main/java/net/ludocrypt/perorate/util/BiomeList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.ludocrypt.perorate.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.function.Supplier;

import com.mojang.datafixers.util.Pair;

import net.fabricmc.fabric.mixin.biome.MultiNoiseBiomeSourceAccessor;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.MixedNoisePoint;
import net.minecraft.world.biome.source.MultiNoiseBiomeSource;

public class BiomeList<E> extends ArrayList<E> {

private static final long serialVersionUID = -4413563891178735978L;

public BiomeList<Biome> addStream(Iterator<Pair<MixedNoisePoint, Supplier<Biome>>> iterator) {
BiomeList<Biome> list = new BiomeList<Biome>();

iterator.forEachRemaining((pair) -> {
Supplier<Biome> supplier = pair.getSecond();
list.add(supplier.get());
});

return list;
}

public BiomeList<Biome> addFromMultiNoiseESource(MultiNoiseBiomeSource source) {
return addStream(((MultiNoiseBiomeSourceAccessor) source).getBiomePoints().iterator());
}

}
54 changes: 0 additions & 54 deletions src/main/java/net/ludocrypt/perorate/util/ListReturnableList.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.ludocrypt.perorate.util.ListReturnableList;
import net.ludocrypt.perorate.util.BiomeList;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.noise.SimplexNoiseSampler;
import net.minecraft.world.biome.Biome;
Expand Down Expand Up @@ -40,7 +40,7 @@ public class EndMultiNoiseBiomeSource extends BiomeSource {
private final MultiNoiseBiomeSource barrensBiome;

public EndMultiNoiseBiomeSource(long seed, MultiNoiseBiomeSource centerBiome, MultiNoiseBiomeSource highlandsBiome, MultiNoiseBiomeSource midlandsBiome, MultiNoiseBiomeSource smallIslandsBiome, MultiNoiseBiomeSource barrensBiome) {
super(new ListReturnableList<Biome>().addFromMultiNoiseESource(centerBiome).addFromMultiNoiseESource(highlandsBiome).addFromMultiNoiseESource(midlandsBiome).addFromMultiNoiseESource(smallIslandsBiome).addFromMultiNoiseESource(barrensBiome));
super(new BiomeList<Biome>().addFromMultiNoiseESource(centerBiome).addFromMultiNoiseESource(highlandsBiome).addFromMultiNoiseESource(midlandsBiome).addFromMultiNoiseESource(smallIslandsBiome).addFromMultiNoiseESource(barrensBiome));
this.seed = seed;
this.centerBiome = centerBiome;
this.highlandsBiome = highlandsBiome;
Expand Down

0 comments on commit 8b36e3a

Please sign in to comment.