Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved] [1.15.2] Cannot set property DirectionProperty as it does not exist in Block{null}


Elsopeen
 Share

Recommended Posts

Hello,
I followed Cadiboo tutorial that uses Forge Docs, and I'm trying to create an interactible block, but I can't find why I get this property error.

I understand that it comes from the blockState of my InterfaceBlock (extending HorizontalBlock), but I don't know if it comes from the registry method I used or another circumstance.


My github is https://github.com/Elsopeen/LyokoMod-1.15, and I added the stacktrace with the error (which indicated me that it came from my InterfaceBlock).

I hope you can find the problem, and I thank you in advance

stacktrace.log

Edited by Elsopeen
Link to comment
Share on other sites

Well, I added this override but I still have the error. So here's what I added, maybe it's not right :

@Override
    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
        super.fillStateContainer(builder.add(DirectionProperty.create("interface_direction", Direction.Plane.HORIZONTAL)));
    }

 

Link to comment
Share on other sites

1 minute ago, Elsopeen said:

Well, I added this override but I still have the error. So here's what I added, maybe it's not right :


@Override
    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
        super.fillStateContainer(builder.add(DirectionProperty.create("interface_direction", Direction.Plane.HORIZONTAL)));
    }

 

There's no reason calling super, just use the property you already have which is

builder.add(HORIZONTAL_FACING);

 

Edited by poopoodice
Link to comment
Share on other sites

you will need to override some methods such as getStateForPlacement() which provides a blockstate for the blockitem to determine what states does the block have when added, normally something like

return getDefaultState()
                .with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing());

The rotate method you override is probably for structure generation or so.. not so sure.

Edited by poopoodice
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
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.

 Share



×
×
  • Create New...

Important Information

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