added onImbuementRemoval(ItemStack stack) to Imbuement interface
This commit is contained in:
@@ -69,12 +69,16 @@ public interface Imbuement {
|
|||||||
Enchantment enchantment = Enchantment.getEnchantmentByID(enchantmentTag.getShort("id"));
|
Enchantment enchantment = Enchantment.getEnchantmentByID(enchantmentTag.getShort("id"));
|
||||||
// If the item contains a magic weapon enchantment, remove it from the item
|
// If the item contains a magic weapon enchantment, remove it from the item
|
||||||
if(enchantment instanceof Imbuement){
|
if(enchantment instanceof Imbuement){
|
||||||
|
((Imbuement) enchantment).onImbuementRemoval(stack);
|
||||||
enchantmentIt.remove();
|
enchantmentIt.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Allows executing some custom logic before this imbuement is being removed from the stack. Called when the imbuement is about to be removed. */
|
||||||
|
default void onImbuementRemoval(ItemStack stack){}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onPlayerOpenContainerEvent(PlayerContainerEvent event){
|
public static void onPlayerOpenContainerEvent(PlayerContainerEvent event){
|
||||||
// Brute-force fix to stop enchanted books in dungeon chests from having imbuements on them.
|
// Brute-force fix to stop enchanted books in dungeon chests from having imbuements on them.
|
||||||
|
|||||||
Reference in New Issue
Block a user