From 6b6b4749600bab70e8ad7cd6698785dc69e2999a Mon Sep 17 00:00:00 2001 From: KeyLime17 Date: Tue, 13 May 2025 15:30:17 -0400 Subject: [PATCH] Utilized new util to handle incoming damage increase, added Bank banner updated localization fixed Ulukai and Warbands crashing eachother --- .../cinder_loe/CinderEventHandler.java | 44 +++++++++++++++++- .../cinder_loe/coremod/LOTRBannerAdder.java | 1 + .../world/event/UlukaiCurseHandler.java | 4 +- .../assets/cinder_loe/lang/en_US.lang | 2 +- .../assets/lotr/item/banner/banner_bank.png | Bin 0 -> 3026 bytes 5 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/assets/lotr/item/banner/banner_bank.png diff --git a/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java b/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java index 14a22ef..9d924a7 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java @@ -10,15 +10,22 @@ import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.registry.GameRegistry; +import lotr.common.LOTRAchievement; +import lotr.common.LOTRLevelData; import lotr.common.LOTRMod; import lotr.common.LOTRDimension; import lotr.common.enchant.LOTREnchantment; import lotr.common.enchant.LOTREnchantmentHelper; import lotr.common.entity.npc.LOTREntityOrc; +import lotr.common.entity.projectile.LOTREntityCrossbowBolt; +import lotr.common.entity.projectile.LOTREntityDart; +import lotr.common.entity.projectile.LOTREntitySpear; import lotr.common.item.*; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.*; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -27,6 +34,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; @@ -84,7 +92,41 @@ public class CinderEventHandler implements IFuelHandler { } } } - + @SubscribeEvent + public void onLivingAttacked(LivingAttackEvent event) { + EntityLivingBase entity = event.entityLiving; + EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase)event.source.getEntity() : null; + World world = entity.worldObj; + if (event.source instanceof EntityDamageSourceIndirect) { + ItemStack chestplate; + Entity projectile = event.source.getSourceOfDamage(); + if (projectile instanceof EntityArrow || projectile instanceof LOTREntityCrossbowBolt || projectile instanceof LOTREntityDart) { + boolean wearingAllGalvorn = true; + for (int i = 0; i < 4; ++i) { + ItemStack armour = entity.getEquipmentInSlot(i + 1); + if (armour != null && armour.getItem() instanceof ItemArmor && ((ItemArmor)armour.getItem()).getArmorMaterial() == LOTRMaterial.GALVORN.toArmorMaterial()) continue; + wearingAllGalvorn = false; + break; + } + if (wearingAllGalvorn) { + if (!world.isRemote && entity instanceof EntityPlayer) { + ((EntityPlayer)entity).inventory.damageArmor(event.ammount); + } + this.cancelAttackEvent(event); + } + } + if (!world.isRemote && entity instanceof EntityPlayer && attacker instanceof LOTREntityOrc && projectile instanceof LOTREntitySpear && (chestplate = entity.getEquipmentInSlot(3)) != null && chestplate.getItem() == LOTRMod.bodyMithril) { + LOTRLevelData.getData((EntityPlayer)entity).addAchievement(LOTRAchievement.hitByOrcSpear); + } + } + } + private void cancelAttackEvent(LivingAttackEvent event) { + event.setCanceled(true); + DamageSource source = event.source; + if (source instanceof EntityDamageSourceIndirect) { + Entity entity = source.getSourceOfDamage(); + } + } @SubscribeEvent public void onLivingAttack(LivingAttackEvent event) { Entity attacker = event.source.getEntity(); diff --git a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRBannerAdder.java b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRBannerAdder.java index 55d227f..0145b43 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRBannerAdder.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRBannerAdder.java @@ -30,6 +30,7 @@ public class LOTRBannerAdder implements IClassTransformer { register("RED", "red", 44, "GONDOR"); register("BLUE", "blue", 45, "GONDOR"); register("GREEN", "green", 46, "GONDOR"); + register("BANK", "bank", 47, "HOBBIT"); // register("TEST", "test", 43, "GONDOR"); } diff --git a/src/main/java/com/zivilon/cinder_loe/world/event/UlukaiCurseHandler.java b/src/main/java/com/zivilon/cinder_loe/world/event/UlukaiCurseHandler.java index 2640251..a30f3f4 100644 --- a/src/main/java/com/zivilon/cinder_loe/world/event/UlukaiCurseHandler.java +++ b/src/main/java/com/zivilon/cinder_loe/world/event/UlukaiCurseHandler.java @@ -8,8 +8,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; public class UlukaiCurseHandler { - private int tickCounter = 0; - public static final int INTERVAL_TICKS = 72000; // 1 hour ~~10 minutes at 20 TPS~~ + private int tickCounter = 20000; + public static final int INTERVAL_TICKS = 92000; // 1 hour ~~10 minutes at 20 TPS~~ + 20000 Ticks, to offset warband running @SubscribeEvent public void onServerTick(TickEvent.ServerTickEvent event) { 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 0036c3a..8461713 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -392,7 +392,7 @@ warband.fac.WOOD_ELF_SCOUT=Woodland Realm scouts warband.fac.RED_MOUNTAINS=Red Mountains warband.fac.RHUDEL_GOLDEN=Golden Easterlings warband.fac.LIMWAITH=Limwaith -warband.fac.RENEGADE=renegades +warband.fac.RENEGADE=Renegades pickpocket.cooldown=You need to wait before pickpocketing again. pickpocket.cooldown_alt=Maybe get your hands out of his pants first. diff --git a/src/main/resources/assets/lotr/item/banner/banner_bank.png b/src/main/resources/assets/lotr/item/banner/banner_bank.png new file mode 100644 index 0000000000000000000000000000000000000000..46c266b08820d1d30060f0199258c31b4b665cf4 GIT binary patch literal 3026 zcmdT`hdbNr7yl+gB8bo;Mvdxi1r=$lRK>2<+O;|~L613*671ZvaXs=P@ z(o|{1s@p4e)T%T_jS&3OKjZg4&*%NT&pGEg&v~CSp7Y4c!dL(<0S5p;z|_RhhQq|) zfbnqdZf%!-4)OY%I0XR!qUSe2*-8jW0N}f8YN&TTw181~+t2Q!Na8e0W6_aVo*3uN zmonjGB9xa1tF*gUx(!{^2^T^4@O;0>O|vn1Zp84Lc}kn&MpqweSBA*7lWY}GHg@`N zqP9Q(a;4tzU=S|HUUZT19+SU<)uz$(e-x_y@aEavq3T%5K^zJALIX2iz@IU$)`P^q z;0B(fTvGK?g~l%RAaxxV@u_-dyy%!BR|s&(3R)ca$~5Jrpbqy0nQa7eW1=N?Zd!+3 zM~^Sd%+&dT3E$XVADG5s*BcHI-@mVqT>?6HcQpVq?MD|X{>Q(s|E*PzNXWwhFN1+( zv|KraDTU|P>35cofDq0`>!^S17)3SI%4RvFXHy`ZuksT>qZDXoq9C>u4#FDkw)qa` zWV}(ZF@wpiZR1m`-yJWLj>)R~bIti(3i2Oa80*NemntWjdB_*`us;eH6N?1z9cc4` z0e!oAa@O|xKm^c4+b%@Bz*g1N92UX$h~rliqGc#3N8#9})ddn(RbL}5S_RUBoM|)e zW%7{qQ6OdUQwf0g*_r~O9^^_gPBJf}_Ah%JgH=+q!YscY0q55OyP-Cs4x*3j4shAH zy2h5mpgIbf#&8V^I>tK_HL01DCk%}%vVV}u6_AX#hW9w#Jo4EFqm3@Mi3KDMBZ}Hp zDV^?OlZ-9Amu0$8o#+?};__`as(7MVyylG6n5=`g@8tl60V`)*ys~U-lCa=c!E`2q4t8HIDWo6b!yijq6vAu*#3L`>xJauZR&|Otw27a1sU#p>DMY^NOiB zLjYxr${6)#N|vy8Uh(UW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