Package nallar.tickthreading.minecraft.tickregion

Examples of nallar.tickthreading.minecraft.tickregion.TileEntityTickRegion


  @SuppressWarnings("NumericCastThatLosesPrecision")
  private TileEntityTickRegion getOrCreateRegion(TileEntity tileEntity) {
    int regionX = tileEntity.xCoord >> regionSizePower;
    int regionZ = tileEntity.zCoord >> regionSizePower;
    int hashCode = getHashCodeFromRegionCoords(regionX, regionZ);
    TileEntityTickRegion callable = tileEntityCallables.get(hashCode);
    if (callable == null) {
      synchronized (tickRegions) {
        callable = tileEntityCallables.get(hashCode);
        if (callable == null) {
          callable = new TileEntityTickRegion(world, this, regionX, regionZ);
          tileEntityCallables.put(hashCode, callable);
          tickRegions.add(callable);
        }
      }
    }
View Full Code Here


      }
    }
  }

  public boolean add(TileEntity tileEntity, boolean newEntity) {
    TileEntityTickRegion tileEntityTickRegion = getOrCreateRegion(tileEntity);
    if (tileEntityTickRegion.add(tileEntity)) {
      tileEntity.tickRegion = tileEntityTickRegion;
      if (newEntity) {
        synchronized (tileEntityLock) {
          tileEntityList.add(tileEntity);
        }
View Full Code Here

    tileEntities = safeCopyClear(tileEntities);
    if (tileEntities == null) {
      return;
    }
    for (TileEntity tileEntity : tileEntities) {
      TileEntityTickRegion tickRegion = tileEntity.tickRegion;
      if (tickRegion != null) {
        tickRegion.remove(tileEntity);
        tileEntity.tickRegion = null;
        tileEntity.onChunkUnload();
      }
    }
    synchronized (tileEntityLock) {
View Full Code Here

      return copy;
    }
  }

  public void remove(TileEntity tileEntity) {
    TileEntityTickRegion tileEntityTickRegion = tileEntity.tickRegion;
    if (tileEntityTickRegion == null) {
      tileEntityTickRegion = getOrCreateRegion(tileEntity);
    }
    tileEntityTickRegion.remove(tileEntity);
    removed(tileEntity);
  }
View Full Code Here

  }

  public TableFormatter writeRegionDetails(final TableFormatter tf, final int hashCode) {
    int x = 0;
    int z = 0;
    TileEntityTickRegion tileEntityTickRegion = getTileEntityRegion(hashCode);
    if (tileEntityTickRegion != null) {
      tileEntityTickRegion.dump(tf);
      x = tileEntityTickRegion.regionX;
      z = tileEntityTickRegion.regionZ;
    }
    EntityTickRegion entityTickRegion = getEntityRegion(hashCode);
    if (entityTickRegion != null) {
View Full Code Here

TOP

Related Classes of nallar.tickthreading.minecraft.tickregion.TileEntityTickRegion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.