Posted July 14, 20169 yr When I try to spawn a block it throws an error in the console telling the property doesn't exist in the BlockStateContainer java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=soil, clazz=class com.jlgm.projfact.block.BlockOreCluster$EnumType, values=[grass, dirt, stone, gravel, sand]} as it does not exist in BlockStateContainer{block=jlgm_projfact:oreCluster, properties=[]} This is the line I use to spawn it: world.setBlockState(newPos, ProjFactBlock.oreCluster_Block.getDefaultState().withProperty(BlockOreCluster.SOIL, BlockOreCluster.EnumType.GRASS), 2); And this my Block code: public class BlockOreCluster extends Block{ public static final PropertyEnum<BlockOreCluster.EnumType> SOIL = PropertyEnum.<BlockOreCluster.EnumType>create("soil", BlockOreCluster.EnumType.class); public BlockOreCluster(Material materialIn) { super(materialIn); this.setDefaultState(this.blockState.getBaseState().withProperty(SOIL, EnumType.GRASS)); } @Override public IBlockState getStateFromMeta(int meta){ return this.getDefaultState().withProperty(SOIL, EnumType.values()[meta]); } @Override public int getMetaFromState(IBlockState state){ EnumType type = (EnumType) state.getValue(SOIL); return type.getID(); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {SOIL}); } public enum EnumType implements IStringSerializable{ GRASS(0, "grass"), DIRT(1, "dirt"), STONE(2, "stone"), GRAVEL(3, "gravel"), SAND(4, "sand"); private int ID; private String name; private EnumType(int ID, String name){ this.ID = ID; this.name = name; } @Override public String getName() { return name; } @Override public String toString(){ return getName(); } public int getID(){ return ID; } } } Been trying to fix it for two days with no success... Help! :'( Come and say hi at www.twitter.com/JoseluGames
July 14, 20169 yr Author Ok, I'm an idiot, I was initializing the value of the block with the wrong class, I was overthinking the error . Thanks diesieben07!!!! Come and say hi at www.twitter.com/JoseluGames
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.