SPIGOT-5336: Field name parity with Minecraft keys
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
@@ -19,37 +19,37 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
/**
|
||||
* Provides protection against environmental damage
|
||||
*/
|
||||
public static final Enchantment PROTECTION_ENVIRONMENTAL = getEnchantment("protection");
|
||||
public static final Enchantment PROTECTION = getEnchantment("protection");
|
||||
|
||||
/**
|
||||
* Provides protection against fire damage
|
||||
*/
|
||||
public static final Enchantment PROTECTION_FIRE = getEnchantment("fire_protection");
|
||||
public static final Enchantment FIRE_PROTECTION = getEnchantment("fire_protection");
|
||||
|
||||
/**
|
||||
* Provides protection against fall damage
|
||||
*/
|
||||
public static final Enchantment PROTECTION_FALL = getEnchantment("feather_falling");
|
||||
public static final Enchantment FEATHER_FALLING = getEnchantment("feather_falling");
|
||||
|
||||
/**
|
||||
* Provides protection against explosive damage
|
||||
*/
|
||||
public static final Enchantment PROTECTION_EXPLOSIONS = getEnchantment("blast_protection");
|
||||
public static final Enchantment BLAST_PROTECTION = getEnchantment("blast_protection");
|
||||
|
||||
/**
|
||||
* Provides protection against projectile damage
|
||||
*/
|
||||
public static final Enchantment PROTECTION_PROJECTILE = getEnchantment("projectile_protection");
|
||||
public static final Enchantment PROJECTILE_PROTECTION = getEnchantment("projectile_protection");
|
||||
|
||||
/**
|
||||
* Decreases the rate of air loss whilst underwater
|
||||
*/
|
||||
public static final Enchantment OXYGEN = getEnchantment("respiration");
|
||||
public static final Enchantment RESPIRATION = getEnchantment("respiration");
|
||||
|
||||
/**
|
||||
* Increases the speed at which a player may mine underwater
|
||||
*/
|
||||
public static final Enchantment WATER_WORKER = getEnchantment("aqua_affinity");
|
||||
public static final Enchantment AQUA_AFFINITY = getEnchantment("aqua_affinity");
|
||||
|
||||
/**
|
||||
* Damages the attacker
|
||||
@@ -74,17 +74,17 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
/**
|
||||
* Increases damage against all targets
|
||||
*/
|
||||
public static final Enchantment DAMAGE_ALL = getEnchantment("sharpness");
|
||||
public static final Enchantment SHARPNESS = getEnchantment("sharpness");
|
||||
|
||||
/**
|
||||
* Increases damage against undead targets
|
||||
*/
|
||||
public static final Enchantment DAMAGE_UNDEAD = getEnchantment("smite");
|
||||
public static final Enchantment SMITE = getEnchantment("smite");
|
||||
|
||||
/**
|
||||
* Increases damage against arthropod targets
|
||||
*/
|
||||
public static final Enchantment DAMAGE_ARTHROPODS = getEnchantment("bane_of_arthropods");
|
||||
public static final Enchantment BANE_OF_ARTHROPODS = getEnchantment("bane_of_arthropods");
|
||||
|
||||
/**
|
||||
* All damage to other targets will knock them back when hit
|
||||
@@ -99,7 +99,7 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
/**
|
||||
* Provides a chance of gaining extra loot when killing monsters
|
||||
*/
|
||||
public static final Enchantment LOOT_BONUS_MOBS = getEnchantment("looting");
|
||||
public static final Enchantment LOOTING = getEnchantment("looting");
|
||||
|
||||
/**
|
||||
* Increases damage against targets when using a sweep attack
|
||||
@@ -109,7 +109,7 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
/**
|
||||
* Increases the rate at which you mine/dig
|
||||
*/
|
||||
public static final Enchantment DIG_SPEED = getEnchantment("efficiency");
|
||||
public static final Enchantment EFFICIENCY = getEnchantment("efficiency");
|
||||
|
||||
/**
|
||||
* Allows blocks to drop themselves instead of fragments (for example,
|
||||
@@ -120,37 +120,37 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
/**
|
||||
* Decreases the rate at which a tool looses durability
|
||||
*/
|
||||
public static final Enchantment DURABILITY = getEnchantment("unbreaking");
|
||||
public static final Enchantment UNBREAKING = getEnchantment("unbreaking");
|
||||
|
||||
/**
|
||||
* Provides a chance of gaining extra loot when destroying blocks
|
||||
*/
|
||||
public static final Enchantment LOOT_BONUS_BLOCKS = getEnchantment("fortune");
|
||||
public static final Enchantment FORTUNE = getEnchantment("fortune");
|
||||
|
||||
/**
|
||||
* Provides extra damage when shooting arrows from bows
|
||||
*/
|
||||
public static final Enchantment ARROW_DAMAGE = getEnchantment("power");
|
||||
public static final Enchantment POWER = getEnchantment("power");
|
||||
|
||||
/**
|
||||
* Provides a knockback when an entity is hit by an arrow from a bow
|
||||
*/
|
||||
public static final Enchantment ARROW_KNOCKBACK = getEnchantment("punch");
|
||||
public static final Enchantment PUNCH = getEnchantment("punch");
|
||||
|
||||
/**
|
||||
* Sets entities on fire when hit by arrows shot from a bow
|
||||
*/
|
||||
public static final Enchantment ARROW_FIRE = getEnchantment("flame");
|
||||
public static final Enchantment FLAME = getEnchantment("flame");
|
||||
|
||||
/**
|
||||
* Provides infinite arrows when shooting a bow
|
||||
*/
|
||||
public static final Enchantment ARROW_INFINITE = getEnchantment("infinity");
|
||||
public static final Enchantment INFINITY = getEnchantment("infinity");
|
||||
|
||||
/**
|
||||
* Decreases odds of catching worthless junk
|
||||
*/
|
||||
public static final Enchantment LUCK = getEnchantment("luck_of_the_sea");
|
||||
public static final Enchantment LUCK_OF_THE_SEA = getEnchantment("luck_of_the_sea");
|
||||
|
||||
/**
|
||||
* Increases rate of fish biting your hook
|
||||
@@ -350,7 +350,6 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
return null;
|
||||
}
|
||||
|
||||
name = convertLegacy(name);
|
||||
return getByKey(NamespacedKey.fromString(name.toLowerCase()));
|
||||
}
|
||||
|
||||
@@ -365,55 +364,4 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
public static Enchantment[] values() {
|
||||
return Lists.newArrayList(Registry.ENCHANTMENT).toArray(new Enchantment[0]);
|
||||
}
|
||||
|
||||
private static String convertLegacy(String from) {
|
||||
if (from == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (from.toLowerCase()) {
|
||||
case "protection_environmental":
|
||||
return "protection";
|
||||
case "protection_fire":
|
||||
return "fire_protection";
|
||||
case "protection_fall":
|
||||
return "feather_falling";
|
||||
case "protection_explosions":
|
||||
return "blast_protection";
|
||||
case "protection_projectile":
|
||||
return "projectile_protection";
|
||||
case "oxygen":
|
||||
return "respiration";
|
||||
case "water_worker":
|
||||
return "aqua_affinity";
|
||||
case "damage_all":
|
||||
return "sharpness";
|
||||
case "damage_undead":
|
||||
return "smite";
|
||||
case "damage_arthropods":
|
||||
return "bane_of_arthropods";
|
||||
case "loot_bonus_mobs":
|
||||
return "looting";
|
||||
case "sweeping":
|
||||
return "sweeping_edge";
|
||||
case "dig_speed":
|
||||
return "efficiency";
|
||||
case "durability":
|
||||
return "unbreaking";
|
||||
case "loot_bonus_blocks":
|
||||
return "fortune";
|
||||
case "arrow_damage":
|
||||
return "power";
|
||||
case "arrow_knockback":
|
||||
return "punch";
|
||||
case "arrow_fire":
|
||||
return "flame";
|
||||
case "arrow_infinite":
|
||||
return "infinity";
|
||||
case "luck":
|
||||
return "luck_of_the_sea";
|
||||
}
|
||||
|
||||
return from;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user