Jump to content

[1.12] Custom double_slab being handled as a half_slab??


Recommended Posts

Posted (edited)

So, I've implemented sideways-slabs, and I'm trying to add a outer/inner corner effect on them, just like stairs have.
I'm having a few problems with collisionBoxes, but that's beside the point for now.

Now, my problem:
For some reason, I get this error, when placing a sideways-double-slab:

java.lang.IllegalArgumentException:
Cannot get property PropertyEnum{name=position, clazz=class com.bte.mod.block.BlockSlabVerticalBase$EnumPosition, values=[north, south, east, west]} as it does not exist in BlockStateContainer{block=bte:smoothstone_vertical_doubleslab, properties=[]}
	at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204)
	at com.bte.mod.block.BlockSlabVerticalBase.getPaneShape(BlockSlabVerticalBase.java:134)
	at com.bte.mod.block.BlockSlabVerticalBase.getActualState(BlockSlabVerticalBase.java:122)

 

Which makes NO sense, since this is what the code looks like in BlockSlabVerticalBase.getActualState():
 

public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        if(isDouble())
        {
            return state;
        }
        else
        {
            return state.withProperty(SHAPE, getPaneShape(state, worldIn, pos));
        }
    }


For some reason, the instance of bte:smoothstone_vertical_doubleslab seems to return isDouble() as false, even though it's class has:

    @Override
    public boolean isDouble() {
        return true;
    }


I'm going insane trying to figure out why this is happening...
All my code is available on https://github.com/44tim44/BetterThanElectricity in case you want to check on anything.

Any help at all would be tremendously appreciated!

Edited by 44tim44
Updated link to new repo
Posted
18 hours ago, diesieben07 said:

The issue are these lines. isBlockPane will return true for any pane block, even double ones. But then you assume they have a POSITION property, which is not true for double ones.


That fixed it! 
I changed is BlockPane to this and now it works!

public static boolean isBlockPane(IBlockState state)
    {
        return state.getBlock() instanceof BlockSlabVerticalBase && !((BlockSlabVerticalBase) state.getBlock()).isDouble();
    }

 

But since I've already started this thread I'm gonna hijack it and ask for help with the collision boxes too.

The Vertical Slabs don't have the correct collision boxes.
Even though I am overriding

addCollisionBoxToList

the Vertical Slabs still have "full block" collision boxes.
And I have no idea why.

Github is up to date.

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.