示例#1
0
 @Override
 public void ticketsLoaded(List<Ticket> tickets, World world) {
   for (Ticket ticket : tickets) {
     int quarryX = ticket.getModData().getInteger("quarryX");
     int quarryY = ticket.getModData().getInteger("quarryY");
     int quarryZ = ticket.getModData().getInteger("quarryZ");
     TileQuarry tq = (TileQuarry) world.getBlockTileEntity(quarryX, quarryY, quarryZ);
     tq.forceChunkLoading(ticket);
   }
 }
 @Override
 public void ticketsLoaded(List<Ticket> tickets, World world) {
   for (Ticket ticket : tickets) {
     int MaschineX = ticket.getModData().getInteger("MaschineX");
     int MaschineY = ticket.getModData().getInteger("MaschineY");
     int MaschineZ = ticket.getModData().getInteger("MaschineZ");
     TileEntityMachines Machines =
         (TileEntityMachines) world.getBlockTileEntity(MaschineX, MaschineY, MaschineZ);
     Machines.forceChunkLoading(ticket);
   }
 }
示例#3
0
    @Override
    public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
      List<Ticket> validTickets = Lists.newArrayList();
      for (Ticket ticket : tickets) {
        int quarryX = ticket.getModData().getInteger("quarryX");
        int quarryY = ticket.getModData().getInteger("quarryY");
        int quarryZ = ticket.getModData().getInteger("quarryZ");

        int blId = world.getBlockId(quarryX, quarryY, quarryZ);
        if (blId == quarryBlock.blockID) {
          validTickets.add(ticket);
        }
      }
      return validTickets;
    }
    @Override
    public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
      List<Ticket> validTickets = Lists.newArrayList();
      for (Ticket ticket : tickets) {
        int MaschineX = ticket.getModData().getInteger("MaschineX");
        int MaschineY = ticket.getModData().getInteger("MaschineY");
        int MaschineZ = ticket.getModData().getInteger("MaschineZ");

        TileEntity tileEntity = world.getBlockTileEntity(MaschineX, MaschineY, MaschineZ);
        if (tileEntity instanceof TileEntityMachines) {
          validTickets.add(ticket);
        }
      }
      return validTickets;
    }
 public void setForcedChunkRange(int minX, int minZ, int maxX, int maxZ) {
   releaseChunkTicket();
   Ticket ticket = getChunkTicket();
   if (ticket != null) {
     NBTTagCompound nbt = ticket.getModData();
     nbt.setString("type", "TileEntity");
     nbt.setInteger("xCoord", xCoord);
     nbt.setInteger("yCoord", yCoord);
     nbt.setInteger("zCoord", zCoord);
     nbt.setInteger("rangeMinX", minX);
     nbt.setInteger("rangeMinZ", minZ);
     nbt.setInteger("rangeMaxX", maxX);
     nbt.setInteger("rangeMaxZ", maxZ);
     forceChunkRangeOnTicket(ticket);
   }
 }
 @Override
 public void ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world) {
   for (Ticket ticket : tickets) {
     NBTTagCompound nbt = ticket.getModData();
     if (nbt != null)
       if (nbt.getString("type").equals("TileEntity")) {
         int x = nbt.getInteger("xCoord");
         int y = nbt.getInteger("yCoord");
         int z = nbt.getInteger("zCoord");
         TileEntity te = world.getBlockTileEntity(x, y, z);
         if (te instanceof TileEntityChunkLoader)
           if (!((TileEntityChunkLoader) te).reinstateChunkTicket(ticket))
             ForgeChunkManager.releaseTicket(ticket);
       }
   }
 }
 public void forceChunkRangeOnTicket(Ticket ticket) {
   NBTTagCompound nbt = ticket.getModData();
   int minX = nbt.getInteger("rangeMinX");
   int minZ = nbt.getInteger("rangeMinZ");
   int maxX = nbt.getInteger("rangeMaxX");
   int maxZ = nbt.getInteger("rangeMaxZ");
   int chunkX = xCoord >> 4;
   int chunkZ = zCoord >> 4;
   for (int i = minX; i <= maxX; i++)
     for (int j = minZ; j <= maxZ; j++) {
       int x = chunkX + i, z = chunkZ + j;
       // System.out.printf("BaseChunkLoadingTE.forceChunkRangeOnTicket: forcing chunk (%d; %d,
       // %d)\n",
       // worldObj.provider.dimensionId, x, z);
       ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x, z));
     }
 }