Skip to content

Commit

Permalink
Fix compiler errors after the gestalt-module merge
Browse files Browse the repository at this point in the history
  • Loading branch information
msteiger committed Jul 5, 2014
1 parent 028bfcb commit 3b6935a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/terasology/cities/BlockTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public Block apply(BlockTypes input, Set<Side> side) {
}

BlockUri familyUri = family.getURI().getFamilyUri();
String identifier = family.getURI().getIdentifier();
String identifier = family.getURI().getIdentifier().toString();
byte flags = SideBitFlag.getSides(side);
BlockUri blockUri = new BlockUri(familyUri, identifier + flags);
Block block = family.getBlockFor(blockUri);
Expand Down
46 changes: 22 additions & 24 deletions src/test/java/org/terasology/cities/swing/SwingEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import org.terasology.engine.TerasologyEngine;
import org.terasology.engine.bootstrap.EntitySystemBuilder;
import org.terasology.engine.module.ModuleManager;
import org.terasology.engine.module.ModuleManagerImpl;
import org.terasology.engine.module.ModuleSecurityManager;
import org.terasology.engine.paths.PathManager;
import org.terasology.entitySystem.Component;
import org.terasology.entitySystem.entity.EntityManager;
Expand All @@ -49,6 +47,7 @@
import org.terasology.entitySystem.prefab.Prefab;
import org.terasology.entitySystem.prefab.PrefabData;
import org.terasology.entitySystem.prefab.internal.PojoPrefab;
import org.terasology.module.ModuleEnvironment;
import org.terasology.network.NetworkSystem;
import org.terasology.reflection.reflect.ReflectionReflectFactory;
import org.terasology.registry.CoreRegistry;
Expand All @@ -74,17 +73,17 @@
final class SwingEnvironment {

private static final Logger logger = LoggerFactory.getLogger(SwingEnvironment.class);

private SwingEnvironment() {
// empty
}

/**
* Default setup order
* @throws IOException
*/
static void setup() throws IOException {

PathManager.getInstance().useDefaultHomePath();

setupConfig();
Expand All @@ -107,10 +106,11 @@ static void setup() throws IOException {
private static void setupEntitySystem() {
ModuleManager moduleManager = CoreRegistry.get(ModuleManager.class);
NetworkSystem networkSystem = CoreRegistry.get(NetworkSystem.class);

EntitySystemBuilder builder = new EntitySystemBuilder();
EngineEntityManager engineEntityManager = builder.build(moduleManager, networkSystem, new ReflectionReflectFactory());

ModuleEnvironment env = moduleManager.getEnvironment();
EngineEntityManager engineEntityManager = builder.build(env, networkSystem, new ReflectionReflectFactory());
CoreRegistry.put(EngineEntityManager.class, engineEntityManager);
}

Expand All @@ -125,27 +125,25 @@ private static void setupBlockManager() {

private static void setupEmptyAssetManager() {
ModuleManager moduleManager = CoreRegistry.get(ModuleManager.class);
AssetManager assetManager = new AssetManager(moduleManager);


ModuleEnvironment env = moduleManager.getEnvironment();
AssetManager assetManager = new AssetManager(env);

// mock an empy asset factory for all asset types
for (AssetType type : AssetType.values()) {
assetManager.setAssetFactory(type, mock(AssetFactory.class));
}

CoreRegistry.put(AssetManager.class, assetManager);
}

private static void setupAssetManager() {
setupEmptyAssetManager();

AssetManager assetManager = CoreRegistry.get(AssetManager.class);
AudioManager audioManager = CoreRegistry.get(AudioManager.class);
AssetType.registerAssetTypes(assetManager);

CodeSource tsCodeSource = TerasologyEngine.class.getProtectionDomain().getCodeSource();
assetManager.addAssetSource(new ClasspathSource(TerasologyConstants.ENGINE_MODULE, tsCodeSource,
TerasologyConstants.ASSETS_SUBDIRECTORY, TerasologyConstants.OVERRIDES_SUBDIRECTORY, TerasologyConstants.DELTAS_SUBDIRECTORY));

assetManager.setAssetFactory(AssetType.PREFAB, new AssetFactory<PrefabData, Prefab>() {

@Override
Expand All @@ -170,7 +168,7 @@ public UISkin buildAsset(AssetUri uri, UISkinData data) {

assetManager.setAssetFactory(AssetType.SOUND, audioManager.getStaticSoundFactory());
assetManager.setAssetFactory(AssetType.MUSIC, audioManager.getStreamingSoundFactory());
}
}

private static void setupAudio() {
NullAudioManager audioManager = new NullAudioManager();
Expand All @@ -185,12 +183,12 @@ private static void setupConfig() {
logger.error("Failed to load config", e);
config = new Config();
}

CoreRegistry.put(Config.class, config);
}

private static void setupModuleManager() {
ModuleManagerImpl moduleManager = new ModuleManagerImpl(new ModuleSecurityManager(), true);
ModuleManager moduleManager = new ModuleManager();
CoreRegistry.put(ModuleManager.class, moduleManager);
}

Expand All @@ -204,22 +202,22 @@ private static void setupWorldGen() {
EntityManager entityManager = CoreRegistry.get(EntityManager.class);
EntityRef worldEntity = entityManager.create();
worldEntity.addComponent(new WorldComponent());

SimpleUri uri = new SimpleUri("cities:city");
CityWorldGenerator worldGen = new CityWorldGenerator(null);

Config config = CoreRegistry.get(Config.class);

WorldConfigurator configurator = worldGen.getConfigurator().get();
for (Entry<String, Component> entry : configurator.getProperties().entrySet()) {
Component comp = config.getModuleConfig(uri, entry.getKey(), entry.getValue().getClass());

if (comp == null) {
comp = entry.getValue();
}

worldEntity.addComponent(comp);
}
}
}

}
Expand Down

0 comments on commit 3b6935a

Please sign in to comment.