mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-08-27 12:41:43 +00:00
adding mroe of this
This commit is contained in:
@@ -113,12 +113,12 @@ public final class StubPlatform implements IrisPlatform {
|
||||
|
||||
@Override
|
||||
public boolean isAir() {
|
||||
return key.endsWith("air");
|
||||
return blockKey().endsWith("air");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid() {
|
||||
return !isAir();
|
||||
return !isAir() && !isFluid();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,12 +133,16 @@ public final class StubPlatform implements IrisPlatform {
|
||||
|
||||
@Override
|
||||
public boolean isFluid() {
|
||||
return false;
|
||||
String blockKey = blockKey();
|
||||
return blockKey.equals("minecraft:water")
|
||||
|| blockKey.equals("minecraft:lava")
|
||||
|| blockKey.equals("minecraft:bubble_column");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWater() {
|
||||
return false;
|
||||
String blockKey = blockKey();
|
||||
return blockKey.equals("minecraft:water") || blockKey.equals("minecraft:bubble_column");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,11 +167,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
|
||||
@Override
|
||||
public boolean isTreeBlock() {
|
||||
String blockKey = key;
|
||||
int properties = blockKey.indexOf('[');
|
||||
if (properties >= 0) {
|
||||
blockKey = blockKey.substring(0, properties);
|
||||
}
|
||||
String blockKey = blockKey();
|
||||
return blockKey.endsWith("_log")
|
||||
|| blockKey.endsWith("_wood")
|
||||
|| blockKey.endsWith("_stem")
|
||||
@@ -236,6 +236,11 @@ public final class StubPlatform implements IrisPlatform {
|
||||
public Object nativeHandle() {
|
||||
return key;
|
||||
}
|
||||
|
||||
private String blockKey() {
|
||||
int properties = key.indexOf('[');
|
||||
return properties >= 0 ? key.substring(0, properties) : key;
|
||||
}
|
||||
}
|
||||
|
||||
private static PlatformBlockState rotateState(IrisObjectRotation rotation, PlatformBlockState state,
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public final class StubPlatformStateTest {
|
||||
@BeforeClass
|
||||
@@ -41,6 +43,22 @@ public final class StubPlatformStateTest {
|
||||
assertEquals("minecraft:oak_leaves[distance=7,persistent=true]", merged.key());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void classifiesVanillaFluidStates() {
|
||||
PlatformBlockState water = state("minecraft:water[level=0]");
|
||||
PlatformBlockState lava = state("minecraft:lava[level=0]");
|
||||
PlatformBlockState stone = state("minecraft:stone");
|
||||
|
||||
assertTrue(water.isFluid());
|
||||
assertTrue(water.isWater());
|
||||
assertFalse(water.isSolid());
|
||||
assertTrue(lava.isFluid());
|
||||
assertFalse(lava.isWater());
|
||||
assertFalse(lava.isSolid());
|
||||
assertFalse(stone.isFluid());
|
||||
assertTrue(stone.isSolid());
|
||||
}
|
||||
|
||||
private PlatformBlockState state(String key) {
|
||||
return IrisPlatforms.get().registries().block(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user