Search in sources :

Example 11 with PooledMutableBlockPos

use of net.minecraft.util.math.BlockPos.PooledMutableBlockPos in project takumicraft by TNTModders.

the class EntityLapisCreeper method doBlockCollisions.

@Override
protected void doBlockCollisions() {
    AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
    PooledMutableBlockPos blockpos$pooledmutableblockpos = PooledMutableBlockPos.retain(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
    PooledMutableBlockPos blockpos$pooledmutableblockpos1 = PooledMutableBlockPos.retain(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D);
    PooledMutableBlockPos blockpos$pooledmutableblockpos2 = PooledMutableBlockPos.retain();
    if (this.world.isAreaLoaded(blockpos$pooledmutableblockpos, blockpos$pooledmutableblockpos1)) {
        for (int i = blockpos$pooledmutableblockpos.getX(); i <= blockpos$pooledmutableblockpos1.getX(); ++i) {
            for (int j = blockpos$pooledmutableblockpos.getY(); j <= blockpos$pooledmutableblockpos1.getY(); ++j) {
                for (int k = blockpos$pooledmutableblockpos.getZ(); k <= blockpos$pooledmutableblockpos1.getZ(); ++k) {
                    blockpos$pooledmutableblockpos2.setPos(i, j, k);
                    IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos2);
                    try {
                        iblockstate.getBlock().onEntityCollidedWithBlock(this.world, blockpos$pooledmutableblockpos2, iblockstate, this);
                        this.onInsideBlock(iblockstate);
                    } catch (Throwable throwable) {
                        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block");
                        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with");
                        CrashReportCategory.addBlockInfo(crashreportcategory, blockpos$pooledmutableblockpos2, iblockstate);
                        throw new ReportedException(crashreport);
                    }
                }
            }
        }
    }
    blockpos$pooledmutableblockpos.release();
    blockpos$pooledmutableblockpos1.release();
    blockpos$pooledmutableblockpos2.release();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) PooledMutableBlockPos(net.minecraft.util.math.BlockPos.PooledMutableBlockPos) IBlockState(net.minecraft.block.state.IBlockState) CrashReport(net.minecraft.crash.CrashReport) CrashReportCategory(net.minecraft.crash.CrashReportCategory) ReportedException(net.minecraft.util.ReportedException)

Aggregations

PooledMutableBlockPos (net.minecraft.util.math.BlockPos.PooledMutableBlockPos)11 TileEntity (net.minecraft.tileentity.TileEntity)8 EnumFacing (net.minecraft.util.EnumFacing)5 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)4 IEnergyContainer (gregtech.api.capability.IEnergyContainer)2 TileEntityCableEmitter (gregtech.common.blocks.tileentity.TileEntityCableEmitter)2 IBlockState (net.minecraft.block.state.IBlockState)2 BlockPos (net.minecraft.util.math.BlockPos)2 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 BlockFluidPipe (gregtech.common.pipelike.fluidpipe.BlockFluidPipe)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Stack (java.util.Stack)1 CrashReport (net.minecraft.crash.CrashReport)1 CrashReportCategory (net.minecraft.crash.CrashReportCategory)1 ReportedException (net.minecraft.util.ReportedException)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1 World (net.minecraft.world.World)1