Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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);
    }
}

 

 

  • Author

What does that mean? I don't quite understand, could you explain? I have created a smelting property in my block.

  • Author

Oh thank you so much ! It works, I had put an extra space

Edited by Olegueyan

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.