Changes

Copy Making Blocks to MC1.16 archive
Line 8: Line 8:     
* <code><nowiki>hardnessAndResistance</nowiki></code> - The hardness controls the time it takes to break the block. It is an arbitrary value. For reference, stone has a hardness of 1.5, and dirt 0.5. If the block should be unbreakable a hardness of -1.0 should be used, see the definition of <code><nowiki>Blocks#BEDROCK</nowiki></code> as an example. The resistance controls the explosion resistance of the block. For reference, stone has a resistance of 6.0, and dirt 0.5.
 
* <code><nowiki>hardnessAndResistance</nowiki></code> - The hardness controls the time it takes to break the block. It is an arbitrary value. For reference, stone has a hardness of 1.5, and dirt 0.5. If the block should be unbreakable a hardness of -1.0 should be used, see the definition of <code><nowiki>Blocks#BEDROCK</nowiki></code> as an example. The resistance controls the explosion resistance of the block. For reference, stone has a resistance of 6.0, and dirt 0.5.
* <code><nowiki>sound</nowiki></code> - Controls the sound the block makes when it is punched, broken, or placed. Requires a <code><nowiki>SoundType</nowiki></code> argument, see the [[latest:advanced:effects:sounds|sounds/1.16]] page for more details.
+
* <code><nowiki>sound</nowiki></code> - Controls the sound the block makes when it is punched, broken, or placed. Requires a <code><nowiki>SoundType</nowiki></code> argument, see the [[latest:advanced:effects:sounds/1.16|sounds]] page for more details.
 
* <code><nowiki>setLightLevel</nowiki></code> - Controls the light emission of the block. Takes a function with a ''BlockState'' parameter that returns an integer value from zero to fifteen.
 
* <code><nowiki>setLightLevel</nowiki></code> - Controls the light emission of the block. Takes a function with a ''BlockState'' parameter that returns an integer value from zero to fifteen.
 
* <code><nowiki>slipperiness</nowiki></code> - Controls how slippery the block is. For reference, ice has a slipperiness of 0.98.
 
* <code><nowiki>slipperiness</nowiki></code> - Controls how slippery the block is. For reference, ice has a slipperiness of 0.98.
Line 22: Line 22:  
== Registering a Block ==
 
== Registering a Block ==
   −
Blocks must be [[Registration|registered/1.16]] to function.
+
Blocks must be [[Registration/1.16|registered]] to function.
    
{{Tip/Important|A block in the world and a "block" in an inventory are very different things. A block in the world is represented by an <code><nowiki>BlockState</nowiki></code>, and its behavior defined by an instance of <code><nowiki>Block</nowiki></code>. Meanwhile, an item in an inventory is an <code><nowiki>ItemStack</nowiki></code>, controlled by an <code><nowiki>Item</nowiki></code>. As a bridge between the different worlds of <code><nowiki>Block</nowiki></code> and <code><nowiki>Item</nowiki></code>, there exists the class <code><nowiki>BlockItem</nowiki></code>. <code><nowiki>BlockItem</nowiki></code> is a subclass of <code><nowiki>Item</nowiki></code> that has a field <code><nowiki>block</nowiki></code> that holds a reference to the <code><nowiki>Block</nowiki></code> it represents. <code><nowiki>BlockItem</nowiki></code> defines some of the behavior of a "block" as an item, like how a right click places the block. It's possible to have a <code><nowiki>Block</nowiki></code> without an <code><nowiki>BlockItem</nowiki></code>. (E.g. <code><nowiki>minecraft:water</nowiki></code> exists as a block, but not an item. It is therefore impossible to hold it in an inventory as one.)
 
{{Tip/Important|A block in the world and a "block" in an inventory are very different things. A block in the world is represented by an <code><nowiki>BlockState</nowiki></code>, and its behavior defined by an instance of <code><nowiki>Block</nowiki></code>. Meanwhile, an item in an inventory is an <code><nowiki>ItemStack</nowiki></code>, controlled by an <code><nowiki>Item</nowiki></code>. As a bridge between the different worlds of <code><nowiki>Block</nowiki></code> and <code><nowiki>Item</nowiki></code>, there exists the class <code><nowiki>BlockItem</nowiki></code>. <code><nowiki>BlockItem</nowiki></code> is a subclass of <code><nowiki>Item</nowiki></code> that has a field <code><nowiki>block</nowiki></code> that holds a reference to the <code><nowiki>Block</nowiki></code> it represents. <code><nowiki>BlockItem</nowiki></code> defines some of the behavior of a "block" as an item, like how a right click places the block. It's possible to have a <code><nowiki>Block</nowiki></code> without an <code><nowiki>BlockItem</nowiki></code>. (E.g. <code><nowiki>minecraft:water</nowiki></code> exists as a block, but not an item. It is therefore impossible to hold it in an inventory as one.)
Line 35: Line 35:  
== Further Reading ==
 
== Further Reading ==
   −
For information about block properties, such as those used for vanilla blocks like fences, walls, and many more, see the section on [[Understanding Blockstates|blockstates/1.16]].
+
For information about block properties, such as those used for vanilla blocks like fences, walls, and many more, see the section on [[Understanding Blockstates/1.16|blockstates]].
      −
[[Category:Blocks/1.16]]
+
[[Category:Blocks/1.16|Category:Blocks]]
372

edits