コード例 #1
0
 public void requestTicket() {
   ForgeChunkManager.Ticket chunkTicket =
       ForgeChunkManager.requestTicket(
           HostileWorlds.instance, worldObj, ForgeChunkManager.Type.ENTITY);
   if (chunkTicket != null) {
     chunkTicket.getModData();
     chunkTicket.setChunkListDepth(12);
     chunkTicket.bindEntity(this);
     setChunkTicket(chunkTicket);
   }
 }
コード例 #2
0
  /**
   * Checks to see if the situation for firing the laser exists... and changes the state accordingly
   */
  public void checkCanRun() {
    // Laser requires lense, redstone power, not be jammed, and be in orbit and energy to function
    if (!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)
        || glassPanel == null
        || storage.getEnergyStored()
            == 0 /*|| !(this.worldObj.provider instanceof IOrbitDimension)*/) {
      if (laserSat.isAlive()) {
        laserSat.deactivateLaser();
      }

      isRunning = false;
    } else if (!laserSat.isAlive()
        && !finished
        && !laserSat.getJammed()
        && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)
        && canMachineSeeEarth()) {

      // Laser will be on at this point
      int orbitDimId =
          0; // =
             // WorldUtil.getProviderForName(((IOrbitDimension)this.worldObj.provider).getPlanetToOrbit()).dimensionId;
      WorldServer orbitWorld = DimensionManager.getWorld(orbitDimId);

      if (ticket == null) {
        ticket =
            ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.worldObj, Type.NORMAL);
        if (ticket != null)
          ForgeChunkManager.forceChunk(
              ticket,
              new ChunkCoordIntPair(
                  this.xCoord / 16 - (this.xCoord < 0 ? 1 : 0),
                  this.zCoord / 16 - (this.zCoord < 0 ? 1 : 0)));
      }

      isRunning = laserSat.activateLaser(orbitWorld, laserX, laserZ);
    }

    if (!this.worldObj.isRemote)
      PacketHandler.sendToNearby(
          new PacketMachine(this, (byte) 2),
          this.xCoord,
          this.yCoord,
          this.zCoord,
          128,
          this.worldObj.provider.dimensionId);
  }
コード例 #3
0
  void initTicket() {
    if (Platform.isClient()) {
      return;
    }

    this.ct = ForgeChunkManager.requestTicket(AppEng.instance(), this.worldObj, Type.NORMAL);

    if (this.ct == null) {
      MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
      if (server != null) {
        List<EntityPlayerMP> pl = server.getConfigurationManager().playerEntityList;
        for (EntityPlayerMP p : pl) {
          p.addChatMessage(new ChatComponentText("Can't chunk load.."));
        }
      }
      return;
    }

    AELog.info("New Ticket " + this.ct.toString());
    ForgeChunkManager.forceChunk(
        this.ct, new ChunkCoordIntPair(this.xCoord >> 4, this.zCoord >> 4));
  }
コード例 #4
0
 Ticket newTicket(World world) {
   return ForgeChunkManager.requestTicket(mod, world, Type.NORMAL);
 }