mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Added functionality to specify custom blocks that should not trigger
abilities.
This commit is contained in:
parent
bdcc522897
commit
ee2a5c199a
@ -30,6 +30,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
||||
public List<ItemStack> customOres = new ArrayList<ItemStack>();
|
||||
public List<ItemStack> customLogs = new ArrayList<ItemStack>();
|
||||
public List<ItemStack> customLeaves = new ArrayList<ItemStack>();
|
||||
public List<ItemStack> customAbilityBlocks = new ArrayList<ItemStack>();
|
||||
|
||||
public List<ItemStack> customItems = new ArrayList<ItemStack>();
|
||||
public List<CustomBlock> customBlocks = new ArrayList<CustomBlock>();
|
||||
@ -46,6 +47,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
||||
loadBlocks("Herbalism", customHerbalismBlocks);
|
||||
loadBlocks("Mining", customMiningBlocks);
|
||||
loadBlocks("Woodcutting", customWoodcuttingBlocks);
|
||||
loadBlocks("Ability_Blocks", customAbilityBlocks);
|
||||
}
|
||||
|
||||
private void loadBlocks(String skillType, List<ItemStack> blockList) {
|
||||
@ -66,20 +68,26 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
||||
int minimumDropAmount = config.getInt(skillType + "." + blockName + ".Min_Drop_Item_Amount", 1);
|
||||
int maxiumDropAmount = config.getInt(skillType + "." + blockName + ".Max_Drop_Item_Amount", 1);
|
||||
|
||||
CustomBlock block;
|
||||
ItemStack itemDrop;
|
||||
ItemStack blockItem;
|
||||
|
||||
if (id == 0) {
|
||||
plugin.getLogger().warning("Missing ID. This block will be skipped.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (skillType == "Ability_Blocks") {
|
||||
blockItem = new ItemStack(id, 1, (short) 0, data);
|
||||
blockList.add(blockItem);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dropItem && dropID == 0) {
|
||||
plugin.getLogger().warning("Incomplete item drop information. This block will drop itself.");
|
||||
dropItem = false;
|
||||
}
|
||||
|
||||
CustomBlock block;
|
||||
ItemStack itemDrop;
|
||||
ItemStack blockItem;
|
||||
|
||||
if (dropItem) {
|
||||
itemDrop = new ItemStack(dropID, 1, (short) 0, dropData);
|
||||
}
|
||||
@ -90,10 +98,10 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
||||
block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id);
|
||||
blockItem = new ItemStack(id, 1, (short) 0, data);
|
||||
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
if (skillType == "Mining" && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockItem);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
else if (skillType == "Woodcutting") {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockItem);
|
||||
}
|
||||
|
@ -97,6 +97,9 @@ public class BlockChecks {
|
||||
if (block.getTypeId() == Config.getInstance().getRepairAnvilId()) {
|
||||
return false;
|
||||
}
|
||||
else if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
|
@ -94,4 +94,16 @@ Woodcutting:
|
||||
Drop_Item_ID: 999
|
||||
Drop_Item_Data_Value: 0
|
||||
Min_Drop_Item_Amount: 1
|
||||
Max_Drop_Item_Amount: 1
|
||||
Max_Drop_Item_Amount: 1
|
||||
|
||||
#
|
||||
# Settings for Custom Ability Blocks
|
||||
# (These blocks don't trigger abilities)
|
||||
###
|
||||
Ability_Blocks:
|
||||
Block_1:
|
||||
ID: 999
|
||||
Data_Value: 0
|
||||
Block_2:
|
||||
ID: 999
|
||||
Data_Value: 0
|
Loading…
Reference in New Issue
Block a user