{
int[] blockInfo = null;
if (projector.getTicks() % 40 == 0)
{
World world = ((TileEntity) projector).worldObj;
if (projector.getMode() instanceof ItemModeCustom && !(projector.getModuleCount(ModularForceFieldSystem.itemModuleCamouflage) > 0))
{
HashMap<Vector3, int[]> fieldBlocks = ((ItemModeCustom) projector.getMode()).getFieldBlockMap(projector, projector.getModeStack());
Vector3 fieldCenter = new Vector3((TileEntity) projector).translate(projector.getTranslation());
Vector3 relativePosition = position.clone().subtract(fieldCenter);
relativePosition.rotate(-projector.getRotationYaw(), -projector.getRotationPitch());
blockInfo = fieldBlocks.get(relativePosition.round());
}
// Search nearby inventories to extract blocks.
for (int dir = 0; dir < 6; dir++)
{
ForgeDirection direction = ForgeDirection.getOrientation(dir);
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(((TileEntity) projector).worldObj, new Vector3((TileEntity) projector), direction);
if (tileEntity instanceof IInventory)
{
IInventory inventory = ((IInventory) tileEntity);
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
ItemStack checkStack = inventory.getStackInSlot(i);
if (checkStack != null)
{
EventStabilize evt = new EventStabilize(world, position.intX(), position.intY(), position.intZ(), checkStack);
MinecraftForge.EVENT_BUS.post(evt);
if (!evt.isCanceled())
{
if (checkStack.getItem() instanceof ItemBlock)
{
if (blockInfo == null || (blockInfo[0] == ((ItemBlock) checkStack.getItem()).getBlockID() && (blockInfo[1] == checkStack.getItemDamage() || projector.getModuleCount(ModularForceFieldSystem.itemModuleApproximation) > 0)) || (projector.getModuleCount(ModularForceFieldSystem.itemModuleApproximation) > 0 && this.isApproximationEqual(blockInfo[0], checkStack)))
{
try
{
if (world.canPlaceEntityOnSide(((ItemBlock) checkStack.getItem()).getBlockID(), position.intX(), position.intY(), position.intZ(), false, 0, null, checkStack))
{
int metadata = blockInfo != null ? blockInfo[1] : (checkStack.getHasSubtypes() ? checkStack.getItemDamage() : 0);
Block block = blockInfo != null ? Block.blocksList[blockInfo[0]] : null;
if (Blacklist.stabilizationBlacklist.contains(block) || block instanceof BlockFluid || block instanceof IFluidBlock)