Search in sources :

Example 1 with Vector3fTypeHandler

use of org.terasology.engine.persistence.typeHandling.mathTypes.Vector3fTypeHandler in project Terasology by MovingBlocks.

the class TypeHandlerLibraryImpl method populateWithDefaultHandlers.

private static void populateWithDefaultHandlers(TypeHandlerLibrary serializationLibrary) {
    // Current Supported
    serializationLibrary.addTypeHandlerFactory(new AssetTypeHandlerFactory());
    serializationLibrary.addTypeHandler(Name.class, new NameTypeHandler());
    serializationLibrary.addTypeHandler(TextureRegion.class, new TextureRegionTypeHandler());
    serializationLibrary.addTypeHandler(UITextureRegion.class, new UITextureRegionTypeHandler());
    serializationLibrary.addTypeHandler(ChunkMesh.class, new ChunkMeshTypeHandler());
    serializationLibrary.addTypeHandlerFactory(new TextureRegionAssetTypeHandlerFactory());
    serializationLibrary.addTypeHandler(Color.class, new ColorTypeHandler());
    serializationLibrary.addTypeHandler(Colorc.class, new ColorcTypeHandler());
    serializationLibrary.addTypeHandler(Vector4f.class, new Vector4fTypeHandler());
    serializationLibrary.addTypeHandler(Vector4fc.class, new Vector4fcTypeHandler());
    serializationLibrary.addTypeHandler(Vector3f.class, new Vector3fTypeHandler());
    serializationLibrary.addTypeHandler(Vector3fc.class, new Vector3fcTypeHandler());
    serializationLibrary.addTypeHandler(Vector2f.class, new Vector2fTypeHandler());
    serializationLibrary.addTypeHandler(Vector2fc.class, new Vector2fcTypeHandler());
    serializationLibrary.addTypeHandler(Vector3i.class, new Vector3iTypeHandler());
    serializationLibrary.addTypeHandler(Vector3ic.class, new Vector3icTypeHandler());
    serializationLibrary.addTypeHandler(Vector2i.class, new Vector2iTypeHandler());
    serializationLibrary.addTypeHandler(Vector2ic.class, new Vector2icTypeHandler());
    serializationLibrary.addTypeHandler(Vector4i.class, new Vector4iTypeHandler());
    serializationLibrary.addTypeHandler(Vector4ic.class, new Vector4icTypeHandler());
    serializationLibrary.addTypeHandler(Rectanglei.class, new RectangleiTypeHandler());
    serializationLibrary.addTypeHandler(Rectanglef.class, new RectanglefTypeHandler());
    serializationLibrary.addTypeHandler(AABBi.class, new AABBiTypeHandler());
    serializationLibrary.addTypeHandler(AABBf.class, new AABBfTypeHandler());
    serializationLibrary.addTypeHandler(BlockRegion.class, new BlockRegionTypeHandler());
    serializationLibrary.addTypeHandler(BlockArea.class, new BlockAreaTypeHandler());
    serializationLibrary.addTypeHandler(BlockAreac.class, new BlockAreacTypeHandler());
    serializationLibrary.addTypeHandler(Quaternionf.class, new QuaternionfTypeHandler());
    serializationLibrary.addTypeHandler(Quaternionfc.class, new QuaternionfcTypeHandler());
    serializationLibrary.addTypeHandler(IntegerRange.class, new IntegerRangeHandler());
}
Also used : QuaternionfTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.QuaternionfTypeHandler) TextureRegionAssetTypeHandlerFactory(org.terasology.engine.persistence.typeHandling.extensionTypes.factories.TextureRegionAssetTypeHandlerFactory) RectangleiTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.RectangleiTypeHandler) AABBfTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.AABBfTypeHandler) BlockAreacTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.BlockAreacTypeHandler) RectanglefTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.RectanglefTypeHandler) Vector3iTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector3iTypeHandler) QuaternionfcTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.QuaternionfcTypeHandler) Vector4fcTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector4fcTypeHandler) Vector2iTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector2iTypeHandler) Vector3fcTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector3fcTypeHandler) NameTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.NameTypeHandler) ColorcTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.ColorcTypeHandler) Vector2fcTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector2fcTypeHandler) Vector2icTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector2icTypeHandler) Vector3icTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector3icTypeHandler) Vector4icTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector4icTypeHandler) BlockRegionTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.BlockRegionTypeHandler) IntegerRangeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.IntegerRangeHandler) AssetTypeHandlerFactory(org.terasology.engine.persistence.typeHandling.extensionTypes.factories.AssetTypeHandlerFactory) TextureRegionAssetTypeHandlerFactory(org.terasology.engine.persistence.typeHandling.extensionTypes.factories.TextureRegionAssetTypeHandlerFactory) ChunkMeshTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.ChunkMeshTypeHandler) Vector3fTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector3fTypeHandler) ColorTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.ColorTypeHandler) Vector4fTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector4fTypeHandler) UITextureRegionTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.UITextureRegionTypeHandler) Vector4iTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector4iTypeHandler) AABBiTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.AABBiTypeHandler) BlockAreaTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.BlockAreaTypeHandler) UITextureRegionTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.UITextureRegionTypeHandler) TextureRegionTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.TextureRegionTypeHandler) Vector2fTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector2fTypeHandler)

Example 2 with Vector3fTypeHandler

use of org.terasology.engine.persistence.typeHandling.mathTypes.Vector3fTypeHandler in project Terasology by MovingBlocks.

the class ComponentSerializerTest method setup.

@BeforeEach
public void setup() {
    context = new ContextImpl();
    context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus());
    context.put(ModuleManager.class, moduleManager);
    CoreRegistry.setContext(context);
    Reflections reflections = new Reflections(getClass().getClassLoader());
    TypeHandlerLibrary serializationLibrary = new TypeHandlerLibraryImpl(reflections);
    serializationLibrary.addTypeHandler(Vector3f.class, new Vector3fTypeHandler());
    serializationLibrary.addTypeHandler(Quaternionf.class, new QuaternionfTypeHandler());
    NetworkSystem networkSystem = mock(NetworkSystem.class);
    when(networkSystem.getMode()).thenReturn(NetworkMode.NONE);
    context.put(NetworkSystem.class, networkSystem);
    EntitySystemSetupUtil.addReflectionBasedLibraries(context);
    EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
    EngineEntityManager entityManager = context.get(EngineEntityManager.class);
    entityManager.getComponentLibrary().register(new ResourceUrn("test", "gettersetter"), GetterSetterComponent.class);
    entityManager.getComponentLibrary().register(new ResourceUrn("test", "string"), StringComponent.class);
    entityManager.getComponentLibrary().register(new ResourceUrn("test", "integer"), IntegerComponent.class);
    ComponentLibrary componentLibrary = entityManager.getComponentLibrary();
    componentSerializer = new ComponentSerializer(componentLibrary, serializationLibrary);
}
Also used : EngineEntityManager(org.terasology.engine.entitySystem.entity.internal.EngineEntityManager) QuaternionfTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.QuaternionfTypeHandler) Vector3fTypeHandler(org.terasology.engine.persistence.typeHandling.mathTypes.Vector3fTypeHandler) TypeHandlerLibrary(org.terasology.persistence.typeHandling.TypeHandlerLibrary) NetworkSystem(org.terasology.engine.network.NetworkSystem) ComponentLibrary(org.terasology.engine.entitySystem.metadata.ComponentLibrary) RecordAndReplayCurrentStatus(org.terasology.engine.recording.RecordAndReplayCurrentStatus) ContextImpl(org.terasology.engine.context.internal.ContextImpl) TypeHandlerLibraryImpl(org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) ComponentSerializer(org.terasology.engine.persistence.serializers.ComponentSerializer) Reflections(org.reflections.Reflections) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

QuaternionfTypeHandler (org.terasology.engine.persistence.typeHandling.mathTypes.QuaternionfTypeHandler)2 Vector3fTypeHandler (org.terasology.engine.persistence.typeHandling.mathTypes.Vector3fTypeHandler)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Reflections (org.reflections.Reflections)1 ContextImpl (org.terasology.engine.context.internal.ContextImpl)1 EngineEntityManager (org.terasology.engine.entitySystem.entity.internal.EngineEntityManager)1 ComponentLibrary (org.terasology.engine.entitySystem.metadata.ComponentLibrary)1 NetworkSystem (org.terasology.engine.network.NetworkSystem)1 ComponentSerializer (org.terasology.engine.persistence.serializers.ComponentSerializer)1 TypeHandlerLibraryImpl (org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl)1 ChunkMeshTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.ChunkMeshTypeHandler)1 ColorTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.ColorTypeHandler)1 ColorcTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.ColorcTypeHandler)1 NameTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.NameTypeHandler)1 TextureRegionTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.TextureRegionTypeHandler)1 UITextureRegionTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.UITextureRegionTypeHandler)1 AssetTypeHandlerFactory (org.terasology.engine.persistence.typeHandling.extensionTypes.factories.AssetTypeHandlerFactory)1 TextureRegionAssetTypeHandlerFactory (org.terasology.engine.persistence.typeHandling.extensionTypes.factories.TextureRegionAssetTypeHandlerFactory)1 AABBfTypeHandler (org.terasology.engine.persistence.typeHandling.mathTypes.AABBfTypeHandler)1 AABBiTypeHandler (org.terasology.engine.persistence.typeHandling.mathTypes.AABBiTypeHandler)1