Skip to content

Commit

Permalink
make RandomizeArmorEvent respect DO_NOT_ENCHANT_WITH tag
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ckscor3 committed Feb 21, 2023
1 parent fad90cf commit 4d8c56f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package me.juancarloscp52.entropy.events.db;

import me.juancarloscp52.entropy.Entropy;
import me.juancarloscp52.entropy.EntropyTags;
import me.juancarloscp52.entropy.events.AbstractInstantEvent;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.EquipmentSlot;
Expand Down Expand Up @@ -62,7 +63,7 @@ private ItemStack getRandomItem(ServerPlayerEntity serverPlayerEntity, Equipment
}
private Enchantment getRandomEnchantment(ItemStack item){
Enchantment enchantment = Registries.ENCHANTMENT.get(Random.create().nextInt(Registries.ENCHANTMENT.getIds().size()));
if(enchantment!=null && enchantment.isAcceptableItem(item))
if(enchantment!=null && enchantment.isAcceptableItem(item) && !Registries.ENCHANTMENT.getEntry(enchantment).isIn(EntropyTags.DO_NOT_ENCHANT_WITH))
return enchantment;
else
return getRandomEnchantment(item);
Expand Down

0 comments on commit 4d8c56f

Please sign in to comment.