Mod Support - Custom blocks now allow for the setting of how many items

they drop when broken.
This commit is contained in:
GJ 2012-05-17 17:21:59 -04:00
parent d20c5e1773
commit b36da06fad
2 changed files with 12 additions and 3 deletions

View File

@ -74,6 +74,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
boolean dropItem = config.getBoolean(skillType + "." + blockName + ".Drop_Item", false); boolean dropItem = config.getBoolean(skillType + "." + blockName + ".Drop_Item", false);
int dropID = config.getInt(skillType + "." + blockName + ".Drop_Item_ID", 0); int dropID = config.getInt(skillType + "." + blockName + ".Drop_Item_ID", 0);
byte dropData = (byte) config.getInt(skillType + "." + blockName + ".Drop_Item_Data_Value", 0); byte dropData = (byte) config.getInt(skillType + "." + blockName + ".Drop_Item_Data_Value", 0);
int dropAmount = config.getInt(skillType + "." + blockName + ".Drop_Item_Amount", 1);
if (id == 0) { if (id == 0) {
plugin.getLogger().warning("Missing ID. This block will be skipped."); plugin.getLogger().warning("Missing ID. This block will be skipped.");
@ -90,10 +91,10 @@ public class CustomBlocksConfig extends ModConfigLoader{
ItemStack blockItem; ItemStack blockItem;
if (dropItem) { if (dropItem) {
itemDrop = new ItemStack(dropID, 1, (short) 0, dropData); itemDrop = new ItemStack(dropID, dropAmount, (short) 0, dropData);
} }
else { else {
itemDrop = new ItemStack(id, 1, (short) 0, data); itemDrop = new ItemStack(id, dropAmount, (short) 0, data);
} }
block = new CustomBlock(itemDrop, xp, data, id); block = new CustomBlock(itemDrop, xp, data, id);

View File

@ -9,6 +9,7 @@ Excavation:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
Block_2: Block_2:
ID: 999 ID: 999
Data_Value: 0 Data_Value: 0
@ -16,6 +17,7 @@ Excavation:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
# #
# Settings for Custom Herbalism Blocks # Settings for Custom Herbalism Blocks
@ -28,6 +30,7 @@ Herbalism:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
Block_2: Block_2:
ID: 999 ID: 999
Data_Value: 0 Data_Value: 0
@ -35,6 +38,7 @@ Herbalism:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
# #
# Settings for Custom Mining Blocks # Settings for Custom Mining Blocks
@ -48,6 +52,7 @@ Mining:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
Block_2: Block_2:
ID: 999 ID: 999
Data_Value: 0 Data_Value: 0
@ -56,6 +61,7 @@ Mining:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
# #
# Settings for Custom Woodcutting Blocks # Settings for Custom Woodcutting Blocks
@ -69,6 +75,7 @@ Woodcutting:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1
Block_2: Block_2:
ID: 999 ID: 999
Data_Value: 0 Data_Value: 0
@ -77,3 +84,4 @@ Woodcutting:
Drop_Item: false Drop_Item: false
Drop_Item_ID: 999 Drop_Item_ID: 999
Drop_Item_Data_Value: 0 Drop_Item_Data_Value: 0
Drop_Item_Amount: 1