mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 14:35:12 +00:00
Improve biome detection imports
This commit is contained in:
1 parent
3e6b37ac05
commit
ce0f5b7a78
2 files changed
+29
No files matched your search
@@ -2,6 +2,7 @@ package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
@@ -9,7 +10,9 @@ import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.controllers.data.SpawnData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class SubGuiNpcBiomes extends SubGuiInterface {
|
||||
private SpawnData data;
|
||||
@@ -45,7 +48,15 @@ public class SubGuiNpcBiomes extends SubGuiInterface {
|
||||
addLabel(new GuiNpcLabel(2, "spawning.spawningBiomes", guiLeft + 200, guiTop + 4));
|
||||
|
||||
List<String> biomes = new ArrayList<String>();
|
||||
Set<BiomeGenBase> allBiomes = new HashSet<BiomeGenBase>();
|
||||
for (BiomeDictionary.Type type : BiomeDictionary.Type.values()) {
|
||||
allBiomes.addAll(BiomeDictionary.getBiomesForType(type));
|
||||
}
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null)
|
||||
allBiomes.add(base);
|
||||
}
|
||||
for (BiomeGenBase base : allBiomes) {
|
||||
if (base != null && base.biomeName != null && !data.biomes.contains(base.biomeName)) {
|
||||
biomes.add(base.biomeName);
|
||||
}
|
||||
@@ -82,7 +93,15 @@ public class SubGuiNpcBiomes extends SubGuiInterface {
|
||||
}
|
||||
if (button.id == 3) {
|
||||
data.biomes.clear();
|
||||
Set<BiomeGenBase> allBiomes = new HashSet<BiomeGenBase>();
|
||||
for (BiomeDictionary.Type type : BiomeDictionary.Type.values()) {
|
||||
allBiomes.addAll(BiomeDictionary.getBiomesForType(type));
|
||||
}
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null)
|
||||
allBiomes.add(base);
|
||||
}
|
||||
for (BiomeGenBase base : allBiomes) {
|
||||
if (base != null) {
|
||||
data.biomes.add(base.biomeName);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.BiomeDictionary.Type;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.*;
|
||||
@@ -277,7 +279,15 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
@Override
|
||||
public String[] getAllBiomeNames() {
|
||||
List<String> biomes = new ArrayList<>();
|
||||
Set<BiomeGenBase> allBiomes = new HashSet<BiomeGenBase>();
|
||||
for (Type type : BiomeDictionary.Type.values()) {
|
||||
allBiomes.addAll(BiomeDictionary.getBiomesForType(type));
|
||||
}
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null)
|
||||
allBiomes.add(base);
|
||||
}
|
||||
for (BiomeGenBase base : allBiomes) {
|
||||
if (base != null && base.biomeName != null) {
|
||||
biomes.add(base.biomeName);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user