Example #1
0
 public void setMeta(int x, int y, int m) {
   Chunk chunk = getChunkI(x, y);
   if (chunk == null) return;
   TileInstance t = chunk.getTileInstance(x, y);
   if (t != null) {
     int m0 = t.metadata;
     t.metadata = (byte) m;
     if (m0 != m) chunk.markDirty();
   }
 }
Example #2
0
 public boolean chunkExists(int cx, int cy) {
   return cx >= 0
       && cy >= 0
       && cx < sizeChunks
       && cy < sizeChunks
       && chunks.keys.contains(Chunk.getChunkIndex(cx, cy));
 }
Example #3
0
  public void setTile(int x, int y, Tile t, int m) {
    Chunk chunk = loadChunkI(x, y);
    if (t != Tiles.air) {
      TileInstance ti = new TileInstance(chunk, x, y, t);
      ti.metadata = (byte) m;
      if (t.hasTileEntity(ti.metadata)) {
        ti.tileEntity = t.createTileEntity(ti);
        ti.tileEntity.world = this;
        ti.tileEntity.posX = x;
        ti.tileEntity.posY = y;
        ti.tileEntity.init();
      }

      chunk.setTileInstance(x, y, ti);
    } else chunk.setTileInstance(x, y, null);
    chunk.markDirty();
  }
Example #4
0
 public TileInstance getTileInstance(int x, int y) {
   Chunk chunk = getChunkI(x, y);
   return (chunk != null) ? chunk.getTileInstance(x, y) : null;
 }
Example #5
0
 public Chunk getChunk(int cx, int cy) {
   return chunks.get(Chunk.getChunkIndex(cx, cy));
 }