use of org.joml.Vector3i in project Terasology by MovingBlocks.
the class ChunkViewTest method testLocalToWorld.
@Test
public void testLocalToWorld() {
Chunk chunk = createChunk(1, 0, 1);
chunk.setBlock(new Vector3i(0, 0, 0), solidBlock);
Chunk[] chunks = new Chunk[] { createChunk(0, 0, 0), createChunk(1, 0, 0), createChunk(2, 0, 0), createChunk(0, 0, 1), chunk, createChunk(2, 0, 1), createChunk(0, 0, 2), createChunk(1, 0, 2), createChunk(2, 0, 2) };
ChunkViewCoreImpl chunkView = new ChunkViewCoreImpl(chunks, new BlockRegion(1, 0, 1).expand(1, 0, 1), new Vector3i(1, 1, 1), airBlock);
assertEquals(new Vector3i(Chunks.SIZE_X, Chunks.SIZE_Y, Chunks.SIZE_Z), chunkView.toWorldPos(new Vector3i()));
}
use of org.joml.Vector3i in project Terasology by MovingBlocks.
the class ChunkViewTest method testOffsetChunksWorldView.
@Test
public void testOffsetChunksWorldView() {
Chunk chunk = createChunk(1, 0, 1);
chunk.setBlock(new Vector3i(0, 0, 0), solidBlock);
Chunk[] chunks = new Chunk[] { createChunk(0, 0, 0), createChunk(1, 0, 0), createChunk(2, 0, 0), createChunk(0, 0, 1), chunk, createChunk(2, 0, 1), createChunk(0, 0, 2), createChunk(1, 0, 2), createChunk(2, 0, 2) };
ChunkViewCore chunkView = new ChunkViewCoreImpl(chunks, new BlockRegion(1, 0, 1).expand(1, 0, 1), new Vector3i(1, 0, 1), airBlock);
assertEquals(solidBlock, chunkView.getBlock(0, 0, 0));
}
use of org.joml.Vector3i in project Terasology by MovingBlocks.
the class EntityAwareWorldProviderTest method testBlockEntityPrefabCorrectlyRemovedOnChangeToBlockWithNoPrefab.
@Disabled("Failing due to #2625. TODO: fix to match new behaviour")
@Test
public void testBlockEntityPrefabCorrectlyRemovedOnChangeToBlockWithNoPrefab() {
worldProvider.setBlock(new Vector3i(), blockWithString);
EntityRef entity = worldProvider.getBlockEntityAt(new Vector3i());
worldProvider.setBlock(new Vector3i(), plainBlock);
assertEquals(null, entity.getParentPrefab());
}
use of org.joml.Vector3i in project Terasology by MovingBlocks.
the class EntityAwareWorldProviderTest method testEntityMissingComponentsAddedBeforeCleanUp.
@Test
public void testEntityMissingComponentsAddedBeforeCleanUp() {
worldStub.setBlock(new Vector3i(), blockWithString);
EntityRef entity = worldProvider.getBlockEntityAt(new Vector3i());
entity.removeComponent(StringComponent.class);
LifecycleEventChecker checker = new LifecycleEventChecker(entityManager.getEventSystem(), StringComponent.class);
worldProvider.update(1.0f);
assertEquals(Lists.newArrayList(new EventInfo(OnAddedComponent.newInstance(), entity), new EventInfo(OnActivatedComponent.newInstance(), entity)), checker.receivedEvents);
}
use of org.joml.Vector3i in project Terasology by MovingBlocks.
the class EntityAwareWorldProviderTest method testEntityBecomesTemporaryWhenChangedFromAKeepActiveBlock.
@Test
public void testEntityBecomesTemporaryWhenChangedFromAKeepActiveBlock() {
worldProvider.setBlock(new Vector3i(), keepActiveBlock);
EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i());
worldProvider.setBlock(new Vector3i(), airBlock);
worldProvider.update(1.0f);
assertFalse(blockEntity.isActive());
}
Aggregations