use of org.terasology.gestalt.assets.ResourceUrn in project Terasology by MovingBlocks.
the class PojoEntityManagerTest method testPrefabPersistedRetainedCorrectly.
@Test
public void testPrefabPersistedRetainedCorrectly() {
PrefabData protoPrefab = new PrefabData();
protoPrefab.setPersisted(false);
prefab = Assets.generateAsset(new ResourceUrn("unittest:nonpersistentPrefab"), protoPrefab, Prefab.class);
EntityRef entity1 = entityManager.create(prefab);
assertFalse(entity1.isPersistent());
}
use of org.terasology.gestalt.assets.ResourceUrn in project Terasology by MovingBlocks.
the class PojoEventSystemTests method testChildEventReceivedByUnfilteredHandler.
@Test
public void testChildEventReceivedByUnfilteredHandler() {
entity.addComponent(new IntegerComponent());
TestEventHandler handler = new TestEventHandler();
eventSystem.registerEvent(new ResourceUrn("test:childEvent"), TestChildEvent.class);
eventSystem.registerEventHandler(handler);
TestChildEvent event = new TestChildEvent();
eventSystem.send(entity, event);
assertEquals(1, handler.unfilteredEvents.size());
}
use of org.terasology.gestalt.assets.ResourceUrn in project Terasology by MovingBlocks.
the class PojoEventSystemTests method testChildEvent.
@Test
public void testChildEvent() {
entity.addComponent(new IntegerComponent());
TestEventHandler handler = new TestEventHandler();
eventSystem.registerEvent(new ResourceUrn("test:childEvent"), TestChildEvent.class);
eventSystem.registerEventHandler(handler);
TestChildEvent event = new TestChildEvent();
eventSystem.send(entity, event);
assertEquals(1, handler.childEventReceived.size());
assertEquals(1, handler.receivedList.size());
}
use of org.terasology.gestalt.assets.ResourceUrn in project Terasology by MovingBlocks.
the class FieldMetadataTest method testOwnsAnnotationCollectionProcessed.
@Test
public void testOwnsAnnotationCollectionProcessed() throws NoSuchMethodException {
ComponentMetadata<org.terasology.engine.entitySystem.metadata.OwnedCollectionComponent> classMetadata = new ComponentMetadata<>(new ResourceUrn("unittest:OwnedCollectionComponent"), org.terasology.engine.entitySystem.metadata.OwnedCollectionComponent.class, factory, copyStrategyLibrary);
ComponentFieldMetadata metadata = classMetadata.getField("items");
assertTrue(metadata.isOwnedReference());
}
use of org.terasology.gestalt.assets.ResourceUrn in project Terasology by MovingBlocks.
the class BetweenChunkPropagationTest method setup.
@BeforeEach
@Override
public void setup() throws Exception {
super.setup();
AssetManager assetManager = CoreRegistry.get(AssetManager.class);
regenRules = new SunlightRegenPropagationRules();
blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager, true);
CoreRegistry.put(BlockManager.class, blockManager);
extraDataManager = new ExtraBlockDataManager();
BlockFamilyDefinitionData solidData = new BlockFamilyDefinitionData();
solidData.getBaseSection().setDisplayName("Stone");
solidData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
solidData.getBaseSection().setTranslucent(false);
solidData.setBlockFamily(SymmetricFamily.class);
assetManager.loadAsset(new ResourceUrn("engine:stone"), solidData, BlockFamilyDefinition.class);
solid = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:stone")));
regenWorldView = new SunlightRegenWorldView(provider);
lightWorldView = new SunlightWorldView(provider);
lightRules = new SunlightPropagationRules(regenWorldView);
sunlightPropagator = new StandardBatchPropagator(lightRules, lightWorldView);
propagator = new SunlightRegenBatchPropagator(regenRules, regenWorldView, sunlightPropagator, lightWorldView);
}
Aggregations