Jump to content

block break particle has a problem


Spring

Recommended Posts

QQ%E6%88%AA%E5%9B%BE20211215204409.png

 

public class LanternFestivalLanterns extends HorizontalBlock {

    private final static VoxelShape SHAPES_N = Stream.of(
            Block.box(3, 2.5, 3, 13, 13.5, 13),
            Block.box(5.5, 0, 5.5, 10.5, 1, 10.5),
            Block.box(5.5, 15, 5.5, 10.5, 16, 10.5),
            Block.box(4.5, 1, 4.5, 11.5, 1.5, 11.5),
            Block.box(4.5, 14.5, 4.5, 11.5, 15, 11.5),
            Block.box(4, 1.5, 4, 12, 2, 12),
            Block.box(4, 14, 4, 12, 14.5, 12),
            Block.box(3.5, 2, 3.5, 12.5, 2.5, 12.5),
            Block.box(3.5, 13.5, 3.5, 12.5, 14, 12.5)
    ).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();

    private final static VoxelShape SHAPES_W = Stream.of(
            Block.box(3, 2.5, 3, 13, 13.5, 13),
            Block.box(5.5, 0, 5.5, 10.5, 1, 10.5),
            Block.box(5.5, 15, 5.5, 10.5, 16, 10.5),
            Block.box(4.5, 1, 4.5, 11.5, 1.5, 11.5),
            Block.box(4.5, 14.5, 4.5, 11.5, 15, 11.5),
            Block.box(4, 1.5, 4, 12, 2, 12),
            Block.box(4, 14, 4, 12, 14.5, 12),
            Block.box(3.5, 2, 3.5, 12.5, 2.5, 12.5),
            Block.box(3.5, 13.5, 3.5, 12.5, 14, 12.5)
    ).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();

    private final static VoxelShape SHAPES_S = Stream.of(
            Block.box(3, 2.5, 3, 13, 13.5, 13),
            Block.box(5.5, 0, 5.5, 10.5, 1, 10.5),
            Block.box(5.5, 15, 5.5, 10.5, 16, 10.5),
            Block.box(4.5, 1, 4.5, 11.5, 1.5, 11.5),
            Block.box(4.5, 14.5, 4.5, 11.5, 15, 11.5),
            Block.box(4, 1.5, 4, 12, 2, 12),
            Block.box(4, 14, 4, 12, 14.5, 12),
            Block.box(3.5, 2, 3.5, 12.5, 2.5, 12.5),
            Block.box(3.5, 13.5, 3.5, 12.5, 14, 12.5)
    ).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();

    private final static VoxelShape SHAPES_E = Stream.of(
            Block.box(3, 2.5, 3, 13, 13.5, 13),
            Block.box(5.5, 0, 5.5, 10.5, 1, 10.5),
            Block.box(5.5, 15, 5.5, 10.5, 16, 10.5),
            Block.box(4.5, 1, 4.5, 11.5, 1.5, 11.5),
            Block.box(4.5, 14.5, 4.5, 11.5, 15, 11.5),
            Block.box(4, 1.5, 4, 12, 2, 12),
            Block.box(4, 14, 4, 12, 14.5, 12),
            Block.box(3.5, 2, 3.5, 12.5, 2.5, 12.5),
            Block.box(3.5, 13.5, 3.5, 12.5, 14, 12.5)
    ).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();

    public LanternFestivalLanterns() {
        super(Properties.copy(Blocks.LANTERN));
    }

    @Override
    public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) {
        Direction direction = state.getValue(FACING);
        switch (direction) {
            case NORTH:
                return SHAPES_N;
            case SOUTH:
                return SHAPES_S;
            case EAST:
                return SHAPES_E;
            case WEST:
                return SHAPES_W;
            default:
                return SHAPES_N;
        }
    }


    @Override
    public BlockState rotate(BlockState blockState, Rotation rotation) {
        return blockState.setValue(FACING, rotation.rotate(blockState.getValue(FACING)));
    }

    @Override
    public BlockState mirror(BlockState state, Mirror mirror) {
        return state.rotate(mirror.getRotation(state.getValue(FACING)));
    }

    @Override
    protected void createBlockStateDefinition(@Nonnull StateContainer.Builder<Block, BlockState> builder) {
        builder.add(FACING);
    }
}

 

Link to comment
Share on other sites

On 12/15/2021 at 9:13 PM, diesieben07 said:

Show your model JSON.

{
  "credit": "Made with Blockbench",
  "textures": {
    "0": "chinacraft:models/blocks/lantern_festival_lanterns"
  },
  "elements": [
    {
      "from": [5.5, 0, 5.5],
      "to": [10.5, 1, 10.5],
      "faces": {
        "north": {"uv": [0, 0, 5, 5], "texture": "#0"},
        "east": {"uv": [0, 0, 5, 5], "texture": "#0"},
        "south": {"uv": [0, 0, 5, 5], "texture": "#0"},
        "west": {"uv": [0, 0, 5, 5], "texture": "#0"},
        "up": {"uv": [0, 0, 5, 5], "texture": "#0"},
        "down": {"uv": [0, 0, 5, 5], "texture": "#0"}
      }
    },
    {
      "from": [5.5, 15, 5.5],
      "to": [10.5, 16, 10.5],
      "faces": {
        "north": {"uv": [0, 0, 5, 1], "texture": "#0"},
        "east": {"uv": [0, 0, 5, 1], "texture": "#0"},
        "south": {"uv": [0, 0, 5, 1], "texture": "#0"},
        "west": {"uv": [0, 0, 5, 1], "texture": "#0"},
        "up": {"uv": [0, 0, 5, 1], "texture": "#0"},
        "down": {"uv": [0, 0, 5, 1], "texture": "#0"}
      }
    },
    {
      "from": [4.5, 1, 4.5],
      "to": [11.5, 1.5, 11.5],
      "faces": {
        "north": {"uv": [9, 14, 16, 15], "texture": "#0"},
        "east": {"uv": [9, 14, 16, 15], "texture": "#0"},
        "south": {"uv": [9, 14, 16, 15], "texture": "#0"},
        "west": {"uv": [9, 14, 16, 15], "texture": "#0"},
        "up": {"uv": [9, 14, 16, 15], "texture": "#0"},
        "down": {"uv": [9, 14, 16, 15], "texture": "#0"}
      }
    },
    {
      "from": [4.5, 14.5, 4.5],
      "to": [11.5, 15, 11.5],
      "faces": {
        "north": {"uv": [9, 1, 16, 2.5], "texture": "#0"},
        "east": {"uv": [9, 1, 16, 2.5], "texture": "#0"},
        "south": {"uv": [9, 1, 16, 2.5], "texture": "#0"},
        "west": {"uv": [9, 1, 16, 2.5], "texture": "#0"},
        "up": {"uv": [9, 1, 16, 2.5], "texture": "#0"},
        "down": {"uv": [9, 1, 16, 2.5], "texture": "#0"}
      }
    },
    {
      "from": [4, 1.5, 4],
      "to": [12, 2, 12],
      "faces": {
        "north": {"uv": [9, 14, 16, 15.5], "texture": "#0"},
        "east": {"uv": [9, 14, 16, 15.5], "texture": "#0"},
        "south": {"uv": [9, 14, 16, 15.5], "texture": "#0"},
        "west": {"uv": [9, 14, 16, 15.5], "texture": "#0"},
        "up": {"uv": [9, 14, 16, 15.5], "texture": "#0"},
        "down": {"uv": [9, 14, 16, 15.5], "texture": "#0"}
      }
    },
    {
      "from": [4, 14, 4],
      "to": [12, 14.5, 12],
      "faces": {
        "north": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "east": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "south": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "west": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "up": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "down": {"uv": [9, 2, 16, 3.5], "texture": "#0"}
      }
    },
    {
      "from": [3.5, 2, 3.5],
      "to": [12.5, 2.5, 12.5],
      "faces": {
        "north": {"uv": [9, 13, 16, 14.5], "texture": "#0"},
        "east": {"uv": [9, 13, 16, 14.5], "texture": "#0"},
        "south": {"uv": [9, 13, 16, 14.5], "texture": "#0"},
        "west": {"uv": [9, 13, 16, 14.5], "texture": "#0"},
        "up": {"uv": [9, 13, 16, 14.5], "texture": "#0"},
        "down": {"uv": [9, 13, 16, 14.5], "texture": "#0"}
      }
    },
    {
      "from": [3.5, 13.5, 3.5],
      "to": [12.5, 14, 12.5],
      "faces": {
        "north": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "east": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "south": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "west": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "up": {"uv": [9, 2, 16, 3.5], "texture": "#0"},
        "down": {"uv": [9, 2, 16, 3.5], "texture": "#0"}
      }
    },
    {
      "from": [3, 2.5, 3],
      "to": [13, 13.5, 13],
      "faces": {
        "north": {"uv": [9, 2, 16, 14], "texture": "#0"},
        "east": {"uv": [9, 2, 16, 14], "texture": "#0"},
        "south": {"uv": [9, 2, 16, 14], "texture": "#0"},
        "west": {"uv": [9, 2, 16, 14], "texture": "#0"},
        "up": {"uv": [9, 2, 16, 14], "texture": "#0"},
        "down": {"uv": [9, 2, 16, 14], "texture": "#0"}
      }
    }
  ],
  "display": {
    "thirdperson_righthand": {
      "rotation": [71, 0, 0],
      "scale": [0.55, 0.55, 0.55]
    },
    "thirdperson_lefthand": {
      "rotation": [71, 0, 0],
      "scale": [0.55, 0.55, 0.55]
    },
    "firstperson_righthand": {
      "translation": [0, 3.25, 0],
      "scale": [0.55, 0.55, 0.55]
    },
    "firstperson_lefthand": {
      "translation": [0, 3.25, 0],
      "scale": [0.55, 0.55, 0.55]
    },
    "ground": {
      "rotation": [90, 0, 0],
      "translation": [0, -2, 0],
      "scale": [0.49, 0.49, 0.49]
    },
    "gui": {
      "rotation": [30, 30, 0],
      "scale": [0.75, 0.75, 0.75]
    },
    "head": {
      "translation": [0, 14.5, 0]
    }
  }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.