Biome Regions (group biomes such as hot, cold) so less random gen

This commit is contained in:
Daniel Mills
2020-01-11 04:30:38 -05:00
parent acaf95c017
commit 58632b8da3
35 changed files with 203 additions and 10 deletions

View File

@@ -63,6 +63,7 @@ public class IrisBiome
private boolean scatterSurface;
private boolean core;
private boolean simplexScatter;
private String region;
private GMap<String, Double> schematicGroups;
private PolygonGenerator.EnumPolygonGenerator<MB> poly;
@@ -144,6 +145,7 @@ public class IrisBiome
public IrisBiome(String name, Biome realBiome)
{
this.region = "Default";
this.core = false;
this.name = name;
this.realBiome = realBiome;
@@ -158,6 +160,7 @@ public class IrisBiome
{
name = o.getString("name");
realBiome = Biome.valueOf(o.getString("derivative").toUpperCase().replaceAll(" ", "_"));
J.attempt(() -> region = o.getString("region"));
J.attempt(() -> height = o.getDouble("height"));
J.attempt(() -> surface = mbListFromJSON(o.getJSONArray("surface")));
J.attempt(() -> dirt = mbListFromJSON(o.getJSONArray("dirt")));
@@ -179,6 +182,7 @@ public class IrisBiome
{
JSONObject j = new JSONObject();
j.put("name", name);
J.attempt(() -> j.put("region", region));
J.attempt(() -> j.put("derivative", realBiome.name().toLowerCase().replaceAll("_", " ")));
J.attempt(() -> j.put("height", height));
J.attempt(() -> j.put("surface", mbListToJSON(surface)));
@@ -474,4 +478,9 @@ public class IrisBiome
return false;
}
public String getRegion()
{
return region;
}
}

View File

@@ -0,0 +1,84 @@
package ninja.bytecode.iris.pack;
import ninja.bytecode.iris.util.MaxingGenerator.EnumMaxingGenerator;
import ninja.bytecode.shuriken.collections.GList;
public class IrisRegion
{
private String name;
private GList<IrisBiome> biomes;
private EnumMaxingGenerator<IrisBiome> gen;
public IrisRegion(String name)
{
this.name = name;
this.biomes = new GList<>();
}
public EnumMaxingGenerator<IrisBiome> getGen()
{
return gen;
}
public void setGen(EnumMaxingGenerator<IrisBiome> gen)
{
this.gen = gen;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public GList<IrisBiome> getBiomes()
{
return biomes;
}
public void setBiomes(GList<IrisBiome> biomes)
{
this.biomes = biomes;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((biomes == null) ? 0 : biomes.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
IrisRegion other = (IrisRegion) obj;
if(biomes == null)
{
if(other.biomes != null)
return false;
}
else if(!biomes.equals(other.biomes))
return false;
if(name == null)
{
if(other.name != null)
return false;
}
else if(!name.equals(other.name))
return false;
return true;
}
}