package net.minecraft.src; import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; public class AABBPool { private static final Logger L = Logger.getLogger(AABBPool.class.getName()); private AxisAlignedBB[] pool = new AxisAlignedBB[16000]; private int poolIndex = -1; public AABBPool(int par1, int par2) { } /** * Adds a AABB to the pool, or if there is an available AABB, updates an * existing AABB entry to specified coordinates */ public AxisAlignedBB addOrModifyAABBInPool(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { if (++poolIndex > pool.length - 1) { return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); } else if (pool[poolIndex] == null) { return pool[poolIndex] = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); } else { return pool[poolIndex].setBounds(minX, minY, minZ, maxX, maxY, maxZ); } } /** * Marks the pool as "empty", starting over when adding new entries. If this * is called maxNumCleans times, the list size is reduced */ public void cleanPool() { if (poolIndex > pool.length - 1) { L.log(Level.WARNING, "AABB pool overflow, created {0} unpooled instances", (poolIndex - pool.length)); } poolIndex = -1; } /** * Clears the AABBPool */ public void clearPool() { Arrays.fill(pool, null); poolIndex = -1; } public int func_83013_c() { return pool.length; } public int func_83012_d() { return poolIndex % pool.length; } }