Lucky Block Documentation

Contents

6.3 Block Data

6.3 Block Data


The Lucky Block in-game item and block contain data storing additional properties of the block. This data is used to store the 'luck' of the block, (See 1.3 Luck Crafting) and can also store a custom set of drops. If the Lucky Block contains custom drop data, it will choose a drop from the custom list provided rather than drops.txt. Lucky Block data is stored in the form of an NBT Tag for items, and tile entity for blocks. A player can give or set a Lucky Block with custom data using Minecraft commands. The data can also be used in the drops.txt file, specified with the NBTTag / tileEntity properties for items and blocks. Below is the format and examples.

 

NBT Tag Format: NBTTag=(Luck=integer,Drops=["text","text"...])

/give PlayerName lucky:lucky_block 1 0 {Luck:50,Drops:["ID=stick","ID=diamond"]}
/set ~ ~ ~ lucky:lucky_block 0 {Luck:50,Drops:["ID=stick","ID=diamond"]}

type=item,ID=lucky:lucky_block,NBTTag=(Luck=50,Drops=["ID=stick","ID=diamond"])
type=block,ID=lucky:lucky_block,tileEntity=(Luck=50,Drops=["ID=stick","ID=diamond"])

Each of the examples creates a Lucky Block with a luck of 50 (Luck=50) and a custom set of drops which includes a stick and a diamond (Drops=["ID=stick","ID=diamond"]). The first two examples use Minecraft commands to give and place a Lucky Block. The second two example do the exact same thing, though as Lucky Block drops which could be used in drops.txt. Note that the first two use Minecraft command NBT Format rather than Lucky Block format, but the differences are minor.

 

In the NBT Tag, Luck is simply used to specify the luck, and Drops is a custom list of drops. Each entry in the drop list is in text format, as would normally be specified in drops.txt. If a drop list is present when a Lucky Block is harvested, a drop will be chosen from only the custom list, not drops.txt. This can be prevented by not including a drop list. Lastly, if the luck is not specified, it will default to 0.

 

It should be noted that certain problems may arise when specifying a Lucky Block with custom properties in drops.txt, as in the last two examples. These problems are related to hash variables (See 3.2 Hash Variables) and multiple processing. Because the drop which creates a custom Lucky Block will first be processed, followed by a second processing when the newly created custom Lucky Block is harvested, there are two opportunities for hash variable to be processed. It is often desired for hash variables to be processed when the custom Lucky Block is harvested, and therefore must be canceled using quotes ('#'hashVariable) to avoid being processed the first time. More detail on this can be found in 3.1 Complex Values.

BackForward

Copyright Minecraft Ascending 2015