net.minecraft.util.shape.VoxelShapes Java Examples

The following examples show how to use net.minecraft.util.shape.VoxelShapes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractBlockStateMixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Inject(at = {@At("HEAD")},
	method = {
		"getOutlineShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"},
	cancellable = true)
private void onGetOutlineShape(BlockView view, BlockPos pos,
	ShapeContext context, CallbackInfoReturnable<VoxelShape> cir)
{
	if(context == ShapeContext.absent())
		return;
	
	HackList hax = WurstClient.INSTANCE.getHax();
	if(hax == null)
		return;
	
	HandNoClipHack handNoClipHack = hax.handNoClipHack;
	if(!handNoClipHack.isEnabled() || handNoClipHack.isBlockInList(pos))
		return;
	
	cir.setReturnValue(VoxelShapes.empty());
}
 
Example #2
Source File: FluidPipeBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, ShapeContext context) {
    ArrayList<VoxelShape> shapes = new ArrayList<>();

    if (blockState.get(ATTACHED_NORTH)) {
        shapes.add(NORTH);
    }
    if (blockState.get(ATTACHED_SOUTH)) {
        shapes.add(SOUTH);
    }
    if (blockState.get(ATTACHED_EAST)) {
        shapes.add(EAST);
    }
    if (blockState.get(ATTACHED_WEST)) {
        shapes.add(WEST);
    }
    if (blockState.get(ATTACHED_UP)) {
        shapes.add(UP);
    }
    if (blockState.get(ATTACHED_DOWN)) {
        shapes.add(DOWN);
    }
    if (shapes.isEmpty()) {
        return NONE;
    } else {
        return VoxelShapes.union(NONE, shapes.toArray(new VoxelShape[0]));
    }
}
 
Example #3
Source File: AluminumWireBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, ShapeContext context) {
    ArrayList<VoxelShape> shapes = new ArrayList<>();

    if (blockState.get(ATTACHED_NORTH)) {
        shapes.add(NORTH);
    }
    if (blockState.get(ATTACHED_SOUTH)) {
        shapes.add(SOUTH);
    }
    if (blockState.get(ATTACHED_EAST)) {
        shapes.add(EAST);
    }
    if (blockState.get(ATTACHED_WEST)) {
        shapes.add(WEST);
    }
    if (blockState.get(ATTACHED_UP)) {
        shapes.add(UP);
    }
    if (blockState.get(ATTACHED_DOWN)) {
        shapes.add(DOWN);
    }
    if (shapes.isEmpty()) {
        return NONE;
    } else {
        return VoxelShapes.union(NONE, shapes.toArray(new VoxelShape[0]));
    }
}
 
Example #4
Source File: Walkway.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
private static VoxelShape createShape(boolean north, boolean south, boolean east, boolean west) {
    VoxelShape top1 = Block.createCuboidShape(0.0D, 13.0D, 0.0D, 2.0D, 16.0D, 16.0D);
    VoxelShape top2 = Block.createCuboidShape(0.0D, 13.0D, 16.0D, 16.0D, 16.0D, 14.0D);
    VoxelShape top3 = Block.createCuboidShape(16.0D, 13.0D, 16.0D, 14.0D, 16.0D, 0.0D);
    VoxelShape top4 = Block.createCuboidShape(16.0D, 13.0D, 0.0D, 0.0D, 16.0D, 2.0D);
    VoxelShape mTop1 = Block.createCuboidShape(6.0D, 15.0D, 2.0D, 16.0D - 6.0D, 14.0D, 16.0D - 2.0D);
    VoxelShape mTop2 = Block.createCuboidShape(2.0D, 15.0D, 6.0D, 16.0D - 2.0D, 14.0D, 16.0D - 6.0D);
    VoxelShape center = Block.createCuboidShape(6.0D, 15.0D, 6.0D, 10.0D, 6.0D, 10.0);
    VoxelShape base = VoxelShapes.union(top1, top2, top3, top4, mTop1, mTop2, center);

    if (north) {
        base = VoxelShapes.union(base, Block.createCuboidShape(7.0D, 9.0D, 7.0D, 9.0D, 7.0D, 0.0D));
    }

    if (south) {
        base = VoxelShapes.union(base, Block.createCuboidShape(7.0D, 9.0D, 9.0D, 9.0D, 7.0D, 16.0D));
    }

    if (east) {
        base = VoxelShapes.union(base, Block.createCuboidShape(9.0D, 9.0D, 7.0D, 16.0D, 7.0D, 9.0D));
    }

    if (west) {
        base = VoxelShapes.union(base, Block.createCuboidShape(7.0D, 9.0D, 7.0D, 0.0D, 7.0D, 9.0D));
    }

    return VoxelShapes.union(base);
}
 
Example #5
Source File: FluidBlockMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public VoxelShape getCollisionShape(BlockState blockState_1,
	BlockView blockView_1, BlockPos blockPos_1,
	ShapeContext entityContext_1)
{
	HackList hax = WurstClient.INSTANCE.getHax();
	if(hax != null && hax.jesusHack.shouldBeSolid())
		return VoxelShapes.fullCube();
	
	return super.getCollisionShape(blockState_1, blockView_1, blockPos_1,
		entityContext_1);
}
 
Example #6
Source File: WitchWaterBubbleColumnBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) {
	return VoxelShapes.empty();
}
 
Example #7
Source File: AntiCactusHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCactusCollisionShape(CactusCollisionShapeEvent event)
{
	event.setCollisionShape(VoxelShapes.fullCube());
}