added silk touch to hammer/excavator
This commit is contained in:
parent
5a02b6ee66
commit
22732afb1d
2 changed files with 50 additions and 1 deletions
|
@ -91,7 +91,7 @@ public class BlockListener implements Listener
|
||||||
|
|
||||||
// Handle Fortune enchantment
|
// Handle Fortune enchantment
|
||||||
if (enchantments.containsKey(Enchantment.LOOT_BONUS_BLOCKS) && ham && BlockRef.ValidHammerFortune.contains(blockMat)
|
if (enchantments.containsKey(Enchantment.LOOT_BONUS_BLOCKS) && ham && BlockRef.ValidHammerFortune.contains(blockMat)
|
||||||
|| enchantments.containsKey(Enchantment.LOOT_BONUS_BLOCKS) && exc && BlockRef.ValidExcavatorFortune.contains(blockMat))
|
|| enchantments.containsKey(Enchantment.LOOT_BONUS_BLOCKS) && exc && BlockRef.ValidExcavatorFortune.contains(blockMat))
|
||||||
{
|
{
|
||||||
double level = item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);
|
double level = item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);
|
||||||
|
|
||||||
|
@ -151,6 +151,13 @@ public class BlockListener implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (enchantments.containsKey(Enchantment.SILK_TOUCH) && ham && BlockRef.ValidHammerFortune.contains(blockMat)
|
||||||
|
|| enchantments.containsKey(Enchantment.SILK_TOUCH) && exc && BlockRef.ValidExcavatorFortune.contains(blockMat))
|
||||||
|
{
|
||||||
|
b.getWorld().dropItemNaturally(blockLoc, new ItemStack(blockMat));
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle snow
|
// Handle snow
|
||||||
else if (blockMat == Material.SNOW && exc)
|
else if (blockMat == Material.SNOW && exc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,6 +59,7 @@ public class BlockRef
|
||||||
add(Material.PODZOL);
|
add(Material.PODZOL);
|
||||||
add(Material.GRASS_BLOCK);
|
add(Material.GRASS_BLOCK);
|
||||||
add(Material.GRASS_PATH);
|
add(Material.GRASS_PATH);
|
||||||
|
add(Material.MYCELIUM);
|
||||||
|
|
||||||
add(Material.SAND);
|
add(Material.SAND);
|
||||||
add(Material.RED_SAND);
|
add(Material.RED_SAND);
|
||||||
|
@ -146,4 +147,45 @@ public class BlockRef
|
||||||
{{
|
{{
|
||||||
add(Material.GRAVEL);
|
add(Material.GRAVEL);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of all valid blocks that silk touch affects on hammers
|
||||||
|
*/
|
||||||
|
public static ArrayList<Material> ValidHammerSilkTouch = new ArrayList<Material>()
|
||||||
|
{{
|
||||||
|
add(Material.COAL_ORE);
|
||||||
|
add(Material.IRON_ORE);
|
||||||
|
add(Material.GOLD_ORE);
|
||||||
|
add(Material.DIAMOND_ORE);
|
||||||
|
add(Material.EMERALD_ORE);
|
||||||
|
add(Material.LAPIS_ORE);
|
||||||
|
add(Material.REDSTONE_ORE);
|
||||||
|
|
||||||
|
add(Material.COBBLESTONE);
|
||||||
|
add(Material.STONE);
|
||||||
|
add(Material.SANDSTONE);
|
||||||
|
add(Material.RED_SANDSTONE);
|
||||||
|
add(Material.ICE);
|
||||||
|
add(Material.BLUE_ICE);
|
||||||
|
add(Material.PACKED_ICE);
|
||||||
|
|
||||||
|
add(Material.NETHER_QUARTZ_ORE);
|
||||||
|
}};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of all valid blocks that silk touch affects on excavators
|
||||||
|
*/
|
||||||
|
public static ArrayList<Material> ValidExcavatorSilkTouch = new ArrayList<Material>()
|
||||||
|
{{
|
||||||
|
add(Material.PODZOL);
|
||||||
|
add(Material.GRASS_BLOCK);
|
||||||
|
add(Material.MYCELIUM);
|
||||||
|
//add(Material.GRASS_PATH); (bedrock edition only)
|
||||||
|
|
||||||
|
add(Material.GRAVEL);
|
||||||
|
add(Material.CLAY);
|
||||||
|
|
||||||
|
add(Material.SNOW);
|
||||||
|
add(Material.SNOW_BLOCK);
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue