mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 15:02:17 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,59 @@
|
||||
package noppes.npcs.enchants;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.items.ItemStaff;
|
||||
|
||||
public abstract class EnchantInterface extends Enchantment{
|
||||
|
||||
private static EnumEnchantmentType CustomNpcsType;
|
||||
|
||||
public static EnchantInterface Damage;
|
||||
public static EnchantInterface Poison;
|
||||
public static EnchantInterface Confusion;
|
||||
public static EnchantInterface Infinite;
|
||||
|
||||
private Class[] classes;
|
||||
|
||||
protected EnchantInterface(int par2, Class... obs) {
|
||||
super(CustomNpcs.EnchantStartId++, par2, CustomNpcsType);
|
||||
classes = obs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApply(ItemStack par1ItemStack){
|
||||
if(par1ItemStack.getItem() == null)
|
||||
return false;
|
||||
for(Class cls : classes){
|
||||
if(cls.isInstance(par1ItemStack.getItem()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void load(){
|
||||
if(!CustomNpcs.DisableEnchants){
|
||||
CustomNpcsType = EnumHelper.addEnchantmentType("customnpcs_enchants");
|
||||
try{
|
||||
Damage = new EnchantDamage();
|
||||
Poison = new EnchantPoison();
|
||||
Confusion = new EnchantConfusion();
|
||||
Infinite = new EnchantInfinite();
|
||||
}
|
||||
catch(Exception e){
|
||||
LogWriter.except(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getLevel(EnchantInterface enchant, ItemStack stack) {
|
||||
if(CustomNpcs.DisableEnchants || enchant == null)
|
||||
return 0;
|
||||
return EnchantmentHelper.getEnchantmentLevel(enchant.effectId, stack);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user