mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Ceiling vine curtains
- A vine under a sturdy ceiling keeps its authored side faces - Vines below it hold those faces through the vine above - The vine-above check reads the facing before the material key
This commit is contained in:
1 parent
c2eb8b5f42
commit
067fffe066
3 files changed
+40
-4
No files matched your search
+15
@@ -83,6 +83,21 @@ public class ModdedDecoratorHooksTest {
|
||||
assertEquals(EnumSet.of(Direction.NORTH), faces(hunk.get(8, 3, 8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stackedVineCurtainHangsUnderAnOpenCeiling() {
|
||||
Hunk<NativeBlockState> hunk = Hunk.newArrayHunk(16, 8, 16);
|
||||
hunk.set(8, 6, 8, stone());
|
||||
NativeBlockState vine = state(Blocks.VINE, Direction.NORTH);
|
||||
|
||||
for (int y = 5; y >= 3; y--) {
|
||||
hunk.set(8, y, 8, fix(vine, hunk, y));
|
||||
}
|
||||
|
||||
assertEquals(EnumSet.of(Direction.NORTH, Direction.UP), faces(hunk.get(8, 5, 8)));
|
||||
assertEquals(EnumSet.of(Direction.NORTH), faces(hunk.get(8, 4, 8)));
|
||||
assertEquals(EnumSet.of(Direction.NORTH), faces(hunk.get(8, 3, 8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unsupportedAuthoredSideFaceOnALoneVineIsDroppedAndReattached() {
|
||||
NativeBlockState vine = state(Blocks.VINE, Direction.NORTH);
|
||||
|
||||
@@ -484,12 +484,13 @@ final class DecoratorCore {
|
||||
|
||||
private static boolean keepSupportedSides(MultipleFacing data, boolean vine, Hunk<NativeBlockState> hunk,
|
||||
int rX, int rZ, int x, int y, int z, EngineMantle mantle) {
|
||||
boolean ceiling = sturdy(BlockFace.UP, hunk, rX, rZ, x, y, z, mantle);
|
||||
boolean side = false;
|
||||
for (BlockFace f : Faces.SIDES) {
|
||||
if (!data.hasFace(f)) {
|
||||
continue;
|
||||
}
|
||||
if (sturdy(f, hunk, rX, rZ, x, y, z, mantle) || vine && vineAboveCarries(f, hunk, rX, rZ, x, y, z, mantle)) {
|
||||
if (sturdy(f, hunk, rX, rZ, x, y, z, mantle) || vine && (ceiling || vineAboveCarries(f, hunk, rX, rZ, x, y, z, mantle))) {
|
||||
side = true;
|
||||
} else {
|
||||
data.setFace(f, false);
|
||||
@@ -499,7 +500,7 @@ final class DecoratorCore {
|
||||
return false;
|
||||
}
|
||||
if (data.getAllowedFaces().contains(BlockFace.UP)) {
|
||||
data.setFace(BlockFace.UP, sturdy(BlockFace.UP, hunk, rX, rZ, x, y, z, mantle));
|
||||
data.setFace(BlockFace.UP, ceiling);
|
||||
}
|
||||
if (data.hasFace(BlockFace.DOWN) && !sturdy(BlockFace.DOWN, hunk, rX, rZ, x, y, z, mantle)) {
|
||||
data.setFace(BlockFace.DOWN, false);
|
||||
@@ -532,8 +533,8 @@ final class DecoratorCore {
|
||||
}
|
||||
|
||||
private static boolean carries(NativeBlockState state, BlockFace f) {
|
||||
return state != null && VINE.equals(IrisProceduralBlocks.materialKey(state))
|
||||
&& state.nativeHandle() instanceof MultipleFacing facing && facing.hasFace(f);
|
||||
return state != null && state.nativeHandle() instanceof MultipleFacing facing
|
||||
&& VINE.equals(IrisProceduralBlocks.materialKey(state)) && facing.hasFace(f);
|
||||
}
|
||||
|
||||
static boolean canGoOn(NativeBlockState decorator, NativeBlockState surface) {
|
||||
|
||||
@@ -775,6 +775,26 @@ public class DecoratorCoreTest {
|
||||
assertEquals(EnumSet.of(BlockFace.NORTH), faces(output.get(8, 3, 8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stackedVineCurtainHangsUnderAnOpenCeiling() {
|
||||
IrisDecorator decorator = mock(IrisDecorator.class);
|
||||
IrisData data = mock(IrisData.class);
|
||||
NativeBlockState vine = facingState(VINE, VINE_FACES, EnumSet.of(BlockFace.NORTH));
|
||||
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(3);
|
||||
when(decorator.getTopThreshold()).thenReturn(1.0);
|
||||
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(vine);
|
||||
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(vine);
|
||||
Hunk<NativeBlockState> output = Hunk.newArrayHunk(16, 8, 16);
|
||||
output.set(8, 6, 8, sturdyState());
|
||||
|
||||
DecoratorCore.placeStackDown(decorator, 8, 8, 8, 8, 5, 0, output, new RNG(1L), data, 3,
|
||||
new DecoratorCore.PlaceOpts(), null);
|
||||
|
||||
assertEquals(EnumSet.of(BlockFace.NORTH, BlockFace.UP), faces(output.get(8, 5, 8)));
|
||||
assertEquals(EnumSet.of(BlockFace.NORTH), faces(output.get(8, 4, 8)));
|
||||
assertEquals(EnumSet.of(BlockFace.NORTH), faces(output.get(8, 3, 8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unsupportedAuthoredSideFaceOnALoneVineIsDroppedAndReattached() {
|
||||
NativeBlockState vine = facingState(VINE, VINE_FACES, EnumSet.of(BlockFace.NORTH));
|
||||
|
||||
Reference in new issue
Block a user