2011-11-27 01:39:25 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public abstract class Enchantment {
|
2012-07-29 09:33:13 +02:00
|
|
|
|
|
|
|
// CraftBukkit - update CraftEnchant.getName(i) if this changes
|
2011-11-27 01:39:25 +01:00
|
|
|
public static final Enchantment[] byId = new Enchantment[256];
|
|
|
|
public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentProtection(0, 10, 0);
|
|
|
|
public static final Enchantment PROTECTION_FIRE = new EnchantmentProtection(1, 5, 1);
|
|
|
|
public static final Enchantment PROTECTION_FALL = new EnchantmentProtection(2, 5, 2);
|
|
|
|
public static final Enchantment PROTECTION_EXPLOSIONS = new EnchantmentProtection(3, 2, 3);
|
|
|
|
public static final Enchantment PROTECTION_PROJECTILE = new EnchantmentProtection(4, 5, 4);
|
|
|
|
public static final Enchantment OXYGEN = new EnchantmentOxygen(5, 2);
|
|
|
|
public static final Enchantment WATER_WORKER = new EnchantmentWaterWorker(6, 2);
|
|
|
|
public static final Enchantment DAMAGE_ALL = new EnchantmentWeaponDamage(16, 10, 0);
|
|
|
|
public static final Enchantment DAMAGE_UNDEAD = new EnchantmentWeaponDamage(17, 5, 1);
|
|
|
|
public static final Enchantment DAMAGE_ARTHROPODS = new EnchantmentWeaponDamage(18, 5, 2);
|
|
|
|
public static final Enchantment KNOCKBACK = new EnchantmentKnockback(19, 5);
|
|
|
|
public static final Enchantment FIRE_ASPECT = new EnchantmentFire(20, 2);
|
|
|
|
public static final Enchantment LOOT_BONUS_MOBS = new EnchantmentLootBonus(21, 2, EnchantmentSlotType.WEAPON);
|
|
|
|
public static final Enchantment DIG_SPEED = new EnchantmentDigging(32, 10);
|
|
|
|
public static final Enchantment SILK_TOUCH = new EnchantmentSilkTouch(33, 1);
|
|
|
|
public static final Enchantment DURABILITY = new EnchantmentDurability(34, 5);
|
|
|
|
public static final Enchantment LOOT_BONUS_BLOCKS = new EnchantmentLootBonus(35, 2, EnchantmentSlotType.DIGGER);
|
2012-01-12 23:10:13 +01:00
|
|
|
public static final Enchantment ARROW_DAMAGE = new EnchantmentArrowDamage(48, 10);
|
|
|
|
public static final Enchantment ARROW_KNOCKBACK = new EnchantmentArrowKnockback(49, 2);
|
|
|
|
public static final Enchantment ARROW_FIRE = new EnchantmentFlameArrows(50, 2);
|
|
|
|
public static final Enchantment ARROW_INFINITE = new EnchantmentInfiniteArrows(51, 1);
|
2011-11-27 01:39:25 +01:00
|
|
|
public final int id;
|
|
|
|
private final int weight;
|
|
|
|
public EnchantmentSlotType slot;
|
|
|
|
protected String name;
|
|
|
|
|
|
|
|
protected Enchantment(int i, int j, EnchantmentSlotType enchantmentslottype) {
|
|
|
|
this.id = i;
|
|
|
|
this.weight = j;
|
|
|
|
this.slot = enchantmentslottype;
|
|
|
|
if (byId[i] != null) {
|
|
|
|
throw new IllegalArgumentException("Duplicate enchantment id!");
|
|
|
|
} else {
|
|
|
|
byId[i] = this;
|
|
|
|
}
|
|
|
|
|
2012-07-22 08:18:00 +02:00
|
|
|
org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment(this)); // CraftBukkit
|
2011-11-27 01:39:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getRandomWeight() {
|
|
|
|
return this.weight;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getStartLevel() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getMaxLevel() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a(int i) {
|
|
|
|
return 1 + i * 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int b(int i) {
|
|
|
|
return this.a(i) + 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a(int i, DamageSource damagesource) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a(int i, EntityLiving entityliving) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(Enchantment enchantment) {
|
|
|
|
return this != enchantment;
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public Enchantment b(String s) {
|
2011-11-27 01:39:25 +01:00
|
|
|
this.name = s;
|
|
|
|
return this;
|
|
|
|
}
|
2012-11-06 13:05:28 +01:00
|
|
|
|
|
|
|
public String a() {
|
|
|
|
return "enchantment." + this.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String c(int i) {
|
|
|
|
String s = LocaleI18n.get(this.a());
|
|
|
|
|
|
|
|
return s + " " + LocaleI18n.get("enchantment.level." + i);
|
|
|
|
}
|
2011-11-27 01:39:25 +01:00
|
|
|
}
|