@Before public void setup() { ContextImpl context = new ContextImpl(); context.put(ModuleManager.class, moduleManager); context.put(NetworkSystem.class, mock(NetworkSystem.class)); context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus()); CoreRegistry.setContext(context); EntitySystemSetupUtil.addReflectionBasedLibraries(context); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); entityManager = context.get(EngineEntityManager.class); }
@Before public void setup() { ContextImpl context = new ContextImpl(); CoreRegistry.setContext(context); // Needed only as long as #1536 is unresolved context.put(Config.class, new Config(new MockContext())); blockManager = Mockito.mock(BlockManager.class); Block air = blockManager.getBlock(BlockManager.AIR_ID); biomeManager = Mockito.mock(BiomeManager.class); extraDataManager = new ExtraBlockDataManager(); Mockito.when(blockManager.getBlock(Matchers.<BlockUri>any())).thenReturn(air); Mockito.when(blockManager.getBlock(Matchers.<String>any())).thenReturn(air); context.put(BlockManager.class, blockManager); }
@Before public void setup() throws Exception { ContextImpl context = new ContextImpl(); context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus()); CoreRegistry.setContext(context); ModuleManager moduleManager = ModuleManagerFactory.create(); context.put(ModuleManager.class, moduleManager); EntitySystemSetupUtil.addReflectionBasedLibraries(context); ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager(); assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs"); ComponentLibrary componentLibrary = context.get(ComponentLibrary.class); TypeSerializationLibrary typeSerializationLibrary = context.get(TypeSerializationLibrary.class); PrefabFormat prefabFormat = new PrefabFormat(componentLibrary, typeSerializationLibrary); assetTypeManager.registerCoreFormat(Prefab.class, prefabFormat); assetTypeManager.switchEnvironment(moduleManager.getEnvironment()); context.put(AssetManager.class, assetTypeManager.getAssetManager()); NetworkSystem networkSystem = mock(NetworkSystem.class); when(networkSystem.getMode()).thenReturn(NetworkMode.NONE); context.put(NetworkSystem.class, networkSystem); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); prefabManager = new PojoPrefabManager(context); }
@Before public void setup() throws Exception { ContextImpl context = new ContextImpl(); CoreRegistry.setContext(context); ModuleManager moduleManager = ModuleManagerFactory.create(); ReflectFactory reflectFactory = new ReflectionReflectFactory(); CopyStrategyLibrary copyStrategyLibrary = new CopyStrategyLibrary(reflectFactory); TypeSerializationLibrary lib = new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary); lib.add(Vector3f.class, new Vector3fTypeHandler()); lib.add(Quat4f.class, new Quat4fTypeHandler()); entitySystemLibrary = new EntitySystemLibrary(context, lib); componentLibrary = entitySystemLibrary.getComponentLibrary(); ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager(); assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs"); assetTypeManager.switchEnvironment(moduleManager.getEnvironment()); context.put(AssetManager.class, assetTypeManager.getAssetManager()); prefabManager = new PojoPrefabManager(context); }