Fixed structure features and code style
This commit is contained in:
parent
d431f2555c
commit
5a9365e2bb
153 changed files with 2304 additions and 2459 deletions
|
@ -1,15 +1,9 @@
|
|||
package ru.bclib.world.biomes;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
@ -21,23 +15,28 @@ import ru.bclib.world.features.ListFeature;
|
|||
import ru.bclib.world.features.ListFeature.StructureInfo;
|
||||
import ru.bclib.world.features.NBTStructureFeature.TerrainMerge;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class BCLBiome {
|
||||
protected WeightedList<BCLBiome> subbiomes = new WeightedList<BCLBiome>();
|
||||
|
||||
|
||||
protected final Biome biome;
|
||||
protected final ResourceLocation mcID;
|
||||
protected BCLBiome edge;
|
||||
protected int edgeSize;
|
||||
|
||||
|
||||
protected BCLBiome biomeParent;
|
||||
protected float maxSubBiomeChance = 1;
|
||||
protected final float genChance;
|
||||
|
||||
|
||||
private final Map<String, Object> customData;
|
||||
private final float fogDensity;
|
||||
private BCLFeature structuresFeature;
|
||||
private Biome actualBiome;
|
||||
|
||||
|
||||
public BCLBiome(BCLBiomeDef definition) {
|
||||
this.mcID = definition.getID();
|
||||
this.readStructureList();
|
||||
|
@ -49,7 +48,7 @@ public class BCLBiome {
|
|||
this.fogDensity = definition.getFodDensity();
|
||||
this.customData = definition.getCustomData();
|
||||
}
|
||||
|
||||
|
||||
public BCLBiome(ResourceLocation id, Biome biome, float fogDensity, float genChance) {
|
||||
this.mcID = id;
|
||||
this.biome = biome;
|
||||
|
@ -58,24 +57,24 @@ public class BCLBiome {
|
|||
this.readStructureList();
|
||||
this.customData = Maps.newHashMap();
|
||||
}
|
||||
|
||||
|
||||
public BCLBiome getEdge() {
|
||||
return edge == null ? this : edge;
|
||||
}
|
||||
|
||||
|
||||
public void setEdge(BCLBiome edge) {
|
||||
this.edge = edge;
|
||||
edge.biomeParent = this;
|
||||
}
|
||||
|
||||
|
||||
public int getEdgeSize() {
|
||||
return edgeSize;
|
||||
}
|
||||
|
||||
|
||||
public void setEdgeSize(int size) {
|
||||
edgeSize = size;
|
||||
}
|
||||
|
||||
|
||||
public void addSubBiome(BCLBiome biome) {
|
||||
biome.biomeParent = this;
|
||||
subbiomes.add(biome, biome.getGenChance());
|
||||
|
@ -84,41 +83,41 @@ public class BCLBiome {
|
|||
public boolean containsSubBiome(BCLBiome biome) {
|
||||
return subbiomes.contains(biome);
|
||||
}
|
||||
|
||||
|
||||
public BCLBiome getSubBiome(Random random) {
|
||||
BCLBiome biome = subbiomes.get(random);
|
||||
return biome == null ? this : biome;
|
||||
}
|
||||
|
||||
|
||||
public BCLBiome getParentBiome() {
|
||||
return this.biomeParent;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasEdge() {
|
||||
return edge != null;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasParentBiome() {
|
||||
return biomeParent != null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSame(BCLBiome biome) {
|
||||
return biome == this || (biome.hasParentBiome() && biome.getParentBiome() == this);
|
||||
}
|
||||
|
||||
|
||||
public Biome getBiome() {
|
||||
return biome;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mcID.toString();
|
||||
}
|
||||
|
||||
|
||||
public ResourceLocation getID() {
|
||||
return mcID;
|
||||
}
|
||||
|
||||
|
||||
public float getFogDensity() {
|
||||
return fogDensity;
|
||||
}
|
||||
|
@ -126,7 +125,7 @@ public class BCLBiome {
|
|||
protected void readStructureList() {
|
||||
String ns = mcID.getNamespace();
|
||||
String nm = mcID.getPath();
|
||||
|
||||
|
||||
String path = "/data/" + ns + "/structures/biome/" + nm + "/";
|
||||
InputStream inputstream = StructureHelper.class.getResourceAsStream(path + "structures.json");
|
||||
if (inputstream != null) {
|
||||
|
@ -155,7 +154,7 @@ public class BCLBiome {
|
|||
public Biome getActualBiome() {
|
||||
return this.actualBiome;
|
||||
}
|
||||
|
||||
|
||||
public float getGenChance() {
|
||||
return this.genChance;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue