Jump to content

[1.13.2] IBlockState with EnumProperty


snowstep115

Recommended Posts

I have a problem to unable to set a property to IBlockState.

 

Here is my code.

public class BlockDock extends Block {
    public static final EnumProperty<EnumContainer> CONTAINER = EnumProperty.<EnumContainer>create("container",
            EnumContainer.class);

    public BlockDock(String name) {
        super(Properties.create(Material.IRON).hardnessAndResistance(1.5F, 1.0F).sound(SoundType.METAL));
        setRegistryName(new ResourceLocation(ContainerMod.MODID, name));
        setDefaultState(getDefaultState().with(CONTAINER, EnumContainer.EMPTY));
    }
}

 

and error...

Caused by: java.lang.IllegalArgumentException: Cannot set property EnumProperty{name=container, clazz=class com.snowstep115.container.util.EnumContainer, values=[EMPTY, QUEUE, STACK]} as it does not exist in Block{minecraft:air}
    at net.minecraft.state.AbstractStateHolder.func_206870_a(SourceFile:106)
    at com.snowstep115.container.block.BlockDock.<init>(BlockDock.java:36)
    at com.snowstep115.container.item.ItemDock.<init>(ItemDock.java:10)
    at com.snowstep115.container.ModItems.<clinit>(ModItems.java:11)
    ... 30 more

 

Would you tell me the correct way to do it.

Thank you.

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