Creating a Custom Block - jojodmo/CustomItems GitHub Wiki
This page is for advanced users. If you're just getting started, we recommend that you use the in-game GUI to create your item! Just type /cui create <item name>
to get started!
In your custom block's item yml file (NOT blocks.yml), add the block key, and set canBePlaced to true
.
Under block
you can add the keys drops
, generation
, and texture
.
More information about texture
is on the Adding Custom Textures to Blocks page.
drops
is a list of the items the block drops when broken. If this isn't set, then the block will drop itself when broken. To make it not drop any items, set drops
to null
. If you would like more control over what's dropped, set drops
to null
and use the setDrops
action inside the blockBreak
handler.
For a full list of valid entries, see https://github.com/jojodmo/CustomItems/wiki/Custom-Block-Reference
This Block drops 3 diamond, 4 gold ingots, and 1 custom item with the ID "myCustomItemID"
name: "My Item Name"
item:
material: GOLD_BLOCK
canBeUsedGenerically: false
canBePlaced: true
block:
drops:
"minecraft:diamond": 3
"minecraft:gold_ingot": 4
"myCustomItemID": 1
generation
is formatted a lot like handlers.
block:
generation:
-
method: ore
worlds:
- world
continueChance: 0.4
generationChance: 1.0
amountPerChunk: 5
minY: 20
-
method: replace
blockType:
- "minecraft:GLOWSTONE"
worlds:
- world_nether
generationChance: 0.05
method — string — The method of generating the blocks. Currently valid options are: "ore" and "replace"
world(s) — string or string list — The worlds to enable generation in.
biome(s) — string or string list — A list of biomes for the generation to run in. For a list of options, visit https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Biome.html
amountPerChunk — integer — The number of times to run this generation method per chunk
generationChance — decimal between 0.0 and 1.0 — The chance of the generation method to run (for example, 0.7 give this generation method a 70% chance of running each time)
minY — integer — The minimum y-position to start generating blocks at. Blocks will only generate ABOVE this y position
maxY — integer — The maximum y-position to start generating blocks at. Blocks will only generate BELOW this y position
continueChance — decimal between 0.0 and 1.0 only for the "ore" generation method — the chance of the ore generation continuing to generate more blocks in the vein
continueChanceGrowth — how the chance of continuing should change every time a new block in a vein is generated. Options are constant, linear, or exponential. Constant is the default behavior, and the chance of generation continuing stays the same, no matter how many blocks are generated in the vein.
blockTypes - list of materials. For the "replace" method, these block types will be replaced when the generator runs — REQUIRED for the "replace" method.
For the "ore" method, these are the block types that the generation can happen in — by default this is only "STONE" in the "ore" method.