-
Notifications
You must be signed in to change notification settings - Fork 14
Blocks
Some attributes are used by all types of blocks:
{
"id" : "myblock",
"material" : "ground",
"itemModel" : "mymod:myitemmodel",
"creativeTab" : "redstone",
"hardness" : 2.5,
"resistance" : 5.5,
"soundType" : "metal",
"maxStack" : 16,
"opacity" : 128,
"light" : 7,
"flammability" : 50,
"fireSpreadSpeed" : 10,
"isFireSource" : false,
"isWood" : false,
"canSustainLeaves" : false,
"isBeaconBase" : false,
"enchantPowerBonus" : 1.5,
"expDrop" : [0, 1],
"information" : [ "First line", "Second line"],
"tileEntity": "mymod:mytileentity",
"gui": "mymod:mygui",
"drop": ["minecraft:dirt", {"item" : "minecraft:stone", "amount": [1,4] } ],
"isFullCube": false,
"isOpaqueCube": false,
"isBurning": false,
"bounds": { "cube": 0.5, "offset": [0.25, 0.25, 0.25] },
"slectionBounds": { "cube": 1 },
"collisionBounds": { "cube": 0.5, "offset": [0.25, 0.25, 0.25] },
"tint": "foliage",
"itemTint": "foliageBasic",
"renderLayer": "solid",
"canSilkHarvest": false,
"harvestTool": "axe",
"harvestLevel": 3,
"canPlaceOnCeiling": true,
"canPlaceOnFloor": true,
"canPlaceOnSides": true,
"sustainedPlants": "Crop",
"burnTime": 100,
"slipperiness": 0.6,
"pathNodeType": "blocked",
"isWeb": true
}
-
id: This is the unique id of the block. This is used to reference the block in recipes or in the lang file. This has to be all lowercase and must not contain spaces. It only has to be unique in your mod. If your mod id is mymod and the item id is myblock, you reference the item with mymod:block. The block state files is then located in assets/mymod/blockstates/myblock.json. If the block has an item associated with it as most blocks do, that item has the same id.
-
material: This is the material of the block. The material defines different default properties for the block such as if it is translucent or if it requires a tool to mine. The default value is ground. A list of available materials can be found here.
-
itemModel: This defines the model file that is being used for the item of the block. In the example above the file is located in assets/mymod/models/item/myitemmodel.json or assets/mymod/blockstates/myitemmodel.json. You can also use the model of another mod or minecraft itself. Supports metadata subtypes. Default value is "[modid:blockid]".
-
creativeTab: This defines the creative tab that the item of the block appears in. Omit to make it not appear in any tab. Supports metadata subtypes. A list of available creative tabs can be found here.
-
hardness: This defines how long it takes to break the block. Supports metadata subtypes. The default value is 1.0.
-
resistance: This defines the resistance against explosions. Supports metadata subtypes. The default value is 0.0.
-
soundType: This defines the sound that is being played when the block is being walked on, breaked or placed. Supports metadata subtypes. The default value is stone. A list of available sound types can be found here.
-
maxStack: This defines the maximum number of items in one stack. This has to be between 1 and 64. Supports metadata subtypes. The default value is 64.
-
opacity: This defines the light opacity. This has to between 0 and 255 where 0 means all light goes through the block and 255 means none does. Supports metadata subtypes. The default value is 255.
-
light: This defines how much light the block is emitting. This has to be between 0 and 15, where 0 means no light and 15 means as much light as possible. Supports metadata subtypes. The default value is 0.
-
flammability: This defines the chance that fire will spread and consume the block. This has to be between 0 and 100, where 0 is 0% chance and 100 a 100% chance. Supports metadata subtypes. The default value is 0.
-
fireSpreadSpeed: This defines how fast fire will spread around the block. Higher values mean higher speed. Supports metadata subtypes. The default value is 0.
-
isFireSource: This defines whether fire indefinitely burns on the block. Supports metadata subtypes. The default value is false.
-
isWood: This defines whether the block is wood. Supports metadata subtypes. The default value is false.
-
canSustainLeaves: This defines whether leaves decay near the block. Supports metadata subtypes. The default value is false.
-
isBeaconBase: This defines whether the block can be used as a base for the beacon. Supports metadata subtypes. The default value is false.
-
enchantPowerBonus: This defines the amount of enchanting power this block can provide to an enchanting table. Supports metadata subtypes. The default value is 0.0.
-
expDrop: This defines the amount of exp dropped when breaking the block. You can define it like this:
5
or like this:[1, 5]
. The first one will always drop 5 exp, the second one drops a random amount between 1 and 5. Supports metadata subtypes. The default value is 0. -
information: This defines additional lines of information below the name of the item in the inventory. Supports metadata subtypes.
-
tileEntity: This is a ResourceLocation defining what tile entity the block is using. Use the id of the tile entity together with the mod id. Supports metadata subtypes. Default is no tile entity.
-
gui: This is a ResourceLocation defining what gui is being opened when right-clicking the block. Use the id of the gui together with the mod id. Supports metadata subtypes. Default is no gui.
-
drop: This is either one or multiple BlockDrop. To make the block not drop anything use
minecraft:air
. If omitted, the block will just drop itself. Supports metadata subtypes. -
isFullCube: Defines whether this block is a full cube. If false, connected sides of neighbouring blocks will be rendered. Supports metadata subtypes.
-
isOpaqueCube: Defines whether this block is opaque. If the block is not a full cube or has transparent textures, this should be set to false. Supports metadata subtypes.
-
isBurning: Defines whether this block should set entities on fire when they get in contact with the block. Note that the collision bounding box needs to be slightly smaller than a full cube for this to work. Supports metadata subtypes.
-
bounds: This is a BoundingBox. Defines the bounding box of the block. This box is used to check if you mouse over the block. If not specified aswell, this will also set the selection and collision bounding box. Supports metadata subtypes.
-
selectionBounds: This is a BoundingBox. Defines the highlighted wireframe box that is shown when you mouse over the block. Supports metadata subtypes.
-
collisionBounds: This is a BoundingBox. Defines the box that entities actually collide with. Supports metadata subtypes.
-
tint: Defines the tint that is applied to the block in the world. These is either a color or one of foliage, grass or water which will tint the block depending on the biome. Supports metadata subtypes.
-
itemTint: Defines the tint of item associated with the block. This is a color. Supports metadata subtypes.
-
renderLayer: This defines block render layer and should depend on the texture of the block. If the texture has no transparent parts use
solid
or omit it. If it has transparent parts use eithercutout
ormippedCutout
where ther latter will make the texture to be mip-mapped. If the texture has semi-transparent parts usetranslucent
. -
canSilkHarvest: Defines whether the block can be silk harvested. Default value is true. Supports metadata subtypes.
-
harvestTool, harvestLevel: Defines the tool and level that is required to effectively harvest the block. Note that if the block's material is iron or rock it will always be harvestable by pickaxes. Support metadata subtypes.
-
sustainedPlants: Defines what plants are sustained by the block. You can use one or multiple of: Plains, Desert, Beach, Cave, Water, Nether, Crop. Supports metadata subtypes.
-
canPlaceOnFloor, canPlaceOnCeiling, canPlaceOnSides: Defines whether the block can placed into the world by clicking the top, bottom or horizontal sides of another block.
-
burnTime: Defines the number of ticks that the block provides fuel for a furnace. -1 lets the furnace decide on this, for example if the block's material is wood. Supports metadata subtypes. Default value is -1.
-
slipperiness: Defines how much velocity is maintained while moving on top of the block. Supports metadata subtypes. Default value is 0.6.
-
pathNodeType: Defines how mobs see the block when pathfinding. Valid values: blocked, open, walkable, trapdoor, fence, lava, water, rail, dangerFire, damageFire, dangerCactus, damageCactus, dangerOther, damageOther, doorOpen, doorWoodClosed, doorIronClosed. Omitting this will use the block's default. Supports metadata subtypes.
-
isWeb: If set to true, the block will make entities move very slowly while inside the block just like the regular web block. Supports metadata subtypes. Default value if false.
Some block types support metadata subtypes. That means the block can have different models, names or other things depending on their metadata value.
If a block type supports metadata subtypes, you can enable it by providing the subtypes attribute:
{
"subtypes" : [ 0, 1, 5 ]
}
This will make the item have subtypes for metadata values 0, 1 and 5. You should always have a 0 in their. Depending on the type of the block, you can use up to 16 subtypes (0 to 15).
You can now define attribute values for each of those metadata values provided that the attribute is supporting it:
{
"itemModel" : {
"0" : "mymod:myitem_0",
"1" : "mymod:myitem_1",
"5" : "mymod:myitem_5"
}
}
You can still define the attribute like this:
{
"itemModel" : "mymod:myitem"
}
This will set the value for all subtypes.
The lang files are located in assets/themodid/lang.
The lang file entry for a block without subtypes looks like this:
tile.themodid.theblockid.name=The Localized Name
And for a block with subtypes:
tile.themodid.theblockid.0.name=Subtype 0
tile.themodid.theblockid.1.name=Subtype 1
tile.themodid.theblockid.5.name=Subtype 5
The blockstate file defines what model the block uses depending on its state. For example the metadata subtype is a state. A simple blockstate file for a block using subtypes might look like this:
{
"variants": {
"subtype=subtype0": {"model": "firstpack:sensor_iron"},
"subtype=subtype1": {"model": "firstpack:sensor_gold"}
}
}
For more information about block states, you might look here: http://minecraft.gamepedia.com/Model#Block_states
Type name: block:simple
This block has no special functionality, like stone or dirt. It supports all 16 metadata subtypes. There are no additional attributes for this block.
Block state properties: subtype.
There are 3 different orientable blocks: vertical, horizontal and directional. All of them have one additional attribute:
{
"faceBySide" : true
}
- faceBySide: This defines whether the facing of the block should be determined by the clicked side instead of where the player is looking. If the block can't face in the direction of the clicked side, the facing is still determined on the direction the player is looking at. Supports metadata subtypes. The default value is false.
Type name: block:orientable:vertical
This block can face only up and down. It supports metadata subtypes 0 to 7.
Block state properties: facing and subtype. Facing can either be up or down.
Type name: block:orientable:horizontal
This block can face to north, south, east and west. It supports metadata subtypes 0 to 3.
Block state properties: facing and subtype. Facing can be north, south, east and west.
Type name: block:orientable:directional
This block can face in all directions. It supports metadata subtypes 0 and 1.
Block state properties: facing and subtype. Facing can be up, down, north, south, east and west.
Type name: block:fence
This is a fence block. It supports all 16 metadata subtypes. There are no additional attributes for this block.
Block state properties: subtype.
Type name: block:stairs
This is a stairs block. It does not support metadata subtypes. It has one additional attribute:
{
"modelState": {
"block": "minecraft:log",
"properties": {
"variant": "spruce"
}
}
}
- modelState: This is a BlockState defining which block this stair is made from. This state will define some properties of the stair, such as the material.
Block state properties: facing, half and shape. Facing can be north, south, east and west. Half can be bottom and top. Shape can be straight, outer_right, outer_left, inner_right and inner_left.
Type name: block:slab
This is a half slab lock. It supports metadata subtypes 0 to 7. It has one additional attribute:
{
"doubleSlab" : {
"block": "minecraft:log",
"properties": "variant=spruce"
}
}
- doubleSlab: This is a BlockState defining what two half slabs are being combined to. Supports metadata subtypes. If omitted, slabs can't be combined.
Block state properties: subtype and half. Half can be either top or bottom.
Type name: block:fluid
This is a fluid block. The id of this block will also be the id of the fluid (without the mod prefix), so don't use something like water or lava as those already exist. It does not support metadata subtypes. It has the following additional attributes:
{
"density": 1000,
"temperature": 300,
"viscosity": 1000,
"flowLength": 8,
"isGaseous": false,
"canCreateSource": false,
"addUniversalBucket": true,
"texStill": "cs4examplemod:blocks/fluid_still",
"texFlowing": "cs4examplemod:blocks/fluid_flow"
}
- density: Defines the density of the fluid. Negative density indicates that the fluid is lighter than air. Default value is 1000.
- temperature: Defines the temperature of the fluid in Kelvin. Default value is 300.
- viscosity: Defines the viscosity ("thickness") of the fluid. Higher value means that a fluid flows more slowly, lower value means more quickly. Default values is 1000.
- flowLength: Defines how far away the fluid flows from a source block. Value should be between 0 and 15. Default value is 8.
- isGaseous: Indicates if the fluid is gaseous. Default value is false.
- canCreateSource: Defines whether two source blocks can create another source block, like water. Default value is false.
- addUniversalBucket: Defines whether the fluid can be picked up by forge's universal bucket. Default value is true.
- texStill, texFlowing: The still and flowing textures for the fluid.
The block state file for the fluid should look like this (replace examplefluid with the id of your fluid):
{
"forge_marker": 1,
"defaults": {
"model": "forge:fluid",
"custom": { "fluid": "examplefluid" }
},
"variants": {
"level": {
"0": {"model": "forge:fluid"},
"1": {"model": "forge:fluid"},
"2": {"model": "forge:fluid"},
"3": {"model": "forge:fluid"},
"4": {"model": "forge:fluid"},
"5": {"model": "forge:fluid"},
"6": {"model": "forge:fluid"},
"7": {"model": "forge:fluid"},
"8": {"model": "forge:fluid"},
"9": {"model": "forge:fluid"},
"10": {"model": "forge:fluid"},
"11": {"model": "forge:fluid"},
"12": {"model": "forge:fluid"},
"13": {"model": "forge:fluid"},
"14": {"model": "forge:fluid"},
"15": {"model": "forge:fluid"}
}
}
}
Type name: block:carpet
This is a carpet block. It supports all 16 metadata subtypes. There are no additional attributes for this block.
Block state properties: subtype.
Type name: block:snow
This is a layered snow block. It does not support metadata subtypes. It has the following additional attributes:
{
"snowball": "minecraft:snowball",
"maxLight": 15
}
- snowball: If specified, this ItemStack will be dropped once for each layer plus one (1 layer drops 2, 2 layers drop 3).
- maxLight: If the block's light level is above the provided value, the block will disappear. Setting this to 15 will make the block not disappear at all. Default value is 11.
Block state properties: layers. It has values between 1 and 8, including both.
Type name: block:crops
This is a crops block like carrots or potatoes. It does not support metadata subtypes. It has the following additional attributes:
{
"maxAge": 3,
"growthFactor": 1.5,
"heights": [0.1, 0.3, 0.6, 1.0],
"seeds": "cs4examplemod:seeds",
"crops": "minecraft:carrot"
}
- maxAge: The maximum number of stages this block has. A maxAge of 0 means the block will only have one stage. The maximum value for this attribute is 15. Default value is 7.
- growthFactor: This specifies how fast the crop will grow. A value of 1.0 is as fast as regular crops, 2.0 is twice as fast, 0.5 is half as fast. This value has to be greater than 0.0. Default value is 1.0.
-
heights: This specifies the heights for each stage of the crop. If omitted, the height of the crop will linearly increase to 1.0 depending on the maxAge. For example if the maxAge is 3 the calculated heights will be
[0.25, 0.5, 0.75, 1.0]
. - seeds: This is a BlockDrop defining the seeds that this block will drop. If the block is harvested at its maximum age it will drop multiple seeds just like regular crops.
- crops: This is a BlockDrop defining the crops that will drop if the block is harvested at its maximum age.
Block state properties: age. It has values between 0 and the value of maxAge, including both.
Type name: block:fenceGate
This is a fence gate block. It does not support metadata subtypes. It has the following addition attributes:
{
"opensWithRedstone": true,
"openWithHands": true
}
- opensWithRedstone: Specifies whether the fence gate can be opened or closed using redstone. Default value is true.
- opensWithHands: Specifies whether the fence gate can be opened or closed using hands (right-clicking). Default value is true.
Block state properties: facing (north, south, east, west), in_wall (true, false), open (true, false).
Type name: block:wall
This is a wall block. It supports all 16 metadata subtypes. It has no additional attributes.
Block state properties: subtype (0 to 15), north (true, false), south (true, false), east (true, false), west (true, false), up (true, false)
Type name: block:trapDoor
This is a trap door block. It does not support metadata subtypes. It has the following addition attributes:
{
"opensWithRedstone": true,
"openWithHands": true
}
- opensWithRedstone: Specifies whether the trap door can be opened or closed using redstone. Default value is true.
- opensWithHands: Specifies whether the trap door can be opened or closed using hands (right-clicking). Default value is true.
Block state properties: facing (north, south, east, west), half (top, bottom), open (true, false)
Type name: block:torch
This is a torch block. It does not support metadata subtypes. It has the following addition attributes:
{
"spawnParticles": true
}
- spawnParticles: Specifies whether the torch should spawn flame and smoke particles. Default value is true.
Block state properties: facing (up, north, south, east, west)
Type name: block:button
This is a button block. It does not support metadata subtypes. It has the following addition attributes:
{
"pressedTicks": 20,
"triggeredByArrows": false
}
Block state properties: facing (up, north, south, east, west), powered (true, false)
- pressedTicks: The number of ticks that the button remains in the pressed state. Default value is 20.
- triggeredByArrows: Specifies whether the button can be pressed by arrows. Default value is false.
Type name: block:pane
This is a pane block (glass pane, iron bars, etc.). It supports all 16 metadata subtypes. It has no additional attributes.
Block state properties: subtype (0 to 15), north (true, false), south (true, false), east (true, false), west (true, false)
Type name: block:pressurePlate
This is a pressure plate block. It does not support metadata subtypes. It has the following additional attributes.
{
"pressedTicks": 20,
"selector": "everything",
"onSound": "block.wood_pressureplate.click_on",
"offSound": "block.wood_pressureplate.click_off"
}
- pressedTicks: The number of ticks that the pressure plate remains in the pressed state. Default value is 20.
- selector: This defines what entities can trigger the pressure plate. This is either the name of the entity (minecraft:sheep, minecraft:creeper) or one of the these: everything, nothing, livings, players, items. Default value is everything.
- onSound, offSound: The name of the sound when the pressure plate is pressed or unpressed. Default values are block.wood_pressureplate.click_on and block.wood_pressureplate.click_off
Block state properties: powered (true, false)