Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
    }
}

ย 

  • Author
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]
    }
  }
}

ย 

  • Author
23 minutes ago, Luis_ST said:

you never set the particle in your model

Yes i found out, he works fine now

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.