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