snowstep115 Posted April 21, 2019 Share Posted April 21, 2019 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. Quote Link to comment Share on other sites More sharing options...
snowstep115 Posted April 21, 2019 Author Share Posted April 21, 2019 It works well. Thank you very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.