From 44578ab4acb7f3f3ce82a2a424ffc33cf852c0b1 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 25 Nov 2023 01:27:18 +0000 Subject: [PATCH] Add a proper collision box for the shaping bench --- .../block/cloud/ShapingBenchBlock.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/minelittlepony/unicopia/block/cloud/ShapingBenchBlock.java b/src/main/java/com/minelittlepony/unicopia/block/cloud/ShapingBenchBlock.java index 624836d9..06c47ceb 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/cloud/ShapingBenchBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/cloud/ShapingBenchBlock.java @@ -2,9 +2,12 @@ package com.minelittlepony.unicopia.block.cloud; import org.jetbrains.annotations.Nullable; +import com.minelittlepony.unicopia.EquineContext; import com.minelittlepony.unicopia.container.ShapingBenchScreenHandler; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.screen.NamedScreenHandlerFactory; import net.minecraft.screen.ScreenHandlerContext; @@ -14,13 +17,31 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; import net.minecraft.world.World; public class ShapingBenchBlock extends CloudBlock { + private static final VoxelShape SHAPE = VoxelShapes.union( + Block.createCuboidShape(0, 13, 0, 3, 18, 3), + Block.createCuboidShape(13, 13, 0, 16, 18, 3), + Block.createCuboidShape(0, 13, 13, 3, 18, 16), + Block.createCuboidShape(13, 13, 13, 16, 18, 16), + Block.createCuboidShape(0, 13, 0, 16, 16, 16), + Block.createCuboidShape(2, 0, 2, 14, 17, 14), + Block.createCuboidShape(0, 0, 0, 16, 4, 16) + ); + public ShapingBenchBlock(Settings settings) { super(settings, false); } + @Override + protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, EquineContext equineContext) { + return SHAPE; + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (world.isClient) {