From 7b0c5db301b09be0d71bd9fc6f21707662a7e537 Mon Sep 17 00:00:00 2001 From: KeyLime17 Date: Thu, 26 Jun 2025 18:14:28 -0400 Subject: [PATCH] mouth of sauron weapon fixed, and fixed some bugs --- .../cinder_loe/CinderEventHandler.java | 10 ++++---- .../com/zivilon/cinder_loe/CinderLoE.java | 5 ++++ .../character/CharacterEventListener.java | 13 ++++++----- .../cinder_loe/coremod/LOTRWeaponLinker.java | 2 +- .../items/specials/MouthOfSauronWeapon.java | 22 +++++++++++++++--- .../assets/cinder_loe/lang/en_US.lang | 1 + .../items/large2/mouthofsauronSword.png | Bin 0 -> 629 bytes .../textures/items/mouthofsauronSword.png | Bin 0 -> 528 bytes 8 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 src/main/resources/assets/lotr/textures/items/large2/mouthofsauronSword.png create mode 100644 src/main/resources/assets/lotr/textures/items/mouthofsauronSword.png diff --git a/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java b/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java index 922b504..fa48aff 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java @@ -315,14 +315,16 @@ public class CinderEventHandler implements IFuelHandler { // Isildurs chestplate handler // Incoming damage from poison, drink poison (for lurtz bow, rip anyone who drinks a bad drink), or wither is doubled + if (event.entityLiving.worldObj.isRemote) return; + if (!(event.entityLiving instanceof EntityPlayerMP)) return; + EntityPlayerMP player = (EntityPlayerMP) event.entityLiving; ItemStack chest = player.getEquipmentInSlot(2); if (chest == null || chest.getItem() != CinderLoE.bodyIsildur) return; - boolean isPoison = player.isPotionActive(Potion.poison.id); - boolean isPoisonedDrink = player.isPotionActive(LOTRPoisonedDrinks.killingPoison.id); - boolean isWitherDamage = event.source == DamageSource.wither; - if (isPoisonedDrink || isWitherDamage || isPoison) { + boolean isDrinkPoison = player.isPotionActive(LOTRPoisonedDrinks.killingPoison.id); + boolean isWither = event.source == DamageSource.wither; + if (isDrinkPoison || isWither) { event.ammount *= 2.0F; } } diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 58abc11..9eb13fe 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -332,6 +332,7 @@ public class CinderLoE { public static Item alatarStaff; public static Item sarumanStaff; public static Item sarumanWhiteStaff; + public static Item mouthofsauronSword; // Relics public static Item welfRelic; @@ -728,18 +729,22 @@ public class CinderLoE { alatarStaff = (new AlatarStaff()).setUnlocalizedName("lotr:alatarStaff").setTextureName("lotr:alatarStaff"); sarumanStaff = (new SarumanStaff()).setUnlocalizedName("lotr:sarumanStaff").setTextureName("lotr:sarumanStaff"); sarumanWhiteStaff = (new SarumanWhiteStaff()).setUnlocalizedName("lotr:sarumanWhiteStaff").setTextureName("lotr:sarumanStaff"); + mouthofsauronSword = (new MouthOfSauronWeapon()).setUnlocalizedName("lotr:mouthofsauronSword").setTextureName("lotr:mouthofsauronSword"); ItemRegistration.register(radagastStaff, "radagastStaff", 6700); ItemRegistration.register(pallandoStaff, "pallandoStaff", 6701); ItemRegistration.register(alatarStaff, "alatarStaff", 6702); ItemRegistration.register(sarumanStaff, "sarumanStaff", 6703); ItemRegistration.register(sarumanWhiteStaff, "sarumanWhiteStaff", 6705); + ItemRegistration.register(mouthofsauronSword, "mouthofsauronSword", 6711); linkLOTRWeapon(radagastStaff, "radagastStaff"); linkLOTRWeapon(pallandoStaff, "pallandoStaff"); linkLOTRWeapon(alatarStaff, "alatarStaff"); linkLOTRWeapon(sarumanStaff, "sarumanStaff"); linkLOTRWeapon(sarumanWhiteStaff, "sarumanWhiteStaff"); + linkLOTRWeapon(mouthofsauronSword, "mouthofsauronSword"); + // Relics welfRelic = (new WoodElfRelic()).setUnlocalizedName("lotr:welfRelic").setTextureName("lotr:welfRelic"); diff --git a/src/main/java/com/zivilon/cinder_loe/character/CharacterEventListener.java b/src/main/java/com/zivilon/cinder_loe/character/CharacterEventListener.java index 518dd0a..dcea738 100644 --- a/src/main/java/com/zivilon/cinder_loe/character/CharacterEventListener.java +++ b/src/main/java/com/zivilon/cinder_loe/character/CharacterEventListener.java @@ -45,35 +45,36 @@ public class CharacterEventListener { //Mouth of Sauron event handler @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { - if (event.phase != TickEvent.Phase.END || event.player.worldObj.isRemote) return; + if (event.phase != TickEvent.Phase.END || event.player.worldObj.isRemote) { + return; + } EntityPlayerMP player = (EntityPlayerMP) event.player; UUID id = player.getUniqueID(); - - // Only “MouthOfSauron” gets this ability - if (!CharacterRoleAPI.getCharacterRoleUUID("MouthOfSauron").equals(id)) { + UUID mosId = CharacterRoleAPI.getCharacterRoleUUID("MouthOfSauron"); + if (mosId == null || !mosId.equals(id)) { tickCounters.remove(id); hiringEnabled.remove(id); return; } + if (!hiringEnabled.contains(id)) { tickCounters.remove(id); return; } - // Tick up, and only run when we hit the interval int count = tickCounters.getOrDefault(id, 0) + 1; if (count < HIRE_INTERVAL) { tickCounters.put(id, count); return; } tickCounters.put(id, 0); - //player.addChatMessage(new ChatComponentText("[DEBUG] tryHireNPCs called")); tryHireNPCs(player); } + private static void tryHireNPCs(EntityPlayerMP player) { World world = player.worldObj; UUID playerId = player.getUniqueID(); diff --git a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java index 343e52f..2a20799 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java @@ -20,7 +20,7 @@ public class LOTRWeaponLinker implements IClassTransformer { // Can add any number of items, append with comma return addLinks(basicClass, "spearRedDwarf", "crossbowRedDwarf", "swordRedDwarf", "battleaxeRedDwarf", "pikeRedDwarf", "daggerRedDwarf", "daggerRedDwarfPoisoned", "hammerRedDwarf", - "radagastStaff", "alatarStaff", "pallandoStaff", "sarumanStaff", "maceWarlord", "sarumanWhiteStaff", + "radagastStaff", "alatarStaff", "pallandoStaff", "sarumanStaff", "maceWarlord", "sarumanWhiteStaff", "mouthofsauronSword", "spearLimwaith", "tridentLimwaith", "daggerLimwaith", "daggerLimwaithPoisoned", "truncheonLimwaith", "battleaxeLimwaith", "blowgunLimwaith", "frostblade", "spearsolidgold", "whip", "spearUnnamed", "welfRelic", "daggerVoid", "swordBree", "greatswordAngmar", "greatswordLindon", "greatswordDale", "greatswordNumenor", diff --git a/src/main/java/com/zivilon/cinder_loe/items/specials/MouthOfSauronWeapon.java b/src/main/java/com/zivilon/cinder_loe/items/specials/MouthOfSauronWeapon.java index 2a04c64..7f6d19e 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/specials/MouthOfSauronWeapon.java +++ b/src/main/java/com/zivilon/cinder_loe/items/specials/MouthOfSauronWeapon.java @@ -5,14 +5,17 @@ import lotr.common.LOTRLevelData; import lotr.common.LOTRMod; import lotr.common.entity.animal.LOTREntityHorse; import lotr.common.fac.LOTRFaction; +import lotr.common.item.LOTRItemAxe; import lotr.common.item.LOTRItemSword; import lotr.common.item.LOTRMaterial; +import lotr.common.item.LOTRStoryItem; import lotr.common.network.LOTRPacketHandler; import lotr.common.network.LOTRPacketWeaponFX; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.util.DamageSource; @@ -21,12 +24,11 @@ import net.minecraft.world.World; import java.util.List; -public class MouthOfSauronWeapon extends LOTRItemSword { +public class MouthOfSauronWeapon extends LOTRItemSword implements LOTRStoryItem { public MouthOfSauronWeapon() { super(LOTRMaterial.MORDOR); this.setMaxDamage(1500); - this.lotrWeaponDamage = 8.0f; } public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { @@ -38,7 +40,7 @@ public class MouthOfSauronWeapon extends LOTRItemSword { user.swingItem(); world.playSoundAtEntity((Entity)user, "mob.wither.hurt", 2.0f, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2f + 1.0f); if (!world.isRemote) { - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, user.boundingBox.expand(12.0, 8.0, 12.0)); + List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, user.boundingBox.expand(6.0, 6.0, 6.0)); if (!entities.isEmpty()) { for (int i = 0; i < entities.size(); ++i) { EntityLiving entityliving; @@ -66,4 +68,18 @@ public class MouthOfSauronWeapon extends LOTRItemSword { return itemstack; } + public int getMaxItemUseDuration(ItemStack itemstack) { + return 40; + } + + @Override + public EnumAction getItemUseAction(ItemStack itemstack) { + return EnumAction.bow; + } + + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { + entityplayer.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack)); + return itemstack; + } } 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 c343887..5467c69 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -106,6 +106,7 @@ item.lotr:pallandoStaff.name=Staff of Pallando the Blue item.lotr:alatarStaff.name=Staff of Alatar the Blue item.lotr:sarumanStaff.name=Staff of Saruman of Many Colors item.lotr:sarumanWhiteStaff.name=Staff of Saruman the White +item.lotr:mouthofsauronSword.name=Sword of the Lieutenant item.lotr:welfRelic.name=Horn of the Greenwood Stag item.lotr:ulukai.name=Ulûkai diff --git a/src/main/resources/assets/lotr/textures/items/large2/mouthofsauronSword.png b/src/main/resources/assets/lotr/textures/items/large2/mouthofsauronSword.png new file mode 100644 index 0000000000000000000000000000000000000000..6e95b95b516f8ab7715a38453c1cfe5c499bbd1e GIT binary patch literal 629 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NS%G|oWRD45dI*UL`OvSj}Ky5HFasE6@fg!ItFh z?!w^4;K2~TdTm=bP=vF?^egBLG~e~6r$`I}*%qvJub<4&1g znFn7ynEOd!`DM}Q42@^^R1W>U*7D)+^MC4`2^%AHriru&=(If8zb^cgo}FBO@cZIZ z8uBcR{cg$(2Xf4uWsaY_Ij3P#{QB$9uYXtIu;6i?=c6XmmYDV3JAC2eljc&qXP$q) z@@k6Kft8<@a!hdD_kkhuDL3x|=Y1O(c0J+dTo7#conhD0-n!1&SCTG&I>z)wb-iiB zq`aW+-_3D)pQ6egSYPm0Md(eR5M;IN>DF+MJ0^mzf(#8EJ*TB#+6iua|N9TahWqb6 zm010~9{+S@NU2?p`u40tf0!P8`zzWnE_$T!jlf04mMNQRtQUN^9b5KV@6lPl@Hk%2 zNem2a-<@^BxYvHVDGxSv)4|TbpQQ#`zKd#pK$rUl{H}Qf7_pXR-_5CGhF?t^u+jmLv;Daoj;APmdKI;Vst01D;;ZU6uP literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lotr/textures/items/mouthofsauronSword.png b/src/main/resources/assets/lotr/textures/items/mouthofsauronSword.png new file mode 100644 index 0000000000000000000000000000000000000000..c1294d9153361599cb4b38f837c78fd3918ff3c1 GIT binary patch literal 528 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jPK-BC>eK@{Ea{HEjtmSN z`?>!lvI6-E$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4`yP3;CTcLeir8@ZGIw&KZzYf*~=O9Xfpd}6z(kyK`^>>IpQKgMK-h4u65pUuU54JT7JiSKz9o2`3H zVkfKN+j%|5A8*}qI)wE^@cQeoKXJtDvn%9}$iAAjVfF2sx10o6E@hbP_*{Fh_h4## z#@eOzclBEtS1r3M%&`9D$3Neiiv6x;nSQLD|1Na;&%=8}^wd7glKb{p_<2m>MQh8y z;%qC@ZcfsPUMKs{antMcyjS8koY$LFwzfwC1C}o}!ZXd+mq822<^W<4xD-4YM0vXU KxvX