Fixed ModMenu integration (#58)

This commit is contained in:
Frank 2021-12-16 11:34:13 +01:00
commit 192a537939
4 changed files with 14 additions and 15 deletions

View file

@ -11,7 +11,7 @@ loader_version= 0.12.12
fabric_version = 0.44.0+1.18
# Mod Properties
mod_version = 1.1.1
mod_version = 1.1.2
maven_group = ru.bclib
archives_base_name = bclib

View file

@ -41,7 +41,7 @@ public class BCLBiome {
private float terrainHeight = 0.1F;
private float fogDensity = 1.0F;
private float genChance = 1.0F;
private float edgeSize = 0.0F;
private int edgeSize = 0;
private boolean vertical;
/**
@ -96,18 +96,18 @@ public class BCLBiome {
/**
* Getter for biome edge size.
* @return edge size.
* @return edge size in blocks.
*/
public float getEdgeSize() {
public int getEdgeSize() {
return edgeSize;
}
/**
* Set edges size for this biome. Size is in relative units to work fine with biome scale.
* Set edges size for this biome. Size is in blocks.
* @param size as a float value.
* @return same {@link BCLBiome}.
*/
public BCLBiome setEdgeSize(float size) {
public BCLBiome setEdgeSize(int size) {
edgeSize = size;
return this;
}

View file

@ -53,20 +53,19 @@ public class HexBiomeMap implements BiomeMap {
public BCLBiome getBiome(double x, double y, double z) {
BCLBiome biome = getRawBiome(x, z);
BCLBiome edge = biome.getEdge();
float offset = biome.getEdgeSize();
int size = biome.getEdgeSize();
if (edge == null && biome.getParentBiome() != null) {
edge = biome.getParentBiome().getEdge();
offset = biome.getParentBiome().getEdgeSize();
size = biome.getParentBiome().getEdgeSize();
}
if (edge == null) {
return biome;
}
offset *= scale;
for (byte i = 0; i < 8; i++) {
if (!getRawBiome(x + offset * EDGE_CIRCLE_X[i], z + offset * EDGE_CIRCLE_Z[i]).isSame(biome)) {
if (!getRawBiome(x + size * EDGE_CIRCLE_X[i], z + size * EDGE_CIRCLE_Z[i]).isSame(biome)) {
return edge;
}
}

View file

@ -54,12 +54,12 @@ public class SquareBiomeMap implements BiomeMap {
if (biome.getParentBiome() != null) {
search = biome.getParentBiome();
}
int d = (int) Math.ceil(search.getEdgeSize() / 4F) << 2;
boolean edge = !search.isSame(getRawBiome(x + d, z));
edge = edge || !search.isSame(getRawBiome(x - d, z));
edge = edge || !search.isSame(getRawBiome(x, z + d));
edge = edge || !search.isSame(getRawBiome(x, z - d));
int size = search.getEdgeSize();
boolean edge = !search.isSame(getRawBiome(x + size, z));
edge = edge || !search.isSame(getRawBiome(x - size, z));
edge = edge || !search.isSame(getRawBiome(x, z + size));
edge = edge || !search.isSame(getRawBiome(x, z - size));
edge = edge || !search.isSame(getRawBiome(x - 1, z - 1));
edge = edge || !search.isSame(getRawBiome(x - 1, z + 1));
edge = edge || !search.isSame(getRawBiome(x + 1, z - 1));