FANDOM


Drop is as you might expect.  This sets what drops when the block is broken.  The block doesn't necessarily need to drop itself.  

The code can be written two different ways.

drop[0] = "5";

This version has oak logs dropping as 5 is the Id of dirt.  It works with fixed Ids.  It is straight forward and easy to code, yet limited as the Ids are not flexible.  Using vanilla blocks Ids is good when using this version.

drop[0] = config.getBlockId("exampleblockID");

This version is much longer yet is superior when using custom blocks and Item Ids.  Compatibility with other mods is gained when a config is used.  No longer does one need to alter the code to change Ids.  This shows that the config will be consulted to find the Id for exampleblock then drop it. 


Adding Meta data

drop[0] = "5:1";

Now this block will drop spruce logs.  5 is the Id for wood logs and 1 is the data value for spruce.

drop[0] = config.getBlockId("tutorialBlockID") + ":2";

Here the tutorialblock data value of 2 will drop.  Notice the colon in front of the 2.  The colon signifies that the next number is a data value. 


Amounts dropped

drop[0] = config.getBlockId("tutorialBlockID") + ":2 5";

Use your knowledge from what we learned so far to replace the ... with the version you wish to use.  Here it shows the ending.  Again the 2 with the colon in front tells us the data value.  The new variable 5 is the amount dropped. You do not need to add the data value if you do not want it. If you have both a space must separate the numbers.

drop[0] = config.getBlockId("tutorialBlockID") + "5";

Notice there is no colon.  So the code shows we are not talking about a meta data but an amount, 

drop[0] = "3 5";

This shows if you were to write it the other way.  Remember in this format the 3 is the Id (dirt) with a space then amount

drop[0] = config.getBlockId("tutorialBlockID") + ":2 3-5";

Here we have a dash between these numbers.  This dash lets us randomize the number dropped.  Here it will definitely drop 3 items but can drop as many as 5 items.  


Test Your Knowledge

With what you have learned can you read and understand the following? Try to answer the questions using this bit of code. 

drop[0] = config.getBlockId("spaceoreID") + "1-5";

Questions

Q1: How many items will be dropped?  (Easy)

Q2: What is being dropped?  (Easy)

Q3: What is its data value of the item being dropped?  (Moderate)

Q4: What is the item being dropped's Id?  (Hard)

Answers

Q1: 1 to 5 items.

Q2: spaceore.

Q3: Zero as it doesn't have a data value in the code.

Q4: Trick question, the code is writen so the Id is found in the config. 

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.