Search in sources :

Example 6 with CuboidRayTraceResult

use of codechicken.lib.raytracer.CuboidRayTraceResult in project GregTech by GregTechCE.

the class BlockPipe method getPickBlock.

@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
    IPipeTile<PipeType, NodeDataType> pipeTile = getPipeTileEntity(world, pos);
    if (pipeTile == null) {
        return ItemStack.EMPTY;
    }
    if (target instanceof CuboidRayTraceResult) {
        CuboidRayTraceResult result = (CuboidRayTraceResult) target;
        if (result.cuboid6.data instanceof CoverSideData) {
            EnumFacing coverSide = ((CoverSideData) result.cuboid6.data).side;
            CoverBehavior coverBehavior = pipeTile.getCoverableImplementation().getCoverAtSide(coverSide);
            return coverBehavior == null ? ItemStack.EMPTY : coverBehavior.getPickItem();
        }
    }
    return getDropItem(pipeTile);
}
Also used : CuboidRayTraceResult(codechicken.lib.raytracer.CuboidRayTraceResult) CoverSideData(gregtech.api.cover.ICoverable.CoverSideData) CoverBehavior(gregtech.api.cover.CoverBehavior)

Aggregations

CuboidRayTraceResult (codechicken.lib.raytracer.CuboidRayTraceResult)6 CoverBehavior (gregtech.api.cover.CoverBehavior)2 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)2 ItemStack (net.minecraft.item.ItemStack)2 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 Vector3 (codechicken.lib.vec.Vector3)1 IScrewdriverItem (gregtech.api.capability.tool.IScrewdriverItem)1 IWrenchItem (gregtech.api.capability.tool.IWrenchItem)1 CoverSideData (gregtech.api.cover.ICoverable.CoverSideData)1 WorldSceneRenderer (gregtech.api.render.scene.WorldSceneRenderer)1 IBlockState (net.minecraft.block.state.IBlockState)1 GuiButton (net.minecraft.client.gui.GuiButton)1 BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1