diff --git a/plugin/src/lightling/gibsoniacraft/util/BlockListener.java b/plugin/src/lightling/gibsoniacraft/util/BlockListener.java index 166f00b..471574c 100644 --- a/plugin/src/lightling/gibsoniacraft/util/BlockListener.java +++ b/plugin/src/lightling/gibsoniacraft/util/BlockListener.java @@ -91,7 +91,7 @@ public class BlockListener implements Listener // Handle Fortune enchantment 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); @@ -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 else if (blockMat == Material.SNOW && exc) { diff --git a/plugin/src/lightling/gibsoniacraft/util/BlockRef.java b/plugin/src/lightling/gibsoniacraft/util/BlockRef.java index 225bdeb..e0d6768 100644 --- a/plugin/src/lightling/gibsoniacraft/util/BlockRef.java +++ b/plugin/src/lightling/gibsoniacraft/util/BlockRef.java @@ -59,6 +59,7 @@ public class BlockRef add(Material.PODZOL); add(Material.GRASS_BLOCK); add(Material.GRASS_PATH); + add(Material.MYCELIUM); add(Material.SAND); add(Material.RED_SAND); @@ -146,4 +147,45 @@ public class BlockRef {{ add(Material.GRAVEL); }}; + + /** + * A list of all valid blocks that silk touch affects on hammers + */ + public static ArrayList ValidHammerSilkTouch = new ArrayList() + {{ + 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 ValidExcavatorSilkTouch = new ArrayList() + {{ + 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); + }}; }