Package nallar.tickthreading.minecraft.tickregion

Examples of nallar.tickthreading.minecraft.tickregion.EntityTickRegion


  @SuppressWarnings("NumericCastThatLosesPrecision")
  private EntityTickRegion getOrCreateRegion(Entity entity) {
    int regionX = (entity.chunkCoordX << 4) >> regionSizePower;
    int regionZ = (entity.chunkCoordZ << 4) >> regionSizePower;
    int hashCode = getHashCodeFromRegionCoords(regionX, regionZ);
    EntityTickRegion callable = entityCallables.get(hashCode);
    if (callable == null) {
      synchronized (tickRegions) {
        callable = entityCallables.get(hashCode);
        if (callable == null) {
          callable = new EntityTickRegion(world, this, regionX, regionZ);
          entityCallables.put(hashCode, callable);
          tickRegions.add(callable);
        }
      }
    }
View Full Code Here


    }
    return false;
  }

  public boolean add(Entity entity, boolean newEntity) {
    EntityTickRegion entityTickRegion = getOrCreateRegion(entity);
    if (entityTickRegion.add(entity)) {
      entity.tickRegion = entityTickRegion;
      if (newEntity) {
        synchronized (entityLock) {
          entityList.add(entity);
        }
View Full Code Here

        }
      }

      world.onEntityRemoved(entity);

      EntityTickRegion tickRegion = entity.tickRegion;
      if (tickRegion != null) {
        tickRegion.remove(entity);
        entity.tickRegion = null;
        Class entityClass = entity.getClass();
        synchronized (entityClassToCountMap) {
          Integer count = entityClassToCountMap.get(entityClass);
          if (count == null) {
View Full Code Here

    tileEntityTickRegion.remove(tileEntity);
    removed(tileEntity);
  }

  public void remove(Entity entity) {
    EntityTickRegion entityTickRegion = entity.tickRegion;
    if (entityTickRegion == null) {
      entityTickRegion = getOrCreateRegion(entity);
    }
    entityTickRegion.remove(entity);
    removed(entity);
  }
View Full Code Here

    if (tileEntityTickRegion != null) {
      tileEntityTickRegion.dump(tf);
      x = tileEntityTickRegion.regionX;
      z = tileEntityTickRegion.regionZ;
    }
    EntityTickRegion entityTickRegion = getEntityRegion(hashCode);
    if (entityTickRegion != null) {
      entityTickRegion.dump(tf);
      x = entityTickRegion.regionX;
      z = entityTickRegion.regionZ;
    }
    if (entityTickRegion == null && tileEntityTickRegion == null) {
      tf.sb.append("tickRegion for ").append(hashCode).append(" does not exist");
View Full Code Here

TOP

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

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.