codechicken.lib.raytracer.VoxelShapeRayTraceResult

Here are the examples of the java api codechicken.lib.raytracer.VoxelShapeRayTraceResult taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

13 Source : CCRenderEventHandler.java
with GNU Lesser General Public License v2.1
from TheCBProject

@OnlyIn(Dist.CLIENT)
@SubscribeEvent(priority = EventPriority.LOW)
public void onBlockHighlight(DrawHighlightEvent.HighlightBlock event) {
    // We have found a CuboidRayTraceResult, Lets render it properly..
    BlockRayTraceResult hit = event.getTarget();
    if (hit instanceof CuboidRayTraceResult) {
        CuboidRayTraceResult cuboidHit = (CuboidRayTraceResult) hit;
        event.setCanceled(true);
        Matrix4 mat = new Matrix4(event.getMatrix());
        mat.translate(cuboidHit.getPos());
        RenderUtils.bufferHitbox(mat, event.getBuffers(), event.getInfo(), cuboidHit.cuboid6);
    } else if (hit instanceof VoxelShapeRayTraceResult) {
        VoxelShapeRayTraceResult voxelHit = (VoxelShapeRayTraceResult) hit;
        event.setCanceled(true);
        Matrix4 mat = new Matrix4(event.getMatrix());
        mat.translate(voxelHit.getPos());
        RenderUtils.bufferShapeHitBox(mat, event.getBuffers(), event.getInfo(), voxelHit.shape);
    }
}