mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Follow the API's renamed highest, get and withPropertyIfAccepted
This commit is contained in:
1 parent
59f24a03af
commit
956c33e8db
8 files changed
+14
-14
No files matched your search
@@ -39,7 +39,7 @@ public final class BlockBiomes {
|
||||
public static ResourceId biomeAt(RunningWorld running, int x, int y, int z) {
|
||||
TerrainSampler layout = running.layout();
|
||||
ResourceId surface = layout.surfaceBiome(x, z);
|
||||
if (!layout.bounds().contains(x, y, z) || y > running.highestBlock(x, z, true) - CAVE_DEPTH_BELOW_HIGHEST_BLOCK) {
|
||||
if (!layout.bounds().contains(x, y, z) || y > running.highest(x, z, true) - CAVE_DEPTH_BELOW_HIGHEST_BLOCK) {
|
||||
return surface;
|
||||
}
|
||||
return layout.caveBiome(x, y, z).orElse(surface);
|
||||
|
||||
@@ -207,7 +207,7 @@ public final class TreeGrowing implements SaplingGrowth {
|
||||
|
||||
@Override
|
||||
public BlockState get(int x, int y, int z) {
|
||||
return surroundings.blockAt(x, y, z);
|
||||
return surroundings.get(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -232,13 +232,13 @@ final class Decorator {
|
||||
private BlockState attached(BlockState state, BlockFace support) {
|
||||
String side = support.name().toLowerCase();
|
||||
if ("false".equals(IrisProceduralBlocks.propertyValue(state, side))) {
|
||||
return blocks.withProperty(state, side, "true");
|
||||
return blocks.withPropertyIfAccepted(state, side, "true");
|
||||
}
|
||||
if (support == BlockFace.UP && IrisProceduralBlocks.hasProperty(state, "hanging")) {
|
||||
return blocks.withProperty(state, "hanging", "true");
|
||||
return blocks.withPropertyIfAccepted(state, "hanging", "true");
|
||||
}
|
||||
if (IrisProceduralBlocks.hasProperty(state, "facing")) {
|
||||
return blocks.withProperty(state, "facing", opposite(support).name().toLowerCase());
|
||||
return blocks.withPropertyIfAccepted(state, "facing",opposite(support).name().toLowerCase());
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ final class LeafDecay {
|
||||
|
||||
private void setLeafState(long leaf, boolean persistent, int distance) {
|
||||
BlockState state = blocks.get(leaf);
|
||||
state = builder.withProperty(state, "persistent", String.valueOf(persistent));
|
||||
blocks.put(leaf, builder.withProperty(state, "distance", String.valueOf(distance)));
|
||||
state = builder.withPropertyIfAccepted(state, "persistent", String.valueOf(persistent));
|
||||
blocks.put(leaf, builder.withPropertyIfAccepted(state, "distance", String.valueOf(distance)));
|
||||
}
|
||||
|
||||
private static boolean isLeaf(BlockState state) {
|
||||
|
||||
@@ -130,6 +130,6 @@ final class MaterialPainter {
|
||||
if (axis == PartCanvas.Axis.NONE || !IrisProceduralBlocks.hasProperty(state, "axis")) {
|
||||
return state;
|
||||
}
|
||||
return blocks.withProperty(state, "axis", axis.name().toLowerCase());
|
||||
return blocks.withPropertyIfAccepted(state, "axis",axis.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ final class ObjectBaker {
|
||||
|
||||
private static void waterlog(Map<Long, BlockState> painted, ObjectBuilder blocks) {
|
||||
painted.replaceAll((key, state) -> "false".equals(IrisProceduralBlocks.propertyValue(state, "waterlogged"))
|
||||
? blocks.withProperty(state, "waterlogged", "true") : state);
|
||||
? blocks.withPropertyIfAccepted(state, "waterlogged", "true") : state);
|
||||
}
|
||||
|
||||
/** How far the object sinks: a fraction of its height. Heights below it end up underground. */
|
||||
|
||||
@@ -172,8 +172,8 @@ public final class EntitySpawning implements EntitySpawns {
|
||||
|
||||
/** Where a spawner of its group puts an entity at the column; null when it has no place for one. */
|
||||
private static BlockPosition spawnPosition(RunningWorld running, Spawner spawner, int chunkX, int chunkZ, int x, int z) {
|
||||
int height = running.highestBlock(x, z, true);
|
||||
int heightWithFluid = running.highestBlock(x, z, false);
|
||||
int height = running.highest(x, z, true);
|
||||
int heightWithFluid = running.highest(x, z, false);
|
||||
return switch (spawner.group()) {
|
||||
case NORMAL -> new BlockPosition(x, heightWithFluid + 1, z);
|
||||
case CAVE -> caveSpawnPosition(running, chunkX, chunkZ);
|
||||
|
||||
@@ -57,9 +57,9 @@ public final class ObjectBuilder {
|
||||
return blocks.hasTrait(state, trait);
|
||||
}
|
||||
|
||||
/** {@code state} with the property set, as the platform sets it. */
|
||||
public BlockState withProperty(BlockState state, String name, String value) {
|
||||
return blocks.withProperty(state, name, value);
|
||||
/** {@code state} with the property set, as the platform sets it; {@code state} itself when the block does not accept it. */
|
||||
public BlockState withPropertyIfAccepted(BlockState state, String name, String value) {
|
||||
return blocks.withPropertyIfAccepted(state, name, value);
|
||||
}
|
||||
|
||||
/** The object of {@code blocks}, put in their order, {@code width} by {@code height} by {@code depth}, placeable like the pack's objects. */
|
||||
|
||||
Reference in new issue
Block a user