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.

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

Featured Replies

Posted

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

Just guessing, you might need to override

fillStateContainer

and pass that property into the builder

ย 

yeah I think you will need to do this

Edited by poopoodice

  • Author

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

ย 

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

  • Author

Thanks ! The problem is fixed ! But now the block doesn't seem to be able to rotate (or be placed in another direction...)

ย 

Edit: the setblock command can rotate it !

Edited by Elsopeen
Setblock test

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

  • Author

Thanks, I already done that (got the solution from another problem I looked up before).

I'll mark this one as solved, thanks again !

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.