Jump to content

Recommended Posts

Posted

How can I get from blockstate half?
I'm already geting facing and I can't take half.

 

 @Override
    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
   {

            switch (state.get(FACING)) {
                case SOUTH:
                    return SHAPE_S;
                case WEST:
                    return SHAPE_W;
                case EAST:
                    return SHAPE_E;
                case NORTH:
                    return SHAPE_N;

                default:
                    return SHAPE_N;
            }

    }

 

Posted

What are you trying to create?

Some tips:

  Reveal hidden contents

 

Posted

I create something like stairs but i create my own figure in blockbench and i try to put this in top/bottom position.And i dont now how to get value of half

Posted

Please post your code (the entire class).

I don’t think you need anything “half” in stairs.

Some tips:

  Reveal hidden contents

 

Posted
public class SlateTrigonousBlock extends Block{

    public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;

    private static final VoxelShape SHAPE_N = Stream.of(
            Block.makeCuboidShape(0, 0, 0, 16, 1, 16),
            Block.makeCuboidShape(0, 1, 1, 16, 2, 16),
            Block.makeCuboidShape(0, 2, 2, 16, 3, 16),
            Block.makeCuboidShape(0, 3, 3, 16, 4, 16),
            Block.makeCuboidShape(0, 4, 4, 16, 5, 16),
            Block.makeCuboidShape(0, 5, 5, 16, 6, 16),
            Block.makeCuboidShape(0, 6, 6, 16, 7, 16),
            Block.makeCuboidShape(0, 7, 7, 16, 8, 16),
            Block.makeCuboidShape(0, 8, 8, 16, 9, 16),
            Block.makeCuboidShape(0, 0, 0, 1, 1, 1),
            Block.makeCuboidShape(0, 9, 9, 16, 10, 16),
            Block.makeCuboidShape(0, 10, 10, 16, 11, 16),
            Block.makeCuboidShape(0, 11, 11, 16, 12, 16),
            Block.makeCuboidShape(0, 12, 12, 16, 13, 16),
            Block.makeCuboidShape(0, 13, 13, 16, 14, 16),
            Block.makeCuboidShape(0, 14, 14, 16, 15, 16),
            Block.makeCuboidShape(0, 15, 15, 16, 16, 16)
    ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get();

    public static final VoxelShape SHAPE_W = Stream.of(
            Block.makeCuboidShape(0, 0, 0, 16, 1, 16),
            Block.makeCuboidShape(1, 1, 0, 16, 2, 16),
            Block.makeCuboidShape(2, 2, 0, 16, 3, 16),
            Block.makeCuboidShape(3, 3, 0, 16, 4, 16),
            Block.makeCuboidShape(4, 4, 0, 16, 5, 16),
            Block.makeCuboidShape(5, 5, 0, 16, 6, 16),
            Block.makeCuboidShape(6, 6, 0, 16, 7, 16),
            Block.makeCuboidShape(7, 7, 0, 16, 8, 16),
            Block.makeCuboidShape(8, 8, 0, 16, 9, 16),
            Block.makeCuboidShape(0, 0, 15, 1, 1, 16),
            Block.makeCuboidShape(9, 9, 0, 16, 10, 16),
            Block.makeCuboidShape(10, 10, 0, 16, 11, 16),
            Block.makeCuboidShape(11, 11, 0, 16, 12, 16),
            Block.makeCuboidShape(12, 12, 0, 16, 13, 16),
            Block.makeCuboidShape(13, 13, 0, 16, 14, 16),
            Block.makeCuboidShape(14, 14, 0, 16, 15, 16),
            Block.makeCuboidShape(15, 15, 0, 16, 16, 16)
    ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get();

        public static final VoxelShape SHAPE_S = Stream.of(
                Block.makeCuboidShape(0, 0, 0, 16, 1, 16),
                Block.makeCuboidShape(0, 1, 0, 16, 2, 15),
                Block.makeCuboidShape(0, 2, 0, 16, 3, 14),
                Block.makeCuboidShape(0, 3, 0, 16, 4, 13),
                Block.makeCuboidShape(0, 4, 0, 16, 5, 12),
                Block.makeCuboidShape(0, 5, 0, 16, 6, 11),
                Block.makeCuboidShape(0, 6, 0, 16, 7, 10),
                Block.makeCuboidShape(0, 7, 0, 16, 8, 9),
                Block.makeCuboidShape(0, 8, 0, 16, 9, 8),
                Block.makeCuboidShape(15, 0, 15, 16, 1, 16),
                Block.makeCuboidShape(0, 9, 0, 16, 10, 7),
                Block.makeCuboidShape(0, 10, 0, 16, 11, 6),
                Block.makeCuboidShape(0, 11, 0, 16, 12, 5),
                Block.makeCuboidShape(0, 12, 0, 16, 13, 4),
                Block.makeCuboidShape(0, 13, 0, 16, 14, 3),
                Block.makeCuboidShape(0, 14, 0, 16, 15, 2),
                Block.makeCuboidShape(0, 15, 0, 16, 16, 1)
        ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get();

        public static final VoxelShape SHAPE_E = Stream.of(
                Block.makeCuboidShape(0, 0, 0, 16, 1, 16),
                Block.makeCuboidShape(0, 1, 0, 15, 2, 16),
                Block.makeCuboidShape(0, 2, 0, 14, 3, 16),
                Block.makeCuboidShape(0, 3, 0, 13, 4, 16),
                Block.makeCuboidShape(0, 4, 0, 12, 5, 16),
                Block.makeCuboidShape(0, 5, 0, 11, 6, 16),
                Block.makeCuboidShape(0, 6, 0, 10, 7, 16),
                Block.makeCuboidShape(0, 7, 0, 9, 8, 16),
                Block.makeCuboidShape(0, 8, 0, 8, 9, 16),
                Block.makeCuboidShape(15, 0, 0, 16, 1, 1),
                Block.makeCuboidShape(0, 9, 0, 7, 10, 16),
                Block.makeCuboidShape(0, 10, 0, 6, 11, 16),
                Block.makeCuboidShape(0, 11, 0, 5, 12, 16),
                Block.makeCuboidShape(0, 12, 0, 4, 13, 16),
                Block.makeCuboidShape(0, 13, 0, 3, 14, 16),
                Block.makeCuboidShape(0, 14, 0, 2, 15, 16),
                Block.makeCuboidShape(0, 15, 0, 1, 16, 16)
        ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get();

    public SlateTrigonousBlock()
    {
        super(Block.Properties.create(Material.ROCK)
            .hardnessAndResistance(2.5f, 10.0f)
            .harvestLevel(0)
            .harvestTool(ToolType.PICKAXE)
            .sound(SoundType.STONE)

        );

        this.setDefaultState(this.getStateContainer().getBaseState().with(FACING, Direction.NORTH));
    }

   @Override
    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
   {

            switch (state.get(FACING)) {
                case SOUTH:
                    return SHAPE_S;
                case WEST:
                    return SHAPE_W;
                case EAST:
                    return SHAPE_E;
                case NORTH:
                    return SHAPE_N;

                default:
                    return SHAPE_N;
            }

    }

    @Override
    public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos)
    {
        return false;
    }

    @Override
    public BlockState getStateForPlacement(BlockItemUseContext context)
    {
        return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
    }

    @Override
    public BlockState rotate(BlockState state, Rotation rot)
    {
        return state.with(FACING, rot.rotate(state.get(FACING)));
    }

    @Override
    public BlockState mirror(BlockState state, Mirror mirrorIn)
    {
        return state.rotate(mirrorIn.toRotation(state.get(FACING)));
    }

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

 

This my code, i use VoxelShape to create my figure.

Posted

 

  On 7/4/2020 at 2:29 PM, ppitu said:

builder.add(FACING);

Expand  

Your block does not have a HALF property.

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

As far as I can tell, you want to have a slab thats not symmetrical(rotation/facing).

So you need at least two properties, one of which being a facing property.

For further information, you can always look into the vanilla class(in 1.16.1: "SlabBlock.java")

Hope I could help you.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
    • Please read the FAQ (link is orange banner at top of page), and post logs as described there, to an external site such as https://mclo.gs  
  • Topics

×
×
  • Create New...

Important Information

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