From 8b36e3a9b1d7fbd4cfcd7839bf977cf5022ad3e2 Mon Sep 17 00:00:00 2001 From: LudoCrypt <60561627+LudoCrypt@users.noreply.github.com> Date: Sun, 15 Nov 2020 23:44:53 -0600 Subject: [PATCH] Updated biomeList --- .../ludocrypt/perorate/util/BiomeList.java | 33 ++++++++++++ .../perorate/util/ListReturnableList.java | 54 ------------------- .../world/EndMultiNoiseBiomeSource.java | 4 +- 3 files changed, 35 insertions(+), 56 deletions(-) create mode 100644 src/main/java/net/ludocrypt/perorate/util/BiomeList.java delete mode 100644 src/main/java/net/ludocrypt/perorate/util/ListReturnableList.java diff --git a/src/main/java/net/ludocrypt/perorate/util/BiomeList.java b/src/main/java/net/ludocrypt/perorate/util/BiomeList.java new file mode 100644 index 0000000..de32dbd --- /dev/null +++ b/src/main/java/net/ludocrypt/perorate/util/BiomeList.java @@ -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 extends ArrayList { + + private static final long serialVersionUID = -4413563891178735978L; + + public BiomeList addStream(Iterator>> iterator) { + BiomeList list = new BiomeList(); + + iterator.forEachRemaining((pair) -> { + Supplier supplier = pair.getSecond(); + list.add(supplier.get()); + }); + + return list; + } + + public BiomeList addFromMultiNoiseESource(MultiNoiseBiomeSource source) { + return addStream(((MultiNoiseBiomeSourceAccessor) source).getBiomePoints().iterator()); + } + +} diff --git a/src/main/java/net/ludocrypt/perorate/util/ListReturnableList.java b/src/main/java/net/ludocrypt/perorate/util/ListReturnableList.java deleted file mode 100644 index 38e1f87..0000000 --- a/src/main/java/net/ludocrypt/perorate/util/ListReturnableList.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.ludocrypt.perorate.util; - -import java.util.ArrayList; -import java.util.Collection; -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 ListReturnableList extends ArrayList { - - private static final long serialVersionUID = -4413563891178735978L; - - public ListReturnableList ListReturnableadd(E e) { - super.add(e); - return this; - } - - public ListReturnableList ListReturnableadd(int index, E element) { - super.add(index, element); - return this; - } - - public ListReturnableList ListReturnableaddAll(Collection c) { - super.addAll(c); - return this; - } - - public ListReturnableList ListReturnableaddAll(int index, Collection c) { - super.addAll(index, c); - return this; - } - - public ListReturnableList addStream(Iterator>> iterator) { - ListReturnableList list = new ListReturnableList(); - - iterator.forEachRemaining((pair) -> { - Supplier supplier = pair.getSecond(); - list.add(supplier.get()); - }); - - return list; - } - - public ListReturnableList addFromMultiNoiseESource(MultiNoiseBiomeSource source) { - return addStream(((MultiNoiseBiomeSourceAccessor) source).getBiomePoints().iterator()); - } - -} diff --git a/src/main/java/net/ludocrypt/perorate/world/EndMultiNoiseBiomeSource.java b/src/main/java/net/ludocrypt/perorate/world/EndMultiNoiseBiomeSource.java index 9e27ae2..5760fa8 100644 --- a/src/main/java/net/ludocrypt/perorate/world/EndMultiNoiseBiomeSource.java +++ b/src/main/java/net/ludocrypt/perorate/world/EndMultiNoiseBiomeSource.java @@ -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; @@ -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().addFromMultiNoiseESource(centerBiome).addFromMultiNoiseESource(highlandsBiome).addFromMultiNoiseESource(midlandsBiome).addFromMultiNoiseESource(smallIslandsBiome).addFromMultiNoiseESource(barrensBiome)); + super(new BiomeList().addFromMultiNoiseESource(centerBiome).addFromMultiNoiseESource(highlandsBiome).addFromMultiNoiseESource(midlandsBiome).addFromMultiNoiseESource(smallIslandsBiome).addFromMultiNoiseESource(barrensBiome)); this.seed = seed; this.centerBiome = centerBiome; this.highlandsBiome = highlandsBiome;