use of org.terasology.unittest.stubs.ForceBlockActiveComponent in project Terasology by MovingBlocks.
the class EntityAwareWorldProviderTest method testEntityNotRemovedIfForceBlockActiveComponentAdded.
@Test
public void testEntityNotRemovedIfForceBlockActiveComponentAdded() {
EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i());
blockEntity.addComponent(new ForceBlockActiveComponent());
worldProvider.update(1.0f);
assertTrue(blockEntity.exists());
assertTrue(blockEntity.isActive());
}
use of org.terasology.unittest.stubs.ForceBlockActiveComponent in project Terasology by MovingBlocks.
the class EntityAwareWorldProviderTest method testEntityBecomesTemporaryIfForceBlockActiveComponentRemoved.
@Test
public void testEntityBecomesTemporaryIfForceBlockActiveComponentRemoved() {
EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i());
blockEntity.addComponent(new ForceBlockActiveComponent());
worldProvider.update(1.0f);
blockEntity.removeComponent(ForceBlockActiveComponent.class);
worldProvider.update(1.0f);
assertFalse(blockEntity.exists());
assertFalse(blockEntity.isActive());
}
use of org.terasology.unittest.stubs.ForceBlockActiveComponent in project Terasology by MovingBlocks.
the class EntityAwareWorldProviderTest method testAllComponentsNotMarkedAsRetainedRemovedOnBlockChange.
@Test
public void testAllComponentsNotMarkedAsRetainedRemovedOnBlockChange() {
worldStub.setBlock(new Vector3i(), blockWithString);
EntityRef entity = worldProvider.getBlockEntityAt(new Vector3i());
entity.addComponent(new ForceBlockActiveComponent());
entity.addComponent(new RetainedOnBlockChangeComponent(2));
worldProvider.setBlock(new Vector3i(), airBlock);
assertTrue(entity.hasComponent(RetainedOnBlockChangeComponent.class));
assertFalse(entity.hasComponent(ForceBlockActiveComponent.class));
}
Aggregations