Patch version 6.4.1 (#435)

* Bump version to 6.4.1

* fix fabric dev env

* Invert exposed ore logic (#433)

* Invert exposed ore logic

* Bump ore addon version

* Use logger in Gradle over println (#434)

* Log info instead of println in gradle scripts

* Missed buildSrc printlns

---------

Co-authored-by: Zoë <duplexsys@protonmail.com>
This commit is contained in:
Astrashh
2023-11-25 12:02:45 +11:00
committed by GitHub
parent 6060ceae57
commit 3aef977384
10 changed files with 31 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
version = version("1.1.0")
version = version("1.1.1")
dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))

View File

@@ -8,31 +8,24 @@ import com.dfsek.terra.api.world.WritableWorld;
public class VanillaOreUtils {
protected static boolean shouldNotDiscard(Random random, double chance) {
if(chance <= 0.0F) {
return true;
} else if(chance >= 1.0F) {
return false;
} else {
return random.nextFloat() >= chance;
}
private static boolean shouldExpose(Random random, double exposedChance) {
if(exposedChance >= 1.0F) return true;
if(exposedChance <= 0.0F) return false;
return random.nextFloat() < exposedChance;
}
public static boolean shouldPlace(MaterialSet replaceable, BlockType type, Double exposed, Random random, WritableWorld world, int x,
public static boolean shouldPlace(MaterialSet replaceable, BlockType type, Double exposedChance, Random random, WritableWorld world,
int x,
int y, int z) {
if(!replaceable.contains(type)) {
return false;
} else if(shouldNotDiscard(random, exposed)) {
return true;
} else {
return !(world.getBlockState(x, y, z - 1).isAir() ||
world.getBlockState(x, y, z + 1).isAir() ||
world.getBlockState(x, y - 1, z).isAir() ||
world.getBlockState(x, y + 1, z).isAir() ||
world.getBlockState(x - 1, y, z).isAir() ||
world.getBlockState(x + 1, y, z).isAir());
}
if(!replaceable.contains(type)) return false;
if(shouldExpose(random, exposedChance)) return true; // Exposed blocks can be placed regardless of adjacency to air
// Adjacency is checked after determining not exposed rather than vice-versa, assuming block checks are more expensive
boolean adjacentAir = world.getBlockState(x, y, z - 1).isAir() ||
world.getBlockState(x, y, z + 1).isAir() ||
world.getBlockState(x, y - 1, z).isAir() ||
world.getBlockState(x, y + 1, z).isAir() ||
world.getBlockState(x - 1, y, z).isAir() ||
world.getBlockState(x + 1, y, z).isAir();
return !adjacentAir; // Exposed check did not pass earlier so only blocks not adjacent air should place
}
}