

If you would like to disable the block in the creative tab, use a FeatureFlag when building the contents within CreativeModeTabEvent$BuildContents. There is no limit on the amount of blocks that can be register, so register all blocks in your mod! If you want a block to be disabled through a configuration file, you should disable the crafting recipe.
#Chrome blocks minecraft forge mods#
In the past there have been several mods that have allowed users to disable blocks/items in a configuration file. Block#asItem will return Items#AIR if there is no BlockItem for the Block, so if you are not certain that there is an BlockItem for the Block you are using, check for if Block#asItem returns Items#AIR. Once an BlockItem has been registered for a block, Block#asItem can be used to retrieve it. Custom subclasses of BlockItem may be used as well. To create a basic BlockItem for a block, one should set the registry name of the BlockItem to that of its Block. The block does not automatically have an BlockItem. When a block is registered, only a block is registered. It is therefore impossible to hold it in an inventory as one.) minecraft:water exists a block, but not an item. It’s possible to have a Block without an BlockItem. BlockItem defines some of the behavior of a “block” as an item, like how a right click places the block. BlockItem is a subclass of Item that has a field block that holds a reference to the Block it represents. As a bridge between the different worlds of Block and Item, there exists the class BlockItem. Meanwhile, an item in an inventory is an ItemStack, controlled by an Item. A block in the level is represented by an BlockState, and its behavior defined by an instance of Block. See the Blocks class for examples of this.Ī block in the level and a “block” in an inventory are very different things. For reference, ice has a slipperiness of 0.98.Īll these methods are chainable which means you can call them in series.

Requires a SoundType argument, see the sounds page for more details. sound - Controls the sound the block makes when it is punched, broken, or placed.For reference, stone has a resistance of 6.0, and dirt 0.5. The resistance controls the explosion resistance of the block. If the block should be unbreakable a hardness of -1.0 should be used, see the definition of Blocks#BEDROCK as an example. For reference, stone has a hardness of 1.5, and dirt 0.5. strength - The hardness controls the time it takes to break the block.This BlockBehaviour$Properties object can be made using BlockBehaviour$Properties#of, and it can be customized by calling its methods. You can create a block by instantiating the Block class with a BlockBehaviour$Properties object. Creating a Block Basic Blocksįor simple blocks, which need no special functionality (think cobblestone, wooden planks, etc.), a custom class is not necessary. This page will guide you through the creation of blocks, and some of the things you can do with them. Chances are if you are interested in making a mod, then you will want to add some blocks. They make up all of the terrain, structures, and machines. Blocks are, obviously, essential to the Minecraft world.
