Search in sources :

Example 6 with IPartInfo

use of mcmultipart.api.container.IPartInfo in project LogisticsPipes by RS485.

the class LPMicroblockBlock method addDestroyEffects.

@Override
@SideOnly(Side.CLIENT)
@ModDependentMethod(modId = LPConstants.mcmpModID)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager manager) {
    Pair<Vec3d, Vec3d> vectors = RayTraceHelper.getRayTraceVectors(MCMultiPart.proxy.getPlayer());
    RayTraceResult hit = collisionRayTrace(getDefaultState(), world, pos, vectors.getLeft(), vectors.getRight());
    if (hit != null && hit.subHit >= 0) {
        IPartInfo part = getTile(world, pos).get().get(MCMultiPart.slotRegistry.getValue(hit.subHit)).get();
        if (!part.getPart().addDestroyEffects(part, manager)) {
            IBlockState state = part.getPart().getActualState(part.getPartWorld(), pos, part);
            for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < 4; ++j) {
                    for (int k = 0; k < 4; ++k) {
                        double xOff = (i + 0.5D) / 4.0D;
                        double yOff = (j + 0.5D) / 4.0D;
                        double zOff = (k + 0.5D) / 4.0D;
                        manager.addEffect(new ParticleDigging(world, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, xOff - 0.5D, yOff - 0.5D, zOff - 0.5D, state) {
                        }.setBlockPos(pos));
                    }
                }
            }
        }
        return true;
    }
    return false;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IPartInfo(mcmultipart.api.container.IPartInfo) RayTraceResult(net.minecraft.util.math.RayTraceResult) ParticleDigging(net.minecraft.client.particle.ParticleDigging) Vec3d(net.minecraft.util.math.Vec3d) ModDependentMethod(logisticspipes.asm.ModDependentMethod) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

IPartInfo (mcmultipart.api.container.IPartInfo)6 RayTraceResult (net.minecraft.util.math.RayTraceResult)4 BlockPos (net.minecraft.util.math.BlockPos)3 Vec3d (net.minecraft.util.math.Vec3d)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 ModDependentMethod (logisticspipes.asm.ModDependentMethod)2 IMultipartContainer (mcmultipart.api.container.IMultipartContainer)2 IBlockState (net.minecraft.block.state.IBlockState)2 ParticleDigging (net.minecraft.client.particle.ParticleDigging)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Nullable (javax.annotation.Nullable)1 IMultipart (mcmultipart.api.multipart.IMultipart)1 EnumCenterSlot (mcmultipart.api.slot.EnumCenterSlot)1 EnumFaceSlot (mcmultipart.api.slot.EnumFaceSlot)1 IPartSlot (mcmultipart.api.slot.IPartSlot)1