From 2713961cdfebbd73bf9ea9c61ea4ead1f76f0da5 Mon Sep 17 00:00:00 2001 From: zontreck Date: Tue, 2 Apr 2024 14:00:57 -0700 Subject: [PATCH] Make some more QOL changes to existing enchants --- .../zontreck/otemod/enchantments/ConsumptionMending.java | 3 ++- .../dev/zontreck/otemod/enchantments/MobEggEnchantment.java | 4 ++-- .../otemod/enchantments/WaterBreathingEnchantment.java | 6 +++--- src/main/java/dev/zontreck/otemod/events/EventHandler.java | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/zontreck/otemod/enchantments/ConsumptionMending.java b/src/main/java/dev/zontreck/otemod/enchantments/ConsumptionMending.java index 75693ce..1abbeed 100644 --- a/src/main/java/dev/zontreck/otemod/enchantments/ConsumptionMending.java +++ b/src/main/java/dev/zontreck/otemod/enchantments/ConsumptionMending.java @@ -84,10 +84,11 @@ public class ConsumptionMending extends Enchantment List procList = new ArrayList<>(); procList.addAll(append(player, player.getInventory().offhand)); procList.addAll(append(player, player.getInventory().items)); + procList.addAll(append(player, player.getInventory().armor)); for(ItemStack stack : enchanted) { - for(ItemStack item : player.getInventory().items) + for(ItemStack item : procList) { // Is this a like item, and does it have the enchant? boolean eligible = false; diff --git a/src/main/java/dev/zontreck/otemod/enchantments/MobEggEnchantment.java b/src/main/java/dev/zontreck/otemod/enchantments/MobEggEnchantment.java index 8205829..cdf8f80 100644 --- a/src/main/java/dev/zontreck/otemod/enchantments/MobEggEnchantment.java +++ b/src/main/java/dev/zontreck/otemod/enchantments/MobEggEnchantment.java @@ -70,13 +70,13 @@ public class MobEggEnchantment extends Enchantment { OTEMod.LOGGER.info("Spawn Egg Chance (" + CHANCE + ")"); } - return rollChance((int)CHANCE); + return rollChance(CHANCE); } public static boolean rollChance(int percent) { Random rng = new Random(); - int test = rng.nextInt(100) + 1; + int test = rng.nextInt(100) + 1 + (100 - percent); if(ServerConfig.general.debug) { OTEMod.LOGGER.info("Spawn Egg Dice Roll (" + test + " / " + percent + ")"); diff --git a/src/main/java/dev/zontreck/otemod/enchantments/WaterBreathingEnchantment.java b/src/main/java/dev/zontreck/otemod/enchantments/WaterBreathingEnchantment.java index c8995f8..96a63df 100644 --- a/src/main/java/dev/zontreck/otemod/enchantments/WaterBreathingEnchantment.java +++ b/src/main/java/dev/zontreck/otemod/enchantments/WaterBreathingEnchantment.java @@ -57,11 +57,11 @@ public class WaterBreathingEnchantment extends Enchantment ItemStack feet = sp.getItemBySlot(EquipmentSlot.HEAD); - boolean hasNV = false; + boolean hasEnchantment = false; - if(ItemUtils.getEnchantmentLevel(ModEnchantments.WATER_BREATHING_ENCHANT.get(), feet)>0)hasNV=true; + if(ItemUtils.getEnchantmentLevel(ModEnchantments.WATER_BREATHING_ENCHANT.get(), feet)>0)hasEnchantment=true; - if(hasNV) + if(hasEnchantment) { MobEffectInstance inst = new MobEffectInstance(MobEffects.WATER_BREATHING, 60*20, 4, false, false, true); diff --git a/src/main/java/dev/zontreck/otemod/events/EventHandler.java b/src/main/java/dev/zontreck/otemod/events/EventHandler.java index 08c810c..b4e760f 100644 --- a/src/main/java/dev/zontreck/otemod/events/EventHandler.java +++ b/src/main/java/dev/zontreck/otemod/events/EventHandler.java @@ -167,6 +167,7 @@ public class EventHandler { ev.getDrops().add(new ItemEntity(killed.level(), killed.getX(), killed.getY(), killed.getZ(), egg)); + LoreHandlers.updateItem(stack, ItemStatType.EGG_CHANCE); LoreHandlers.updateItem(stack, ItemStatType.EGGING); } }else{