diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosivePickaxe.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosivePickaxe.java index 3fa7954eb..a10c77c78 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosivePickaxe.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosivePickaxe.java @@ -39,8 +39,9 @@ public class ExplosivePickaxe extends SimpleSlimefunItem impl public BlockBreakHandler getItemHandler() { return (e, item, fortune, drops) -> { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.EXPLOSIVE_PICKAXE, true)) { + e.setCancelled(true); e.getBlock().getWorld().createExplosion(e.getBlock().getLocation(), 0.0F); - e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); + e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.3F, 1F); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { for (int z = -1; z <= 1; z++) { diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosiveShovel.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosiveShovel.java index fe05b9073..77e453fc7 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosiveShovel.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/items/ExplosiveShovel.java @@ -31,8 +31,9 @@ public class ExplosiveShovel extends SimpleSlimefunItem imple public BlockBreakHandler getItemHandler() { return (e, item, fortune, drops) -> { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.EXPLOSIVE_SHOVEL, true)) { + e.setCancelled(true); e.getBlock().getWorld().createExplosion(e.getBlock().getLocation(), 0.0F); - e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); + e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.3F, 1F); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/electric/FoodComposter.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/electric/FoodComposter.java index daa8e4f83..ca225bd0d 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/electric/FoodComposter.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/electric/FoodComposter.java @@ -1,13 +1,18 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.inventory.ItemStack; + import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; +import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; +import me.mrCookieSlime.Slimefun.utils.RecipeDisplayItem; -import org.bukkit.inventory.ItemStack; - -public abstract class FoodComposter extends AContainer { +public abstract class FoodComposter extends AContainer implements RecipeDisplayItem { public FoodComposter(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe) { super(category, item, name, recipeType, recipe); @@ -24,6 +29,18 @@ public abstract class FoodComposter extends AContainer { registerRecipe(30, new ItemStack[] {SlimefunItems.APPLE_ORGANIC_FOOD}, new ItemStack[] {SlimefunItems.APPLE_FERTILIZER}); } + @Override + public List getDisplayRecipes() { + List displayRecipes = new ArrayList<>(recipes.size() * 2); + + for (MachineRecipe recipe: recipes) { + displayRecipes.add(recipe.getInput()[0]); + displayRecipes.add(recipe.getOutput()[0]); + } + + return displayRecipes; + } + @Override public String getMachineIdentifier() { return "FOOD_COMPOSTER"; diff --git a/src/me/mrCookieSlime/Slimefun/utils/DamageableItem.java b/src/me/mrCookieSlime/Slimefun/utils/DamageableItem.java index 2fbc68e4f..6db351177 100644 --- a/src/me/mrCookieSlime/Slimefun/utils/DamageableItem.java +++ b/src/me/mrCookieSlime/Slimefun/utils/DamageableItem.java @@ -13,9 +13,8 @@ public interface DamageableItem { boolean isDamageable(); default void damageItem(Player p, ItemStack item) { - if (item != null && item.getType() != null && item.getType() != Material.AIR && item.getAmount() > 0 && isDamageable() && !item.getEnchantments().containsKey(Enchantment.DURABILITY) || Math.random() * 100 <= (60 + Math.floorDiv(40, (item.getEnchantmentLevel(Enchantment.DURABILITY) + 1)))) { + if (item != null && item.getType() != null && item.getType() != Material.AIR && item.getAmount() > 0 && isDamageable() && item.getEnchantments().containsKey(Enchantment.DURABILITY) && Math.random() * 100 <= (60 + Math.floorDiv(40, (item.getEnchantmentLevel(Enchantment.DURABILITY) + 1)))) { ItemMeta meta = item.getItemMeta(); - Damageable damageable = (Damageable) meta; if (damageable.getDamage() >= item.getType().getMaxDurability()) {