diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 9eb13fe..e8a34b9 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -74,6 +74,7 @@ import lotr.client.render.entity.*; import lotr.client.render.tileentity.LOTRRenderUtumnoPortal; import lotr.common.LOTRCreativeTabs; import lotr.common.LOTRMod; +import lotr.common.enchant.LOTREnchantment; import lotr.common.entity.animal.*; import lotr.common.entity.npc.*; import lotr.common.entity.projectile.LOTREntityGandalfFireball; @@ -225,6 +226,7 @@ public class CinderLoE { public static Item forgingKit; public static Item fieldRepairKit; public static Item cinderFurItem; + public static Item effigyOfWrath; // Common tools/weapons public static Item whip; @@ -796,10 +798,12 @@ public class CinderLoE { forgingKit = (new ForgingKit()); fieldRepairKit = new FieldRepairKit().setUnlocalizedName("lotr:field_repair_kit").setTextureName("lotr:field_repair_kit"); + effigyOfWrath = new LOTRItemEnchantment(LOTREnchantment.getEnchantmentByName("wrath")).setUnlocalizedName("lotr:effigy_of_wrath").setTextureName("lotr:effigy_of_wrath"); ItemRegistration.register(frostblade, "frostblade", 6200); ItemRegistration.register(forgingKit,"forgingKit",6001); ItemRegistration.register(fieldRepairKit,"fieldRepairKit",6002); + ItemRegistration.register(effigyOfWrath,"effigyOfWrath",6005); ItemRegistration.register(whip, "whip", 6110); ItemRegistration.register(daggervoid, "daggerVoid", 6201); ItemRegistration.register(spearsolidgold, "spearsolidgold", 6202); diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantment.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantment.java index 2c1c281..9bb8ede 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantment.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantment.java @@ -42,6 +42,7 @@ public class MixinLOTREnchantment { LOTREnchantment meleeSturdy = new LOTREnchantmentWeaponSpecial("meleeSturdy").setEnchantWeight(0).setValueModifier(1); LOTREnchantment armorSturdy = new LOTREnchantmentArmorSpecial("armorSturdy").setEnchantWeight(0).setValueModifier(1); LOTREnchantment baneNPC = new LOTREnchantmentBane("baneNPC", 4.0f, LOTREntityNPC.class).setEnchantWeight(0); + LOTREnchantment wrath = new LOTREnchantmentWeaponSpecial("wrath").setEnchantWeight(0); LOTREnchantment.allEnchantments.add(baneNPC); @@ -59,6 +60,7 @@ public class MixinLOTREnchantment { LOTREnchantment.allEnchantments.add(fireRepair); LOTREnchantment.allEnchantments.add(mountArmor); LOTREnchantment.allEnchantments.add(stealth); + LOTREnchantment.allEnchantments.add(wrath); Field enchantsByNameField = LOTREnchantment.class.getDeclaredField("enchantsByName"); enchantsByNameField.setAccessible(true); @@ -80,6 +82,7 @@ public class MixinLOTREnchantment { enchantsByName.put(fireRepair.enchantName, fireRepair); enchantsByName.put(mountArmor.enchantName, mountArmor); enchantsByName.put(stealth.enchantName, stealth); + enchantsByName.put(wrath.enchantName, wrath); } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentWeaponSpecial.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentWeaponSpecial.java new file mode 100644 index 0000000..9695192 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentWeaponSpecial.java @@ -0,0 +1,38 @@ +package com.zivilon.cinder_loe.mixins; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +import com.zivilon.cinder_loe.items.LoEGreatSword; +import lotr.common.item.LOTRItemBattleaxe; +import lotr.common.item.LOTRItemHammer; +import lotr.common.item.LOTRItemBalrogWhip; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentType; +import lotr.common.enchant.LOTREnchantmentHelper; +import lotr.common.enchant.LOTREnchantmentWeaponSpecial; +import lotr.common.item.LOTRWeaponStats; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; + +@Mixin(LOTREnchantmentWeaponSpecial.class) +public abstract class MixinLOTREnchantmentWeaponSpecial extends LOTREnchantment { + + public MixinLOTREnchantmentWeaponSpecial(String s, LOTREnchantmentType type) { + super(s, type); + } + + @Overwrite(remap = false) + public boolean canApply(ItemStack itemstack, boolean considering) { + if (super.canApply(itemstack, considering)) { + Item item = itemstack.getItem(); + if (item instanceof LOTRItemBalrogWhip && (this == LOTREnchantment.fire || this == LOTREnchantment.chill)) + return false; + if (this == LOTREnchantment.getEnchantmentByName("wrath")) + return (item instanceof LoEGreatSword || item instanceof LOTRItemBattleaxe || item instanceof LOTRItemHammer); + return true; + } + return false; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/util/DamageEvent.java b/src/main/java/com/zivilon/cinder_loe/util/DamageEvent.java index d12689d..4b1880d 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/DamageEvent.java +++ b/src/main/java/com/zivilon/cinder_loe/util/DamageEvent.java @@ -62,7 +62,10 @@ public class DamageEvent { ItemStack weapon = attacker.getHeldItem(); if (weapon != null) { if (player.isBlocking() && angleDifference >= 135 && angleDifference <=225) { - + if (LOTREnchantmentHelper.hasEnchant(weapon, LOTREnchantment.getEnchantmentByName("wrath"))) { + world.playSoundAtEntity(player, "cinder_loe:attack.wrath", 0.5F, 0.75F); + return cancel; + } if (weapon.getItem() instanceof ItemAxe || weapon.getItem() instanceof LOTRItemAxe || weapon.getItem() instanceof LOTRItemBattleaxe) { sword.damageItem((int) (event.damage *1.5), player); // Axes deal 150% the Durability damage player.clearItemInUse(); diff --git a/src/main/resources/assets/cinder_loe/lang/en_US.lang b/src/main/resources/assets/cinder_loe/lang/en_US.lang index 5467c69..aea82c4 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -58,6 +58,7 @@ item.cinder_fur_item_3.name=Obsidian Warg Fur item.cinder_fur_item_4.name=Black Bear Fur item.cinder_fur_item_5.name=Brown Bear Fur item.cinder_fur_item_6.name=Lioness Fur +item.lotr:effigy_of_wrath.name=Effigy of Wrath item.lotr:helmetJade.name=Jade Helmet item.lotr:bodyJade.name=Jade Chestplate @@ -408,6 +409,9 @@ lotr.enchant.meleeSturdy.desc.melee=Cannot degrade with low durability lotr.enchant.meleeSturdy.desc.ranged=Cannot degrade with low durability lotr.enchant.armorSturdy=Sturdy lotr.enchant.armorSturdy.desc=Cannot degrade with low durability +lotr.enchant.wrath=Wrathful +lotr.enchant.wrath.desc.melee=Attacks cannot be blocked +lotr.enchant.wrath.desc.ranged=Attacks cannot be blocked lotr.unit.Banner_Warg=Warg Rider Banner lotr.unit.Banner_Horse=Mounted Banner Bearer diff --git a/src/main/resources/assets/cinder_loe/sounds.json b/src/main/resources/assets/cinder_loe/sounds.json index 3663352..da140d2 100644 --- a/src/main/resources/assets/cinder_loe/sounds.json +++ b/src/main/resources/assets/cinder_loe/sounds.json @@ -57,5 +57,13 @@ "monkey/hurt1", "monkey/hurt2" ] + }, + "attack.wrath": + { + "category": "player", + "sounds": + [ + "attack/wrath" + ] } } diff --git a/src/main/resources/assets/cinder_loe/sounds/attack/wrath.ogg b/src/main/resources/assets/cinder_loe/sounds/attack/wrath.ogg new file mode 100644 index 0000000..250e344 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/attack/wrath.ogg differ diff --git a/src/main/resources/assets/lotr/textures/items/effigy_of_wrath.png b/src/main/resources/assets/lotr/textures/items/effigy_of_wrath.png new file mode 100644 index 0000000..0fefe67 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/effigy_of_wrath.png differ diff --git a/src/main/resources/assets/lotr/textures/items/effigy_of_wrath.png.mcmeta b/src/main/resources/assets/lotr/textures/items/effigy_of_wrath.png.mcmeta new file mode 100644 index 0000000..30601d0 --- /dev/null +++ b/src/main/resources/assets/lotr/textures/items/effigy_of_wrath.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation":{"frametime":3} +} diff --git a/src/main/resources/mixins.cinder_loe.json b/src/main/resources/mixins.cinder_loe.json index 8df1508..5221f78 100644 --- a/src/main/resources/mixins.cinder_loe.json +++ b/src/main/resources/mixins.cinder_loe.json @@ -65,7 +65,8 @@ "MixinLOTRGuiMap", "MixinLOTREntityAIOrcSkirmish", "MixinLOTREntityMountainTrollChieftain", - "overrides.MixinLOTRFaction" + "overrides.MixinLOTRFaction", + "MixinLOTREnchantmentWeaponSpecial" ], "client": [] }