Started by
ThrillerGriller
on
Topic category: Help with Minecraft modding (Java Edition)
I've created a carpet block. The problem I'm having is when I break the block under it, it doesn't break like a normal carpet would. Instead, it just floats like if it was a block of stone or wood.
I think here are the properties:
public class LeafPileBlock extends Block { public LeafPileBlock() { super(BlockBehaviour.Properties.of(Material.CLOTH_DECORATION).sound(SoundType.MOSS_CARPET).strength(0.1f).noOcclusion() .isRedstoneConductor((bs, br, bp) -> false)); } @Override public boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter world, BlockPos pos, FluidState fluidstate) { return true; } @Override public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { return true; } @Override public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) { return 0; } @Override public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { Vec3 offset = state.getOffset(world, pos); return box(0, 0, 0, 16, 1, 16) .move(offset.x, offset.y, offset.z); } @Override public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { return 60; } @Override public PushReaction getPistonPushReaction(BlockState state) { return PushReaction.DESTROY; } @OnlyIn(Dist.CLIENT) public static void registerRenderLayer() { ItemBlockRenderTypes.setRenderLayer(GamemodModBlocks.LEAF_PILE.get(), renderType -> renderType == RenderType.cutout()); } } |
I accidently posted this on the datapacks section, would be great if someone could tell me how to delete it if you can.
Put this in the tick update trigger of the block
🟦=> air
if [is {get block at x y-1 z} material type (air)
remove block at x y z
Explanation:
checks if block below (x y-1 z) it is of material type air then it'll break itself (which is the block at x y z its own relative positions)
interesting block idea tho