Jump to content

Recommended Posts

Posted

Hi, I have a problem with my mod, I created a custom property for my block and it is not recognized by the game. I'm attaching the class of my block as well as the piece of log with the error. Thanks in advance for the help !

Spoiler

[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=east, smelting=false': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=south, smelting=false': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=west, smelting=true': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=south, smelting=true': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=east, smelting=true': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=west, smelting=false': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=north, smelting=false': Unknown blockstate property: ' smelting'
[22:15:20] [Worker-Main-5/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'biodepths:blockstates/organic_furnace.json' in resourcepack: 'Mod Resources' for variant: 'facing=north, smelting=true': Unknown blockstate property: ' smelting'

Spoiler
public class OrganicFurnace extends BlockCore
{
    public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;
    public static final BooleanProperty SMELTING = BooleanProperty.create("smelting");

    public OrganicFurnace(Material material, int harvestLevel, ToolType toolType, float strength, boolean requiresTool)
    {
        super(material, harvestLevel, toolType, strength, requiresTool);
        this.setDefaultState(this.getDefaultState().with(FACING, Direction.NORTH).with(SMELTING, Boolean.FALSE));
    }

    @Nonnull
    @Override
    @SuppressWarnings("deprecation")
    @ParametersAreNonnullByDefault
    public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos,
                                             PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
        if(!worldIn.isRemote())
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);

            if(tileEntity instanceof OrganicFurnaceTile)
            {
                INamedContainerProvider containerProvider = createContainerProvider(worldIn, pos);
                NetworkHooks.openGui(((ServerPlayerEntity)player), containerProvider, tileEntity.getPos());
            }
            else
            {
                throw new IllegalStateException("Our Container provider is missing!");
            }
        }
        return ActionResultType.SUCCESS;
    }

    private INamedContainerProvider createContainerProvider(World worldIn, BlockPos pos)
    {
        return new INamedContainerProvider()
        {
            @Nonnull
            @Override
            public ITextComponent getDisplayName()
            {
                return new TranslationTextComponent("screen.biodepths.organic_furnace");
            }

            @Override
            @ParametersAreNonnullByDefault
            public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity playerEntity)
            {
                return new OrganicFurnaceContainer(i, worldIn, pos, playerInventory, playerEntity);
            }
        };
    }

    @Override
    public TileEntity createTileEntity(BlockState state, IBlockReader world)
    {
        return InitElements.InitTileEntities.ORGANIC_FURNACE_TILE.getObj().getB().create();
    }

    @Override
    public boolean hasTileEntity(BlockState state)
    {
        return true;
    }

    @Nullable
    @Override
    @ParametersAreNonnullByDefault
    public BlockState getStateForPlacement(BlockItemUseContext context)
    {
        return this.getDefaultState()
                .with(FACING, context.getPlacementHorizontalFacing().getOpposite())
                .with(SMELTING, Boolean.FALSE);
    }

    @Override
    @ParametersAreNonnullByDefault
    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
    {
        super.fillStateContainer(builder);
        builder.add(FACING, SMELTING);
    }
}

 

 

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.