public void update() { super.update(); boolean enableDebug = Config.getInstance().isDebug(); debugLine1.setVisible(enableDebug); debugLine2.setVisible(enableDebug); debugLine3.setVisible(enableDebug); debugLine4.setVisible(enableDebug); if (enableDebug) { CameraTargetSystem cameraTarget = CoreRegistry.get(CameraTargetSystem.class); double memoryUsage = ((double) Runtime.getRuntime().totalMemory() - (double) Runtime.getRuntime().freeMemory()) / 1048576.0; Timer timer = CoreRegistry.get(Timer.class); debugLine1.setText( String.format( "fps: %.2f, mem usage: %.2f MB, total mem: %.2f, max mem: %.2f", timer.getFps(), memoryUsage, Runtime.getRuntime().totalMemory() / 1048576.0, Runtime.getRuntime().maxMemory() / 1048576.0)); debugLine2.setText(String.format("%s", cameraTarget.toString())); debugLine3.setText(String.format("%s", CoreRegistry.get(WorldRenderer.class))); debugLine4.setText( String.format( "total vus: %s | active threads: %s", ChunkTessellator.getVertexArrayUpdateCount(), CoreRegistry.get(GameEngine.class).getActiveTaskCount())); } }
private void updateHealthBar(int currentHealth, int maxHealth) { float healthRatio = (float) currentHealth / maxHealth; // Show/Hide hearts relatively to the available health points of the player for (int i = 0; i < 10; i++) { if (i < healthRatio * 10f) _hearts[i].setVisible(true); else _hearts[i].setVisible(false); // Show Poisoned Status with Green Hearts: PoisonedComponent poisoned = CoreRegistry.get(LocalPlayer.class).getEntity().getComponent(PoisonedComponent.class); entityManager = CoreRegistry.get(EntityManager.class); for (EntityRef entity : entityManager.iteratorEntities(PoisonedComponent.class)) { if (poisoned.poisonDuration >= 1) _hearts[i].setTextureOrigin(new Vector2f(106f, 0.0f)); else _hearts[i].setTextureOrigin(new Vector2f(52f, 0.0f)); } for (EntityRef entity : entityManager.iteratorEntities(CuredComponent.class)) { // For fixing the Green > Red hearts when cured: CuredComponent cured = CoreRegistry.get(LocalPlayer.class).getEntity().getComponent(CuredComponent.class); entityManager = CoreRegistry.get(EntityManager.class); if (cured.cureDuration >= 1) _hearts[i].setTextureOrigin(new Vector2f(52f, 0.0f)); else _hearts[i].setTextureOrigin(new Vector2f(52f, 0.0f)); } } }
/** * Ugly way to retrieve a name from a prefab * * @return a ":" seperated string, with name and flavor text. */ public static String getName() { PrefabManager prefMan = CoreRegistry.get(PrefabManager.class); Prefab prefab = prefMan.getPrefab("miniion:nameslist"); EntityRef namelist = CoreRegistry.get(EntityManager.class).create(prefab); namelist.hasComponent(namesComponent.class); namesComponent namecomp = namelist.getComponent(namesComponent.class); Random rand = new Random(); return namecomp.namelist.get(rand.nextInt(namecomp.namelist.size())); }
@Override public void applyParameters(ShaderProgram program) { super.applyParameters(program); DefaultRenderingProcess.FBO sceneOpaque = DefaultRenderingProcess.getInstance().getFBO("sceneOpaque"); int texId = 0; GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindTexture(); program.setInt("texSceneOpaque", texId++); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindDepthTexture(); program.setInt("texSceneOpaqueDepth", texId++); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneOpaque.bindNormalsTexture(); program.setInt("texSceneOpaqueNormals", texId++); DefaultRenderingProcess.FBO sceneTransparent = DefaultRenderingProcess.getInstance().getFBO("sceneTransparent"); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneTransparent.bindTexture(); program.setInt("texSceneTransparent", texId++); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneTransparent.bindDepthTexture(); program.setInt("texSceneTransparentDepth", texId++); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sceneTransparent.bindNormalsTexture(); program.setInt("texSceneTransparentNormals", texId++); if (CoreRegistry.get(Config.class).getRendering().isSsao()) { DefaultRenderingProcess.FBO ssao = DefaultRenderingProcess.getInstance().getFBO("ssaoBlurred1"); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); ssao.bindTexture(); program.setInt("texSsao", texId++); } if (CoreRegistry.get(Config.class).getRendering().isOutline()) { DefaultRenderingProcess.FBO sobel = DefaultRenderingProcess.getInstance().getFBO("sobel"); GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId); sobel.bindTexture(); program.setInt("texEdges", texId++); program.setFloat("outlineDepthThreshold", (Float) outlineDepthThreshold.getValue()); program.setFloat("outlineThickness", (Float) outlineThickness.getValue()); } program.setFloat("shoreStart", (Float) shoreStart.getValue()); program.setFloat("shoreEnd", (Float) shoreEnd.getValue()); }
/** creates a zonelist component used to save all zones (persist) */ private static void createZoneList() { zonelist = CoreRegistry.get(EntityManager.class).create(); ZoneListComponent zonecomp = new ZoneListComponent(); zonelist.addComponent(zonecomp); zonelist.setPersisted(true); zonelist.saveComponent(zonecomp); }
/** order the minions by id and return the previous one, or the first if none were active! */ public static void getPreviousMinion(boolean deleteactive) { EntityManager entman = CoreRegistry.get(EntityManager.class); List<Integer> sortedlist = new ArrayList<Integer>(); for (EntityRef minion : entman.iteratorEntities(MinionComponent.class)) { if (!minion.getComponent(MinionComponent.class).dying) { sortedlist.add(minion.getId()); } } if (sortedlist.size() == 0) { return; } else if (deleteactive && sortedlist.size() == 1) { activeminion = null; return; } Collections.sort(sortedlist); int index = 0; if (activeminion != null) { index = sortedlist.indexOf(activeminion.getId()); } if (index == 0) { index = sortedlist.size() - 1; } else { index--; } index = sortedlist.get(index); for (EntityRef minion : entman.iteratorEntities(MinionComponent.class)) { if (minion.getId() == index) { setActiveMinion(minion); } } }
void update( EntityRef localPlayer, float delta, EntityRef target, Vector3i targetBlockPos, Vector3f hitPosition, Vector3f hitNormal) { boolean posInput = positiveInput.getState() == ButtonState.DOWN; boolean negInput = negativeInput.getState() == ButtonState.DOWN; float targetValue = 0; if (!CoreRegistry.get(GUIManager.class).isConsumingInput()) { if (posInput) { targetValue += 1.0f; } if (negInput) { targetValue -= 1.0f; } } // TODO: Interpolate, based on some settings (immediate, linear, lerp?) float newValue = targetValue; if (sendEventMode.shouldSendEvent(value, newValue)) { event.prepare(id, newValue, delta); event.setTarget(target, targetBlockPos, hitPosition, hitNormal); localPlayer.send(event); sendEventToSubscribers(delta, target); } value = newValue; }
public void updateChunks() { ArrayList<Chunk> chunks = CoreRegistry.get(WorldRenderer.class).getChunksInProximity(); HashSet<RigidBody> newBodies = new HashSet<RigidBody>(); for (int i = 0; i < 32 && i < chunks.size(); i++) { final Chunk chunk = chunks.get(i); if (chunk != null) { chunk.updateRigidBody(); RigidBody c = chunk.getRigidBody(); if (c != null) { newBodies.add(c); if (!_chunks.contains(c)) { _discreteDynamicsWorld.addRigidBody(c); } } } } for (RigidBody body : _chunks) { if (!newBodies.contains(body)) { _discreteDynamicsWorld.removeRigidBody(body); } } _chunks = newBodies; }
@Override public void open() { toolbar.setEntity(CoreRegistry.get(LocalPlayer.class).getEntity(), 0, 8); layout(); super.open(); }
public void renderTransparent() { for (EntityRef entity : entityManager.iteratorEntities(MiniaturizerComponent.class)) { MiniaturizerComponent min = entity.getComponent(MiniaturizerComponent.class); min.blockGrid.render(); if (min.chunkMesh == null || min.renderPosition == null) continue; glPushMatrix(); Vector3f cameraPosition = CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition(); GL11.glTranslated( min.renderPosition.x - cameraPosition.x, min.renderPosition.y - cameraPosition.y, min.renderPosition.z - cameraPosition.z); glScalef( MiniaturizerComponent.SCALE, MiniaturizerComponent.SCALE, MiniaturizerComponent.SCALE); glRotatef(min.orientation, 0, 1, 0); ShaderManager.getInstance().enableShader("chunk"); ShaderManager.getInstance() .getShaderProgram("chunk") .setFloat("blockScale", MiniaturizerComponent.SCALE); min.chunkMesh.render(ChunkMesh.RENDER_PHASE.OPAQUE); min.chunkMesh.render(ChunkMesh.RENDER_PHASE.BILLBOARD_AND_TRANSLUCENT); min.chunkMesh.render(ChunkMesh.RENDER_PHASE.WATER_AND_ICE); glPopMatrix(); } }
public void applyParameters(ShaderProgram program) { LocalPlayer localPlayer = CoreRegistry.get(LocalPlayer.class); GL13.glActiveTexture(GL13.GL_TEXTURE0); glBindTexture(GL11.GL_TEXTURE_2D, terrainTex.getId()); if (localPlayer != null) program.setInt("carryingTorch", localPlayer.isCarryingTorch() ? 1 : 0); }
public BulletPhysicsRenderer(WorldRenderer parent) { _broadphase = new DbvtBroadphase(); _defaultCollisionConfiguration = new DefaultCollisionConfiguration(); _dispatcher = new CollisionDispatcher(_defaultCollisionConfiguration); _sequentialImpulseConstraintSolver = new SequentialImpulseConstraintSolver(); _discreteDynamicsWorld = new DiscreteDynamicsWorld( _dispatcher, _broadphase, _sequentialImpulseConstraintSolver, _defaultCollisionConfiguration); _discreteDynamicsWorld.setGravity(new Vector3f(0f, -10f, 0f)); _parent = parent; _blockItemFactory = new BlockItemFactory( CoreRegistry.get(EntityManager.class), CoreRegistry.get(PrefabManager.class)); _timer = CoreRegistry.get(Timer.class); }
@ReceiveEvent(components = LocalPlayerComponent.class) public void onSelectedItemChanged(ChangedComponentEvent event, EntityRef entity) { for (UIItemCell cell : toolbar.getCells()) { cell.setSelectionRectangleEnable(false); } LocalPlayer localPlayer = CoreRegistry.get(LocalPlayer.class); LocalPlayerComponent localPlayerComp = localPlayer.getEntity().getComponent(LocalPlayerComponent.class); toolbar.getCells().get(localPlayerComp.selectedTool).setSelectionRectangleEnable(true); }
public void refresh() { // container.fillInventoryCells(this); uiminionlist.removeAll(); EntityManager entMan = CoreRegistry.get(EntityManager.class); for (EntityRef minion : entMan.iteratorEntities(MinionComponent.class)) { UIListItem listitem = new UIListItem(minion.getComponent(MinionComponent.class).name, minion); listitem.setTextColor(Color.black); listitem.addClickListener(minionistener); uiminionlist.addItem(listitem); } }
// TODO: This won't work in multiplayer public float distanceToPlayer() { Transform t = new Transform(); getMotionState().getWorldTransform(t); Matrix4f tMatrix = new Matrix4f(); t.getMatrix(tMatrix); Vector3f blockPlayer = new Vector3f(); tMatrix.get(blockPlayer); blockPlayer.sub(new Vector3f(CoreRegistry.get(LocalPlayer.class).getPosition())); return blockPlayer.length(); }
public void update(float delta) { for (EntityRef entity : entityManager.iteratorEntities( SimpleAIComponent.class, CharacterMovementComponent.class, LocationComponent.class)) { LocationComponent location = entity.getComponent(LocationComponent.class); SimpleAIComponent ai = entity.getComponent(SimpleAIComponent.class); CharacterMovementComponent moveComp = entity.getComponent(CharacterMovementComponent.class); Vector3f worldPos = location.getWorldPosition(); moveComp.getDrive().set(0, 0, 0); // TODO: shouldn't use local player, need some way to find nearest player LocalPlayer localPlayer = CoreRegistry.get(LocalPlayer.class); if (localPlayer != null) { Vector3f dist = new Vector3f(worldPos); dist.sub(localPlayer.getPosition()); double distanceToPlayer = dist.lengthSquared(); if (distanceToPlayer > 6 && distanceToPlayer < 16) { // Head to player ai.movementTarget.set(localPlayer.getPosition()); ai.followingPlayer = true; entity.saveComponent(ai); } else { // Random walk if (Terasology.getInstance().getTimeInMs() - ai.lastChangeOfDirectionAt > 12000 || ai.followingPlayer) { ai.movementTarget.set( worldPos.x + random.randomFloat() * 500, worldPos.y, worldPos.z + random.randomFloat() * 500); ai.lastChangeOfDirectionAt = Terasology.getInstance().getTimeInMs(); ai.followingPlayer = false; entity.saveComponent(ai); } } Vector3f targetDirection = new Vector3f(); targetDirection.sub(ai.movementTarget, worldPos); targetDirection.normalize(); moveComp.setDrive(targetDirection); float yaw = (float) Math.atan2(targetDirection.x, targetDirection.z); AxisAngle4f axisAngle = new AxisAngle4f(0, 1, 0, yaw); location.getLocalRotation().set(axisAngle); entity.saveComponent(moveComp); entity.saveComponent(location); } } }
@Override public void initialise() { ModIcons.loadIcons(); guiManager = CoreRegistry.get(GUIManager.class); blockItemFactory = new BlockItemFactory(entityManager); // experimental popup menu for the minion command tool guiManager.registerWindow("activeminiion", UIActiveMinion.class); // ui to create summonable cards guiManager.registerWindow("cardbook", UICardBook.class); // ui to manage summoned minions, selecting one sets it active! guiManager.registerWindow("oreobook", UIScreenBookOreo.class); // ui to manage zones guiManager.registerWindow("zonebook", UIZoneBook.class); createZoneList(); initRecipes(); }
@Override public void initialise() { this.entityManager = CoreRegistry.get(EntityManager.class); for (EntityRef blockComp : entityManager.iteratorEntities(BlockComponent.class)) { BlockComponent comp = blockComp.getComponent(BlockComponent.class); blockComponentLookup.put(new Vector3i(comp.getPosition()), blockComp); } for (EntityRef entity : entityManager.iteratorEntities(BlockComponent.class)) { BlockComponent blockComp = entity.getComponent(BlockComponent.class); if (blockComp.temporary) { HealthComponent health = entity.getComponent(HealthComponent.class); if (health == null || health.currentHealth == health.maxHealth || health.currentHealth == 0) { entity.destroy(); } } } }
private boolean checkSingleZone() { WorldProvider worldprovider = CoreRegistry.get(WorldProvider.class); Block block = worldprovider.getBlock(MinionSystem.getNewZone().getStartPosition()); if (block.getURI().getFamily().matches("minionbench")) { MinionSystem.getNewZone().zonetype = ZoneType.Work; if (MinionSystem.getWorkZoneList() == null) { txtzonename.setText("Workzone0"); } else { txtzonename.setText("Workzone" + MinionSystem.getWorkZoneList().size()); } lblzonetype.setText("ZoneType : Workzone"); newzonefound = true; } else if (block.getURI().getFamily().matches("chest")) { MinionSystem.getNewZone().zonetype = ZoneType.Storage; if (MinionSystem.getWorkZoneList() == null) { txtzonename.setText("Storage0"); } else { txtzonename.setText("Storage" + MinionSystem.getWorkZoneList().size()); } lblzonetype.setText("ZoneType : Storage"); newzonefound = true; } return newzonefound; }
/** Init. the HUD. */ public UIScreenHUD() { maximize(); _hearts = new UIImage[10]; // Create hearts for (int i = 0; i < 10; i++) { _hearts[i] = new UIImage(AssetManager.loadTexture("engine:icons")); _hearts[i].setVisible(true); _hearts[i].setTextureSize(new Vector2f(9f, 9f)); _hearts[i].setTextureOrigin(new Vector2f(52f, 0.0f)); // 106f for poison _hearts[i].setSize(new Vector2f(18f, 18f)); _hearts[i].setVerticalAlign(EVerticalAlign.BOTTOM); _hearts[i].setHorizontalAlign(EHorizontalAlign.CENTER); _hearts[i].setPosition(new Vector2f(18f * i - 212f, -52f)); addDisplayElement(_hearts[i]); } crosshair = new UIImage(AssetManager.loadTexture("engine:gui")); crosshair.setTextureSize(new Vector2f(20f, 20f)); crosshair.setTextureOrigin(new Vector2f(24f, 24f)); crosshair.setSize(new Vector2f(40f, 40f)); crosshair.setHorizontalAlign(EHorizontalAlign.CENTER); crosshair.setVerticalAlign(EVerticalAlign.CENTER); crosshair.setVisible(true); debugLine1 = new UIText(); debugLine1.setPosition(new Vector2f(4, 4)); debugLine2 = new UIText(); debugLine2.setPosition(new Vector2f(4, 22)); debugLine3 = new UIText(); debugLine3.setPosition(new Vector2f(4, 38)); debugLine4 = new UIText(); debugLine4.setPosition(new Vector2f(4, 54)); toolbar = new UIItemContainer(9); toolbar.setVisible(true); toolbar.setHorizontalAlign(EHorizontalAlign.CENTER); toolbar.setVerticalAlign(EVerticalAlign.BOTTOM); minionbar = new UIMinionbar(); minionbar.setVisible(true); messagequeue = new UIMessageQueue(); messagequeue.setVisible(true); buffBar = new UIBuff(); buffBar.setVisible(true); addDisplayElement(crosshair, "crosshair"); addDisplayElement(debugLine1); addDisplayElement(debugLine2); addDisplayElement(debugLine3); addDisplayElement(debugLine4); addDisplayElement(toolbar); addDisplayElement(minionbar); addDisplayElement(messagequeue); addDisplayElement(buffBar); CoreRegistry.get(EventSystem.class).registerEventHandler(this); update(); layout(); }
@Override public void initialise() { entityManager = CoreRegistry.get(EntityManager.class); }
private void checkForLootedBlocks() { LocalPlayer player = CoreRegistry.get(LocalPlayer.class); // to send blocks to minions, some needed classes EntityRef playerent = player.getEntity(); LocalPlayerComponent localPlayerComp = playerent.getComponent(LocalPlayerComponent.class); MinionBarComponent inventory = null; EntityRef closestminion = null; if (localPlayerComp.minionMode) { inventory = playerent.getComponent(MinionBarComponent.class); } for (int i = _blocks.size() - 1; i >= 0; i--) { BlockRigidBody b = _blocks.get(i); if (b._temporary) continue; float closestDist = 99999; if (inventory != null) { // check for the closest minion Iterator<EntityRef> it = inventory.MinionSlots.iterator(); while (it.hasNext()) { EntityRef minion = it.next(); if (b.distanceToEntity(minion) < closestDist) { closestDist = b.distanceToEntity(minion); closestminion = minion; } } } if (localPlayerComp.minionMode) { if (closestDist < 8 && !b._picked) { b._picked = true; } } else { closestDist = b.distanceToPlayer(); // Check if the block is close enough to the player if (b.distanceToPlayer() < 8.0f && !b._picked) { // Mark it as picked and remove it from the simulation b._picked = true; } } // Block was marked as being picked if (b._picked && closestDist < 32.0f) { // Animate the movement in direction of the player if (closestDist > 1.0) { Transform t = new Transform(); b.getMotionState().getWorldTransform(t); Matrix4f tMatrix = new Matrix4f(); t.getMatrix(tMatrix); Vector3f blockPlayer = new Vector3f(); tMatrix.get(blockPlayer); if (localPlayerComp.minionMode && closestminion != null) { LocationComponent minionloc = closestminion.getComponent(LocationComponent.class); if (minionloc != null) blockPlayer.sub(minionloc.getWorldPosition()); else blockPlayer.sub(new Vector3f()); } else { blockPlayer.sub(new Vector3f(player.getPosition())); } blockPlayer.normalize(); blockPlayer.scale(-16000f); b.applyCentralImpulse(blockPlayer); } else { // TODO: Handle full inventories // TODO: Loot blocks should be entities // Block was looted (and reached the player) Block block = BlockManager.getInstance().getBlock(b.getType()); EntityRef blockItem = _blockItemFactory.newInstance(block.getBlockFamily()); if (localPlayerComp.minionMode) { if (closestminion != null) { closestminion.send(new ReceiveItemEvent(blockItem)); } } else { playerent.send(new ReceiveItemEvent(blockItem)); } ItemComponent itemComp = blockItem.getComponent(ItemComponent.class); if (itemComp != null && !itemComp.container.exists()) { blockItem.destroy(); } AudioManager.play(new AssetUri(AssetType.SOUND, "engine:Loot")); _blocks.remove(i); _discreteDynamicsWorld.removeRigidBody(b); } } } }
public void initialise() { entityManager = CoreRegistry.get(EntityManager.class); worldRenderer = CoreRegistry.get(WorldRenderer.class); }
/** Init. a new random world. */ public void initWorld(String title, String seed) { final FastRandom random = new FastRandom(); // Get rid of the old world if (_worldRenderer != null) { _worldRenderer.dispose(); _worldRenderer = null; } if (seed == null) { seed = random.randomCharacterString(16); } else if (seed.isEmpty()) { seed = random.randomCharacterString(16); } Terasology.getInstance() .getLogger() .log(Level.INFO, "Creating new World with seed \"{0}\"", seed); // Init. a new world _worldRenderer = new WorldRenderer(title, seed, _entityManager, _localPlayerSys); File entityDataFile = new File(Terasology.getInstance().getWorldSavePath(title), ENTITY_DATA_FILE); _entityManager.clear(); if (entityDataFile.exists()) { try { _entityManager.load(entityDataFile, EntityManager.SaveFormat.Binary); } catch (IOException e) { _logger.log(Level.SEVERE, "Failed to load entity data", e); } } LocalPlayer localPlayer = null; Iterator<EntityRef> iterator = _entityManager.iteratorEntities(LocalPlayerComponent.class).iterator(); if (iterator.hasNext()) { localPlayer = new LocalPlayer(iterator.next()); } else { PlayerFactory playerFactory = new PlayerFactory(_entityManager); localPlayer = new LocalPlayer( playerFactory.newInstance( new Vector3f(_worldRenderer.getWorldProvider().nextSpawningPoint()))); } _worldRenderer.setPlayer(localPlayer); // Create the first Portal if it doesn't exist yet _worldRenderer.initPortal(); fastForwardWorld(); CoreRegistry.put(WorldRenderer.class, _worldRenderer); CoreRegistry.put(IWorldProvider.class, _worldRenderer.getWorldProvider()); CoreRegistry.put(LocalPlayer.class, _worldRenderer.getPlayer()); CoreRegistry.put(Camera.class, _worldRenderer.getActiveCamera()); CoreRegistry.put(BulletPhysicsRenderer.class, _worldRenderer.getBulletRenderer()); for (ComponentSystem system : _componentSystemManager.iterateAll()) { system.initialise(); } }
public void init() { _hud = new UIHeadsUpDisplay(); _hud.setVisible(true); _pauseMenu = new UIPauseMenu(); _loadingScreen = new UILoadingScreen(); _statusScreen = new UIStatusScreen(); _inventoryScreen = new UIInventoryScreen(); _metrics = new UIMetrics(); _metrics.setVisible(true); _guiScreens.add(_metrics); _guiScreens.add(_hud); _guiScreens.add(_pauseMenu); _guiScreens.add(_loadingScreen); _guiScreens.add(_inventoryScreen); _guiScreens.add(_statusScreen); PojoEntityManager entityManager = new PojoEntityManager(); entityManager.registerTypeHandler(BlockFamily.class, new BlockFamilyTypeHandler()); entityManager.registerTypeHandler(Color4f.class, new Color4fTypeHandler()); entityManager.registerTypeHandler(Quat4f.class, new Quat4fTypeHandler()); entityManager.registerTypeHandler( Sound.class, new SoundTypeHandler(AudioManager.getInstance())); entityManager.registerTypeHandler(Vector3f.class, new Vector3fTypeHandler()); entityManager.registerTypeHandler(Vector2f.class, new Vector2fTypeHandler()); entityManager.registerTypeHandler(Vector3i.class, new Vector3iTypeHandler()); // TODO: Use reflection pending mod support entityManager.registerComponentClass(ExplosionActionComponent.class); entityManager.registerComponentClass(PlaySoundActionComponent.class); entityManager.registerComponentClass(TunnelActionComponent.class); entityManager.registerComponentClass(AABBCollisionComponent.class); entityManager.registerComponentClass(BlockComponent.class); entityManager.registerComponentClass(BlockItemComponent.class); entityManager.registerComponentClass(BlockParticleEffectComponent.class); entityManager.registerComponentClass(CameraComponent.class); entityManager.registerComponentClass(CharacterMovementComponent.class); entityManager.registerComponentClass(CharacterSoundComponent.class); entityManager.registerComponentClass(HealthComponent.class); entityManager.registerComponentClass(InventoryComponent.class); entityManager.registerComponentClass(ItemComponent.class); entityManager.registerComponentClass(LightComponent.class); entityManager.registerComponentClass(LocalPlayerComponent.class); entityManager.registerComponentClass(LocationComponent.class); entityManager.registerComponentClass(MeshComponent.class); entityManager.registerComponentClass(PlayerComponent.class); entityManager.registerComponentClass(SimpleAIComponent.class); entityManager.registerComponentClass(AccessInventoryActionComponent.class); _entityManager = entityManager; _entityManager.setEventSystem(new PojoEventSystem(_entityManager)); CoreRegistry.put(EntityManager.class, _entityManager); _componentSystemManager = new ComponentSystemManager(); CoreRegistry.put(ComponentSystemManager.class, _componentSystemManager); PrefabManager prefabManager = new PojoPrefabManager(); CoreRegistry.put(PrefabManager.class, prefabManager); entityManager.setPrefabManager(prefabManager); loadPrefabs(); _componentSystemManager.register(new BlockEntityRegistry()); _componentSystemManager.register(new CharacterMovementSystem()); _componentSystemManager.register(new SimpleAISystem()); _componentSystemManager.register(new ItemSystem()); _componentSystemManager.register(new CharacterSoundSystem()); _localPlayerSys = new LocalPlayerSystem(); _componentSystemManager.register(_localPlayerSys); _componentSystemManager.register(new FirstPersonRenderer()); _componentSystemManager.register(new HealthSystem()); _componentSystemManager.register(new BlockEntitySystem()); _componentSystemManager.register(new BlockParticleEmitterSystem()); _componentSystemManager.register(new BlockDamageRenderer()); _componentSystemManager.register(new InventorySystem()); _componentSystemManager.register(new MeshRenderer()); _componentSystemManager.register(new ExplosionAction()); _componentSystemManager.register(new PlaySoundAction()); _componentSystemManager.register(new TunnelAction()); _componentSystemManager.register(new AccessInventoryAction()); }