aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/item/enchantment/DamageEnchantment.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/enchantment/DamageEnchantment.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/item/enchantment/DamageEnchantment.java.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/enchantment/DamageEnchantment.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/enchantment/DamageEnchantment.java.patch
new file mode 100644
index 0000000000..1a94a27b76
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/enchantment/DamageEnchantment.java.patch
@@ -0,0 +1,90 @@
+--- a/net/minecraft/world/item/enchantment/DamageEnchantment.java
++++ b/net/minecraft/world/item/enchantment/DamageEnchantment.java
+@@ -3,9 +3,9 @@
+ import net.minecraft.world.effect.MobEffectInstance;
+ import net.minecraft.world.effect.MobEffects;
+ import net.minecraft.world.entity.Entity;
++import net.minecraft.world.entity.EnumMonsterType;
+ import net.minecraft.world.entity.EquipmentSlot;
+ import net.minecraft.world.entity.LivingEntity;
+-import net.minecraft.world.entity.MobType;
+ import net.minecraft.world.item.AxeItem;
+ import net.minecraft.world.item.ItemStack;
+
+@@ -20,57 +20,50 @@
+ private static final int[] LEVEL_COST_SPAN = new int[]{20, 20, 20};
+ public final int type;
+
+- public DamageEnchantment(Enchantment.Rarity enchantment_rarity, int i, EquipmentSlot... aequipmentslot) {
+- super(enchantment_rarity, EnchantmentCategory.WEAPON, aequipmentslot);
+- this.type = i;
++ public DamageEnchantment(Enchantment.Rarity rarity, int type, EquipmentSlot... applicableSlots) {
++ super(rarity, EnchantmentCategory.WEAPON, applicableSlots);
++ this.type = type;
+ }
+
+ @Override
+- @Override
+- public int getMinCost(int i) {
+- return DamageEnchantment.MIN_COST[this.type] + (i - 1) * DamageEnchantment.LEVEL_COST[this.type];
++ public int getMinCost(int enchantmentLevel) {
++ return DamageEnchantment.MIN_COST[this.type] + (enchantmentLevel - 1) * DamageEnchantment.LEVEL_COST[this.type];
+ }
+
+ @Override
+- @Override
+- public int getMaxCost(int i) {
+- return this.getMinCost(i) + DamageEnchantment.LEVEL_COST_SPAN[this.type];
++ public int getMaxCost(int enchantmentLevel) {
++ return this.getMinCost(enchantmentLevel) + DamageEnchantment.LEVEL_COST_SPAN[this.type];
+ }
+
+ @Override
+- @Override
+ public int getMaxLevel() {
+ return 5;
+ }
+
+ @Override
+- @Override
+- public float getDamageBonus(int i, MobType mobtype) {
+- return this.type == 0 ? 1.0F + (float) Math.max(0, i - 1) * 0.5F : (this.type == 1 && mobtype == MobType.UNDEAD ? (float) i * 2.5F : (this.type == 2 && mobtype == MobType.ARTHROPOD ? (float) i * 2.5F : 0.0F));
++ public float getDamageBonus(int level, EnumMonsterType creatureType) {
++ return this.type == 0 ? 1.0F + (float) Math.max(0, level - 1) * 0.5F : (this.type == 1 && creatureType == EnumMonsterType.UNDEAD ? (float) level * 2.5F : (this.type == 2 && creatureType == EnumMonsterType.ARTHROPOD ? (float) level * 2.5F : 0.0F));
+ }
+
+ @Override
+- @Override
+- public boolean checkCompatibility(Enchantment enchantment) {
+- return !(enchantment instanceof DamageEnchantment);
++ public boolean checkCompatibility(Enchantment ench) {
++ return !(ench instanceof DamageEnchantment);
+ }
+
+ @Override
+- @Override
+- public boolean canEnchant(ItemStack itemstack) {
+- return itemstack.getItem() instanceof AxeItem ? true : super.canEnchant(itemstack);
++ public boolean canEnchant(ItemStack stack) {
++ return stack.getItem() instanceof AxeItem ? true : super.canEnchant(stack);
+ }
+
+ @Override
+- @Override
+- public void doPostAttack(LivingEntity livingentity, Entity entity, int i) {
+- if (entity instanceof LivingEntity) {
+- LivingEntity livingentity1 = (LivingEntity) entity;
++ public void doPostAttack(LivingEntity user, Entity target, int level) {
++ if (target instanceof LivingEntity) {
++ LivingEntity entityliving1 = (LivingEntity) target;
+
+- if (this.type == 2 && i > 0 && livingentity1.getMobType() == MobType.ARTHROPOD) {
+- int j = 20 + livingentity.getRandom().nextInt(10 * i);
++ if (this.type == 2 && level > 0 && entityliving1.getMobType() == EnumMonsterType.ARTHROPOD) {
++ int j = 20 + user.getRandom().nextInt(10 * level);
+
+- livingentity1.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, j, 3));
++ entityliving1.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, j, 3), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+ }
+ }
+