mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Keep a clipped sea-surface stack ending on its top palette block
A stack cut short by the height limit stopped on a body block because the top threshold was computed from the unclipped length. Clamp the stack to the room under the ceiling before placing, and treat a single-block stack as the top block. Upstream:75353d43c5baea8dd5
This commit is contained in:
1 parent
e004ae1775
commit
0d9ea26cc9
2 files changed
+80
-19
No files matched your search
+10
-19
@@ -29,6 +29,12 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
DecoratedBiome biome, int height, int max) {
|
||||
var data = scene.blocks();
|
||||
int maxBaseY = Math.min(max, Math.min(scene.worldHeight(), data.height()) - 1);
|
||||
if (height < 0 || height >= maxBaseY) {
|
||||
return;
|
||||
}
|
||||
|
||||
RNG rng = getRNG(realX, realZ);
|
||||
ResolvedDecorator decorator = DecoratorCore.pickDecorator(decorators.decorators(biome, getPart()), rng, realX, realZ, decorators.log());
|
||||
|
||||
@@ -36,11 +42,9 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = scene.blocks();
|
||||
if (!decorator.isStacking()) {
|
||||
int targetY = height + 1;
|
||||
if (height >= 0 && targetY < scene.worldHeight()
|
||||
&& DecoratorCore.canReplaceStackTarget(scene, data.get(x, targetY, z), false)) {
|
||||
if (DecoratorCore.canReplaceStackTarget(scene, data.get(x, targetY, z), false)) {
|
||||
BlockState block = decorator.blockAt(realX, height, realZ);
|
||||
if (block != null) {
|
||||
data.set(x, targetY, z, block);
|
||||
@@ -54,28 +58,15 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
stack = (int) Math.ceil((double) (max - height) * ((double) stack / 100));
|
||||
}
|
||||
|
||||
if (stack == 1) {
|
||||
int targetY = height + 1;
|
||||
if (targetY >= data.height() || !DecoratorCore.canReplaceStackTarget(scene, data.get(x, targetY, z), false)) {
|
||||
return;
|
||||
}
|
||||
stack = Math.min(stack, maxBaseY - height);
|
||||
|
||||
BlockState block = decorator.topBlockAt(realX, height, realZ);
|
||||
if (block != null) {
|
||||
data.set(x, targetY, z, block);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int engineHeight = scene.worldHeight();
|
||||
for (int i = 0; i < stack; i++) {
|
||||
int h = height + i;
|
||||
int targetY = h + 1;
|
||||
if (h >= max || targetY >= engineHeight
|
||||
|| !DecoratorCore.canReplaceStackTarget(scene, data.get(x, targetY, z), false)) {
|
||||
if (!DecoratorCore.canReplaceStackTarget(scene, data.get(x, targetY, z), false)) {
|
||||
break;
|
||||
}
|
||||
double threshold = ((double) i) / (stack - 1);
|
||||
double threshold = stack == 1 ? 1.0 : ((double) i) / (stack - 1);
|
||||
BlockState block = threshold >= decorator.topThreshold()
|
||||
? decorator.topBlockAt(realX, h, realZ)
|
||||
: decorator.blockAt(realX, h, realZ);
|
||||
|
||||
Reference in new issue
Block a user