Esempio n. 1
0
  @ReceiveEvent(components = {FenceGateComponent.class})
  public void onActivate(ActivateEvent event, EntityRef entity) {
    FenceGateComponent fenceGateComponent = entity.getComponent(FenceGateComponent.class);
    fenceGateComponent.isClosed = !fenceGateComponent.isClosed;
    entity.saveComponent(fenceGateComponent);

    BlockComponent blockComp = entity.getComponent(BlockComponent.class);
    if (blockComp == null) {
      event.cancel();
      return;
    }

    Vector3i primePos = new Vector3i(blockComp.getPosition());
    Block primeBlock = worldProvider.getBlock(primePos);

    Block newBlock = null;
    if (fenceGateComponent.isClosed) {
      newBlock =
          BlockManager.getInstance()
              .getBlockFamily("fences:FenceGateClosed")
              .getBlockForPlacing(worldProvider, primePos, primeBlock.getDirection(), Side.FRONT);
    } else {
      newBlock =
          BlockManager.getInstance()
              .getBlockFamily("fences:FenceGateOpen")
              .getBlockForPlacing(worldProvider, primePos, primeBlock.getDirection(), Side.FRONT);
    }

    if (newBlock != null) {
      blockEntityRegistry.setBlock(primePos, newBlock, primeBlock, entity);
    }
  }
  @Override
  public void update(float delta) {
    int processed = 0;
    PerformanceMonitor.startActivity("BlockChangedEventQueue");
    BlockChangedEvent event = eventQueue.poll();
    while (event != null) {
      logger.finer(
          String.format(
              "%s: %s -> %s",
              event.getBlockPosition(),
              event.getOldType().getBlockFamily(),
              event.getNewType().getBlockFamily()));
      getOrCreateEntityAt(event.getBlockPosition()).send(event);
      if (processed++ >= 4) {
        break;
      }
      event = eventQueue.poll();
    }
    PerformanceMonitor.endActivity();
    PerformanceMonitor.startActivity("Temp Blocks Cleanup");
    for (EntityRef entity : tempBlocks) {
      BlockComponent blockComp = entity.getComponent(BlockComponent.class);
      if (blockComp == null || !blockComp.temporary) continue;

      HealthComponent healthComp = entity.getComponent(HealthComponent.class);
      if (healthComp == null || healthComp.currentHealth == healthComp.maxHealth) {
        entity.destroy();
      }
    }
    tempBlocks.clear();
    PerformanceMonitor.endActivity();
  }
Esempio n. 3
0
 /**
  * The active minion, to be commanded by the minion command item etc uses a slightly different
  * texture to indicate selection
  *
  * @param minion : the new active minion entity
  */
 public static void setActiveMinion(EntityRef minion) {
   SkeletalMeshComponent skelcomp;
   if (activeminion != null) {
     skelcomp = activeminion.getComponent(SkeletalMeshComponent.class);
     if (skelcomp != null) {
       skelcomp.material = Assets.getMaterial("OreoMinions:OreonSkin");
     }
   }
   skelcomp = minion.getComponent(SkeletalMeshComponent.class);
   if (skelcomp != null) {
     skelcomp.material = Assets.getMaterial("OreoMinions:OreonSkinSelected");
   }
   activeminion = minion;
 }
Esempio n. 4
0
  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 EntityRef deserializeEntity(EntityData.Entity entityData) {
    EntityRef entity = entityManager.createEntityRefWithId(entityData.getId());
    if (entityData.hasParentPrefab()
        && !entityData.getParentPrefab().isEmpty()
        && prefabManager.exists(entityData.getParentPrefab())) {
      Prefab prefab = prefabManager.getPrefab(entityData.getParentPrefab());
      for (Component component : prefab.listComponents()) {
        String componentName = ComponentUtil.getComponentClassName(component.getClass());
        if (!containsIgnoreCase(componentName, entityData.getRemovedComponentList())) {
          entity.addComponent(componentLibrary.copy(component));
        }
      }
      entity.addComponent(new EntityInfoComponent(entityData.getParentPrefab()));
    }
    for (EntityData.Component componentData : entityData.getComponentList()) {
      Class<? extends Component> componentClass = getComponentClass(componentData);
      if (componentClass == null) continue;

      if (!entity.hasComponent(componentClass)) {
        entity.addComponent(deserializeComponent(componentData));
      } else {
        deserializeComponentOnto(entity.getComponent(componentClass), componentData);
      }
    }
    return entity;
  }
Esempio n. 6
0
 /** 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);
     }
   }
 }
Esempio n. 7
0
 private static Vector3f getEntityPosition(EntityRef entity) {
   LocationComponent loc = entity.getComponent(LocationComponent.class);
   if (loc != null) {
     return loc.getWorldPosition();
   }
   return null;
 }
  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();
    }
  }
Esempio n. 9
0
 /**
  * adds a new zone to the corresponding zone list
  *
  * @param zone the zone to be added
  */
 public static void addZone(Zone zone) {
   ZoneListComponent zonelistcomp = zonelist.getComponent(ZoneListComponent.class);
   switch (zone.zonetype) {
     case Gather:
       {
         zonelistcomp.Gatherzones.add(zone);
         break;
       }
     case Work:
       {
         zonelistcomp.Workzones.add(zone);
         break;
       }
     case Terraform:
       {
         zonelistcomp.Terrazones.add(zone);
         break;
       }
     case Storage:
       {
         zonelistcomp.Storagezones.add(zone);
         break;
       }
     case OreonFarm:
       {
         zonelistcomp.OreonFarmzones.add(zone);
         break;
       }
   }
   zonelist.saveComponent(zonelistcomp);
 }
Esempio n. 10
0
 /**
  * destroys a minion at the end of their dying animation this implies that setting their animation
  * to die will destroy them.
  */
 @ReceiveEvent(components = {SkeletalMeshComponent.class, AnimationComponent.class})
 public void onAnimationEnd(AnimEndEvent event, EntityRef entity) {
   AnimationComponent animcomp = entity.getComponent(AnimationComponent.class);
   if (animcomp != null && event.getAnimation().equals(animcomp.dieAnim)) {
     entity.destroy();
   }
 }
Esempio n. 11
0
 private static Vector3f getEntityVelocity(EntityRef entity) {
   CharacterMovementComponent charMove = entity.getComponent(CharacterMovementComponent.class);
   if (charMove != null) {
     return charMove.getVelocity();
   }
   return new Vector3f();
 }
Esempio n. 12
0
 @ReceiveEvent(components = {SimpleAIComponent.class})
 public void onBump(HorizontalCollisionEvent event, EntityRef entity) {
   CharacterMovementComponent moveComp = entity.getComponent(CharacterMovementComponent.class);
   if (moveComp != null && moveComp.isGrounded) {
     moveComp.jump = true;
     entity.saveComponent(moveComp);
   }
 }
 @ReceiveEvent(components = {BlockRegionComponent.class})
 public void onNewBlockRegion(AddComponentEvent event, EntityRef entity) {
   BlockRegionComponent regionComp = entity.getComponent(BlockRegionComponent.class);
   blockRegions.put(entity, regionComp.region);
   for (Vector3i pos : regionComp.region) {
     blockRegionLookup.put(pos, entity);
   }
 }
Esempio n. 14
0
 /**
  * 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()));
 }
Esempio n. 15
0
 @Override
 public void shutdown() {
   if (activeminion != null) {
     SkeletalMeshComponent skelcomp = activeminion.getComponent(SkeletalMeshComponent.class);
     if (skelcomp != null) {
       skelcomp.material = Assets.getMaterial("OreoMinions:OreonSkin");
     }
   }
 }
Esempio n. 16
0
 private static Vector3f getEntityDirection(EntityRef entity) {
   LocationComponent loc = entity.getComponent(LocationComponent.class);
   if (loc != null) {
     Quat4f rot = loc.getWorldRotation();
     Vector3f dir = new Vector3f(0, 0, -1);
     QuaternionUtil.quatRotate(rot, dir, dir);
     return dir;
   }
   return new Vector3f();
 }
 @Override
 public EntityData.Entity serializeEntity(EntityRef entityRef) {
   EntityInfoComponent entityInfo = entityRef.getComponent(EntityInfoComponent.class);
   if (entityInfo != null) {
     if (entityInfo.parentPrefab != null && prefabManager.exists(entityInfo.parentPrefab)) {
       return serializeEntityDelta(entityRef, prefabManager.getPrefab(entityInfo.parentPrefab));
     }
   }
   return serializeEntityFull(entityRef);
 }
  @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();
        }
      }
    }
  }
Esempio n. 19
0
 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);
   }
 }
 @ReceiveEvent(components = {BlockRegionComponent.class})
 public void onBlockRegionChanged(ChangedComponentEvent event, EntityRef entity) {
   Region3i oldRegion = blockRegions.get(entity);
   for (Vector3i pos : oldRegion) {
     blockRegionLookup.remove(pos);
   }
   BlockRegionComponent regionComp = entity.getComponent(BlockRegionComponent.class);
   blockRegions.put(entity, regionComp.region);
   for (Vector3i pos : regionComp.region) {
     blockRegionLookup.put(pos, entity);
   }
 }
  public void update(float delta) {
    for (EntityRef entity : entityManager.iteratorEntities(MiniaturizerComponent.class)) {
      MiniaturizerComponent min = entity.getComponent(MiniaturizerComponent.class);

      if (min.chunkMesh == null && min.miniatureChunk != null) {
        min.chunkMesh =
            worldRenderer.getChunkTesselator().generateMinaturizedMesh(min.miniatureChunk);
        min.chunkMesh.generateVBOs();
        min.chunkMesh._vertexElements = null;
      }

      // min.orientation += delta * 15f;
    }
  }
    public float distanceToEntity(EntityRef target) {
      Transform t = new Transform();
      getMotionState().getWorldTransform(t);
      Matrix4f tMatrix = new Matrix4f();
      t.getMatrix(tMatrix);

      Vector3f blockPlayer = new Vector3f();
      tMatrix.get(blockPlayer);

      LocationComponent loc = target.getComponent(LocationComponent.class);
      if (loc != null) blockPlayer.sub(loc.getWorldPosition());
      else blockPlayer.sub(new Vector3f());

      return blockPlayer.length();
    }
Esempio n. 23
0
  @ReceiveEvent(components = SpawnPrefabActionComponent.class)
  public void onActivate(ActivateEvent event, EntityRef entity) {
    SpawnPrefabActionComponent spawnInfo = entity.getComponent(SpawnPrefabActionComponent.class);
    if (spawnInfo.prefab != null) {
      Vector3f spawnLoc = new Vector3f();
      switch (spawnInfo.spawnLocationRelativeTo) {
        case Instigator:
          spawnLoc.set(event.getInstigatorLocation());
          break;
        case Target:
          Vector3f pos = event.getTargetLocation();
          if (pos != null) {
            spawnLoc.set(pos);
          }
          break;
      }

      EntityRef newEntity = entityManager.create(spawnInfo.prefab, spawnLoc);
    }
  }
Esempio n. 24
0
  public void update(float delta) {
    /* GUI */
    updateUserInterface();

    for (UpdateSubscriberSystem updater : _componentSystemManager.iterateUpdateSubscribers()) {
      PerformanceMonitor.startActivity(updater.getClass().getSimpleName());
      updater.update(delta);
    }

    if (_worldRenderer != null && shouldUpdateWorld()) _worldRenderer.update(delta);

    if (!screenHasFocus()) _localPlayerSys.updateInput();

    if (screenHasFocus() || !shouldUpdateWorld()) {
      if (Mouse.isGrabbed()) {
        Mouse.setGrabbed(false);
        Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2);
      }
    } else {
      if (!Mouse.isGrabbed()) Mouse.setGrabbed(true);
    }

    // TODO: This seems a little off - plus is more of a UI than single player game state concern.
    // Move somewhere
    // more appropriate?
    boolean dead = true;
    for (EntityRef entity : _entityManager.iteratorEntities(LocalPlayerComponent.class)) {
      dead = entity.getComponent(LocalPlayerComponent.class).isDead;
    }
    if (dead) {
      _statusScreen.setVisible(true);
      _statusScreen.updateStatus("Sorry! Seems like you have died. :-(");
    } else {
      _statusScreen.setVisible(false);
    }
  }
Esempio n. 25
0
  public EntityRef newInstance(Vector3f spawnPosition) {
    EntityRef player = entityManager.create("core:player");
    LocationComponent location = player.getComponent(LocationComponent.class);
    location.setWorldPosition(spawnPosition);
    player.saveComponent(location);
    PlayerComponent playerComponent = player.getComponent(PlayerComponent.class);
    playerComponent.spawnPosition.set(spawnPosition);
    player.saveComponent(playerComponent);
    player.addComponent(new LocalPlayerComponent());

    // Goodie chest
    EntityRef chest =
        blockFactory.newInstance(BlockManager.getInstance().getBlockFamily("core:chest"));
    BlockItemComponent blockItem = chest.getComponent(BlockItemComponent.class);
    EntityRef chestContents = blockItem.placedEntity;

    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("core:companion"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:brick:engine:stair"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(BlockManager.getInstance().getBlockFamily("core:Tnt"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("books:Bookcase"), 1)));

    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:clay:engine:slope"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:clay:engine:steepslope"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:StoneStair"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:marble:engine:stair"), 99)));

    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Marble"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:marble:engine:testsphere"),
                99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:marble:engine:slope"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:marble:engine:steepslope"),
                99)));

    chestContents.send(new ReceiveItemEvent(entityManager.create("potions:purplepotion")));
    chestContents.send(new ReceiveItemEvent(entityManager.create("potions:greenpotion")));
    chestContents.send(new ReceiveItemEvent(entityManager.create("potions:orangepotion")));
    chestContents.send(new ReceiveItemEvent(entityManager.create("potions:redpotion")));

    chestContents.send(new ReceiveItemEvent(entityManager.create("books:book")));
    chestContents.send(new ReceiveItemEvent(entityManager.create("books:bluebook")));
    chestContents.send(new ReceiveItemEvent(entityManager.create("books:redbook")));
    chestContents.send(new ReceiveItemEvent(entityManager.create("core:railgunTool")));

    chestContents.send(new ReceiveItemEvent(entityManager.create("core:mrbarsack")));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Cobaltite"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:NativeGoldOre"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Microcline"), 99)));

    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Brick"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(BlockManager.getInstance().getBlockFamily("engine:Ice"), 99)));
    chestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Plank"), 99)));

    EntityRef doorItem = entityManager.create("core:door");
    ItemComponent doorItemComp = doorItem.getComponent(ItemComponent.class);
    doorItemComp.stackCount = 20;
    doorItem.saveComponent(doorItemComp);
    chestContents.send(new ReceiveItemEvent(doorItem));

    // Inner goodie chest
    EntityRef innerChest =
        blockFactory.newInstance(BlockManager.getInstance().getBlockFamily("core:Chest"));
    BlockItemComponent innerBlockItem = innerChest.getComponent(BlockItemComponent.class);
    EntityRef innerChestContents = innerBlockItem.placedEntity;

    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Alabaster"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Basalt"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Gabbro"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Hornblende"), 99)));

    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:OrangeSandStone"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Phyllite"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Schist"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Cinnabar"), 99)));

    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Lava"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Water"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Rutile"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("minerals:Kaolinite"), 99)));

    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Iris"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Dandelion"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Tulip"), 99)));
    innerChestContents.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:YellowFlower"), 99)));

    // Place inner chest into outer chest
    chestContents.send(new ReceiveItemEvent(innerChest));

    player.send(new ReceiveItemEvent(entityManager.create("core:pickaxe")));
    player.send(new ReceiveItemEvent(entityManager.create("core:axe")));
    player.send(
        new ReceiveItemEvent(
            blockFactory.newInstance(
                BlockManager.getInstance().getBlockFamily("engine:Torch"), 99)));
    player.send(new ReceiveItemEvent(entityManager.create("core:explodeTool")));
    player.send(new ReceiveItemEvent(entityManager.create("core:railgunTool")));
    player.send(new ReceiveItemEvent(entityManager.create("core:miniaturizer")));
    player.send(new ReceiveItemEvent(chest));

    return player;
  }
Esempio n. 26
0
 /**
  * returns a list with all terraform zones
  *
  * @return a list with all terraform zones
  */
 public static List<Zone> getTerraformZoneList() {
   if (zonelist == null) {
     return null;
   }
   return zonelist.getComponent(ZoneListComponent.class).Terrazones;
 }
Esempio n. 27
0
 /**
  * returns a list with all storage zones
  *
  * @return a list with all storage zones
  */
 public static List<Zone> getStorageZoneList() {
   if (zonelist == null) {
     return null;
   }
   return zonelist.getComponent(ZoneListComponent.class).Storagezones;
 }
Esempio n. 28
0
 /**
  * returns a list with all Oreon farm zones
  *
  * @return a list with all Oreon farm zones
  */
 public static List<Zone> getOreonFarmZoneList() {
   if (zonelist == null) {
     return null;
   }
   return zonelist.getComponent(ZoneListComponent.class).OreonFarmzones;
 }
 @ReceiveEvent(components = {BlockComponent.class})
 public void onCreate(AddComponentEvent event, EntityRef entity) {
   BlockComponent block = entity.getComponent(BlockComponent.class);
   blockComponentLookup.put(new Vector3i(block.getPosition()), entity);
 }
 @ReceiveEvent(components = {BlockComponent.class})
 public void onDestroy(RemovedComponentEvent event, EntityRef entity) {
   BlockComponent block = entity.getComponent(BlockComponent.class);
   blockComponentLookup.remove(new Vector3i(block.getPosition()));
 }