Posted July 9, 20187 yr I'm trying to register an ItemBlock for my custom block. It's just not appearing in the creative tab for whatever reason or from what I can tell in the game at all. All other items register fine, just not the ItemBlock. PS: I'm coding in Scala @SubscribeEvent def registerItems(e: RegistryEvent.Register[Item]): Unit = { e.getRegistry.registerAll(ItemHempBud, ItemHempSeed, ItemHempBioManipulator) } object BlockHempBioManipulator extends BlockContainer(Material.IRON) { var PROP_TOP: IProperty[java.lang.Integer] = _ setRegistryName(DrugMod.modid, "hemp_bio_manipulator") setUnlocalizedName(DrugMod.modid + ":hemp_bio_manipulator") setDefaultState(this.blockState.getBaseState.withProperty(PROP_TOP, 0: java.lang.Integer)) override def createNewTileEntity(worldIn: World, meta: Int): TileEntity = new TileEntityHempBioManipulator override def getRenderType(state: IBlockState): EnumBlockRenderType = EnumBlockRenderType.MODEL override def getStateFromMeta(meta: Int): IBlockState = getDefaultState.withProperty(PROP_TOP, meta: java.lang.Integer) override def getMetaFromState(state: IBlockState): Int = state.getValue(PROP_TOP) override def createBlockState(): BlockStateContainer = { PROP_TOP = PropertyInteger.create("top", 0, 1) new BlockStateContainer(this, PROP_TOP) } override def onBlockActivated(worldIn: World, pos: BlockPos, state: IBlockState, playerIn: EntityPlayer, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean = { if (!worldIn.isRemote) playerIn.openGui(DrugMod, GuiHandler.GUI_HEMP_BIO_MANIPULATOR, worldIn, pos.getX, pos.getY, pos.getZ) super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ) } } object HempBioManipulatorStateMapper extends StateMapperBase { override def getModelResourceLocation(state: IBlockState): ModelResourceLocation = new ModelResourceLocation(state.getBlock.getRegistryName, "top=" + state.getValue(BlockHempBioManipulator.PROP_TOP)) } object ItemHempBioManipulator extends ItemBlock(BlockHempBioManipulator) { setRegistryName(DrugMod.modid, "hemp_bio_manipulator") setUnlocalizedName(DrugMod.modid + ":hemp_bio_manipulator") setCreativeTab(CreativeTabs.BREWING) } EDIT: So it is registering, just not in the creative tabs at all. Edited July 9, 20187 yr by cmchenry
July 9, 20187 yr Author Okay so I figured it out. Ends up that the creative tab you set for the ItemBlock correlates to what you set in the block. No need to even set it inside the ItemBlock.
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.