diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 4d7b092..acb56ce 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -14,6 +14,7 @@ import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfArbalest; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfBannerBearer; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfCommander; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfWarrior; +import com.zivilon.cinder_loe.entity.npc.elf.Sirrandrai; import com.zivilon.cinder_loe.entity.npc.evil_human.*; import com.zivilon.cinder_loe.entity.npc.good_human.*; import com.zivilon.cinder_loe.entity.npc.orc.MorgulOrc; @@ -284,6 +285,7 @@ public class CinderLoE { public static Item welfRelic; // Spawn eggs public static Item spawnEgg; + public static Item unitLevelTool; // Spawn lists public static LOTRSpawnList RED_DWARF; @@ -337,7 +339,7 @@ public class CinderLoE { event.registerServerCommand(new CommandCinderCharacter()); } - public void registerEntities() { // Last ID added: 56 + public void registerEntities() { // Last ID added: 58 ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock"); ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword"); @@ -406,6 +408,7 @@ public class CinderLoE { EntityRegistry.registerModEntity(NorthernOrc.class, "NorthernOrc", (entityID + 55), this, 64, 1, true); EntityRegistry.registerModEntity(EsgarothSoldier.class, "EsgarothSoldier", (entityID + 56), this, 64, 1, true); EntityRegistry.registerModEntity(TauredainTrueBlood.class, "TauredainTrueBlood", (entityID + 57), this, 64, 1, true); + EntityRegistry.registerModEntity(Sirrandrai.class, "Sirrandrai", (entityID + 58), this, 64, 1, true); } @@ -544,6 +547,7 @@ public class CinderLoE { sarumanStaff = (new SarumanStaff()).setUnlocalizedName("lotr:sarumanStaff").setTextureName("lotr:sarumanStaff"); // Relics welfRelic = (new WoodElfRelic()).setUnlocalizedName("lotr:welfRelic").setTextureName("lotr:welfRelic"); + unitLevelTool = (new unitLevelTool()).setUnlocalizedName("lotr:unitLevelTool").setTextureName("stick"); /** * Item Registation @@ -580,6 +584,10 @@ public class CinderLoE { * Frozen Dungeon **/ + // ==Admin Tools== + ItemRegistration.register(unitLevelTool, "unitLevelTool", 7000); + + // ==Food Items== ItemRegistration.register(onion, "onion", 6900); ItemRegistration.register(cabbage, "cabbage", 6901); @@ -978,6 +986,12 @@ public class CinderLoE { RenderingRegistry.registerEntityRenderingHandler(LOTREntitySauron.class, new LOTRRenderSauron()); RenderingRegistry.registerEntityRenderingHandler(UtumnoSlaveTrader.class, new RenderUtumnoSlave()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMistBlock.class, (TileEntitySpecialRenderer)new LOTRRenderUtumnoPortal()); + + RenderingRegistry.registerEntityRenderingHandler(Sirrandrai.class, new LOTRRenderElf()); + RenderingRegistry.registerEntityRenderingHandler(TauredainTrueBlood.class, new LOTRRenderTauredain()); + RenderingRegistry.registerEntityRenderingHandler(EsgarothSoldier.class, new LOTRRenderDaleMan()); + RenderingRegistry.registerEntityRenderingHandler(MorgulOrc.class, new LOTRRenderOrc()); + RenderingRegistry.registerEntityRenderingHandler(NorthernOrc.class, new LOTRRenderOrc()); } } diff --git a/src/main/java/com/zivilon/cinder_loe/CinderUnitTradeEntry.java b/src/main/java/com/zivilon/cinder_loe/CinderUnitTradeEntry.java index 8625814..e442608 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderUnitTradeEntry.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderUnitTradeEntry.java @@ -1,6 +1,7 @@ package com.zivilon.cinder_loe; import lotr.common.LOTRLevelData; +import lotr.common.entity.LOTREntities; import lotr.common.entity.npc.LOTRBannerBearer; import lotr.common.entity.npc.LOTRHireableBase; import lotr.common.entity.npc.LOTRUnitTradeEntry; @@ -19,6 +20,7 @@ public class CinderUnitTradeEntry extends LOTRUnitTradeEntry { private PledgeType pledgeType = PledgeType.NONE; private String objectivename; private static Configuration config; + private String extraInfo; static { config = new Configuration(new File("CinderLoE.cfg")); @@ -71,4 +73,21 @@ public class CinderUnitTradeEntry extends LOTRUnitTradeEntry { return StatCollector.translateToLocal((String) "lotr.unitinfo." + this.objectivename); } + public LOTRUnitTradeEntry setExtraInfo(String s) { + this.extraInfo = s; + return this; + } + + public boolean hasExtraInfo() { + return this.extraInfo != null; + } + + public String getUnitTradeName() { + if (this.mountClass == null) { + String entityName = LOTREntities.getStringFromClass(this.entityClass); + return StatCollector.translateToLocal((String)("entity." + entityName + ".name")); + } + return StatCollector.translateToLocal((String)("lotr.unit." + this.name)); + } + } diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/elf/Sirrandrai.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/elf/Sirrandrai.java new file mode 100644 index 0000000..467a10f --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/elf/Sirrandrai.java @@ -0,0 +1,82 @@ +package com.zivilon.cinder_loe.entity.npc.elf; + +import com.zivilon.cinder_loe.CinderLoE; +import lotr.common.LOTRAchievement; +import lotr.common.LOTRMod; +import lotr.common.LOTRShields; +import lotr.common.entity.ai.LOTREntityAIAttackOnCollide; +import lotr.common.entity.npc.LOTREntityHighElf; +import lotr.common.entity.npc.LOTREntityHighElfWarrior; +import lotr.common.entity.npc.LOTREntityMoredain; +import lotr.common.entity.npc.LOTRNPCMount; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + + +public class Sirrandrai extends LOTREntityHighElfWarrior { + public Sirrandrai(World world) { + super(world); + this.tasks.addTask(2, this.meleeAttackAI); + this.spawnRidingHorse = this.rand.nextInt(4) == 0; + this.npcShield = LOTRShields.ALIGNMENT_HIGH_ELF; + } + @Override + protected EntityAIBase createElfMeleeAttackAI() { + return new LOTREntityAIAttackOnCollide(this, 1.5, false); + } + + @Override + protected EntityAIBase createElfRangedAttackAI() { + return this.createElfMeleeAttackAI(); + } + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24.0); + } + + @Override + public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) { + data = super.onSpawnWithEgg(data); + int i = this.rand.nextInt(2); + if (i == 0) { + this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.polearmHighElven)); + if (this.rand.nextInt(5) == 0) { + this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon()); + this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearHighElven)); + } + } else if (i == 1) { + this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearHighElven)); + this.npcItemsInv.setSpearBackup(null); + } + this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon()); + this.npcItemsInv.setRangedWeapon(this.npcItemsInv.getMeleeWeapon()); + this.setCurrentItemOrArmor(1, new ItemStack(LOTRMod.bootsHighElven)); + this.setCurrentItemOrArmor(2, new ItemStack(LOTRMod.legsHighElven)); + this.setCurrentItemOrArmor(3, new ItemStack(LOTRMod.bodyHighElven)); + this.setCurrentItemOrArmor(4, new ItemStack(LOTRMod.helmetHighElven)); + return data; + } + + @Override + public float getAlignmentBonus() { + return 3.0f; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + if (this.isFriendlyAndAligned(entityplayer)) { + if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) { + return "highElf/elf/hired"; + } + return "highElf/warrior/friendly"; + } + return "highElf/warrior/hostile"; + } + +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/good_human/TauredainTrueBlood.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/good_human/TauredainTrueBlood.java index 65df48b..eacff72 100644 --- a/src/main/java/com/zivilon/cinder_loe/entity/npc/good_human/TauredainTrueBlood.java +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/good_human/TauredainTrueBlood.java @@ -29,10 +29,10 @@ public class TauredainTrueBlood extends LOTREntityTauredain { } private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordTauredain), new ItemStack(LOTRMod.battleaxeTauredain), new ItemStack(LOTRMod.hammerTauredain), new ItemStack(LOTRMod.spearTauredain), new ItemStack(LOTRMod.pikeTauredain)}; - private static ItemStack[] helmets = new ItemStack[]{new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainGold)}; - private static ItemStack[] bodies = new ItemStack[]{new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredainGold)}; - private static ItemStack[] legs = new ItemStack[]{new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredainGold)}; - private static ItemStack[] boots = new ItemStack[]{new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredainGold)}; + private static ItemStack[] helmets = new ItemStack[]{new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainGold, 0)}; + private static ItemStack[] bodies = new ItemStack[]{new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredainGold, 0)}; + private static ItemStack[] legs = new ItemStack[]{new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredainGold, 0)}; + private static ItemStack[] boots = new ItemStack[]{new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredainGold, 0)}; @Override public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) { data = super.onSpawnWithEgg(data); diff --git a/src/main/java/com/zivilon/cinder_loe/items/unitLevelTool.java b/src/main/java/com/zivilon/cinder_loe/items/unitLevelTool.java new file mode 100644 index 0000000..a8abbdb --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/unitLevelTool.java @@ -0,0 +1,82 @@ +package com.zivilon.cinder_loe.items; + +import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.LoECreativeTabs; +import lotr.common.entity.npc.LOTREntityNPC; +import lotr.common.entity.npc.LOTRHiredNPCInfo; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +public class unitLevelTool extends Item { + + public unitLevelTool() { + setCreativeTab(LoECreativeTabs.tabMiscLoE); + } + + public EnumAction getItemUseAction(ItemStack itemstack) { + return EnumAction.bow; + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { + List hiredNPCs = this.findHiredNPCsNearPlayer(player); + + if (!hiredNPCs.isEmpty()) { + for (LOTREntityNPC hiredNPC : hiredNPCs) { + if (hiredNPC != null && hiredNPC.hiredNPCInfo != null) { + try { + LOTRHiredNPCInfo npcInfo = hiredNPC.hiredNPCInfo; + + Method addExperienceMethod = LOTRHiredNPCInfo.class.getDeclaredMethod("addExperience", int.class); + addExperienceMethod.setAccessible(true); + + int xpToAdd = 1; + + try { + xpToAdd = Integer.parseInt(itemStack.getDisplayName()); + } catch (NumberFormatException e) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Tool name wasnt a number, applying 1 Xp instead")); + continue; + } + + addExperienceMethod.invoke(npcInfo, xpToAdd); + + + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + } + return itemStack; + } + + private List findHiredNPCsNearPlayer(EntityPlayer player) { + // Logic to find all nearby hired NPCs within a certain range + double range = 20.0D; // Set the range within which the NPCs should be found + List nearbyHiredNPCs = new ArrayList<>(); + + for (Object entity : player.worldObj.getEntitiesWithinAABB(LOTREntityNPC.class, player.boundingBox.expand(range, range, range))) { + LOTREntityNPC npc = (LOTREntityNPC) entity; + + // Check if the player has sufficient permission level (admin tool usage) + if (npc.hiredNPCInfo != null && player.canCommandSenderUseCommand(2, "")) { + nearbyHiredNPCs.add(npc); + } + } + + return nearbyHiredNPCs; + } + + +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRHiredNPCInfo.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRHiredNPCInfo.java index 94ab98f..bf6791a 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRHiredNPCInfo.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRHiredNPCInfo.java @@ -32,7 +32,7 @@ public class MixinLOTRHiredNPCInfo { public int xpLevel = 1; @Overwrite(remap = false) - private void onLevelUp() { + public void onLevelUp() { EntityPlayer hirer; if (this.theEntity.getMaxHealth() >= 60) { this.addLevelUpHealthGain((EntityLivingBase) this.theEntity); @@ -48,7 +48,7 @@ public class MixinLOTRHiredNPCInfo { } @Overwrite(remap = false) - private void addLevelUpHealthGain(EntityLivingBase gainingEntity) { + public void addLevelUpHealthGain(EntityLivingBase gainingEntity) { float healthBoost = 1.0f; IAttributeInstance attrHealth = gainingEntity.getEntityAttribute(SharedMonsterAttributes.maxHealth); attrHealth.setBaseValue(attrHealth.getBaseValue() + (double)healthBoost); @@ -63,7 +63,7 @@ public class MixinLOTRHiredNPCInfo { return this.theEntity.worldObj.func_152378_a(this.hiringPlayerUUID); } - private void spawnLevelUpFireworks() { + public void spawnLevelUpFireworks() { boolean bigLvlUp = this.xpLevel % 5 == 0; World world = this.theEntity.worldObj; ItemStack itemstack = new ItemStack(Items.fireworks); diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java index c03d821..5070c85 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java @@ -2,6 +2,7 @@ package com.zivilon.cinder_loe.mixins.overrides; import com.zivilon.cinder_loe.CinderUnitTradeEntry; import com.zivilon.cinder_loe.entity.npc.HobbitBannerBearer; +import com.zivilon.cinder_loe.entity.npc.elf.Sirrandrai; import com.zivilon.cinder_loe.entity.npc.evil_human.RhudaurSoldier; import com.zivilon.cinder_loe.entity.npc.good_human.BattleNun; import com.zivilon.cinder_loe.entity.npc.good_human.EsgarothSoldier; @@ -155,7 +156,8 @@ public class MixinLOTRUnitTradeEntries { new LOTRUnitTradeEntry(LOTREntityHighElfWarrior.class, 500, 100.0f).setPledgeExclusive(), new LOTRUnitTradeEntry(LOTREntityHighElfWarrior.class, LOTREntityHorse.class, "HighElfWarrior_Horse", 600, 200.0f).setMountArmor(LOTRMod.horseArmorHighElven).setPledgeExclusive(), new LOTRUnitTradeEntry(LOTREntityHighElfBannerBearer.class, 500, 250.0f).setPledgeExclusive(), - new LOTRUnitTradeEntry(LOTREntityHighElfBannerBearer.class, LOTREntityHorse.class, "Banner_Horse", 600, 350.0f).setMountArmor(LOTRMod.horseArmorHighElven).setPledgeExclusive()); + new LOTRUnitTradeEntry(LOTREntityHighElfBannerBearer.class, LOTREntityHorse.class, "Banner_Horse", 600, 350.0f).setMountArmor(LOTRMod.horseArmorHighElven).setPledgeExclusive(), + (new CinderUnitTradeEntry(Sirrandrai.class, LOTREntityHorse.class, "Sirrandrai", 600, 400.0F).setObjective("Lindon").setExtraInfo("Lindon")).setPledgeExclusive().setMountArmor(LOTRMod.horseArmorHighElven)); @Shadow public static LOTRUnitTradeEntries NEAR_HARADRIM_WARLORD = new LOTRUnitTradeEntries(150.0f, new LOTRUnitTradeEntry(LOTREntityNearHaradrimWarrior.class, 250, 0.0f), 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 b60fd36..debbe50 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -322,6 +322,10 @@ entity.cinder_loe.UtumnoSlaveTrader.bound.name=Slave Mule entity.cinder_loe.UtumnoSlaveTrader.name=Freed Utumno Trader entity.cinder_loe.HobbitBannerBearer.name=Hobbit Banner Bearer entity.cinder_loe.MorgulOrc.name=Minas Morgul Orc +entity.cinder_loe.EsgarothSoldier.name=Esgarothi Soldier +entity.cinder_loe.RhudaurSoldier.name=Rhudaur Soldier +entity.cinder_loe.TauredainTrueBlood.name=Taurethrim True-Blood +entity.cinder_loe.Sirrandrai.name=Rider of Sirrandrai lotr.enchant.protectWeak1=Dented lotr.enchant.protectWeak2=Defective @@ -333,7 +337,11 @@ lotr.enchant.rangedWeak3=Cracked lotr.unit.Banner_Warg=Warg Rider Banner lotr.unit.Banner_Horse=Mounted Banner Bearer lotr.unit.TestMob=Test Mob +lotr.unit.Sirrandrai=Rider of Sirrandrai + lotr.unitinfo.Angmar=To Hire this unit you must have the Angmar Objective complete. +lotr.unitinfo.Arnor=To Hire this unit you must have the Arnor Objective complete. lotr.unitinfo.Rhudaur=To Hire this unit you must have the Rhudaur Objective complete. -lotr.unitinfo.Dale=To Hire this unit you must have the Dalish Objective complete. \ No newline at end of file +lotr.unitinfo.Dale=To Hire this unit you must have the Dalish Objective complete. +lotr.unitinfo.Lindon=To Hire this unit you must have the Lindon Objective complete. \ No newline at end of file diff --git a/src/main/resources/assets/cinder_loe/sounds/boss/Battle.ogg b/src/main/resources/assets/cinder_loe/sounds/boss/Battle.ogg new file mode 100644 index 0000000..da8aeb5 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/boss/Battle.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/boss/Battle2.ogg b/src/main/resources/assets/cinder_loe/sounds/boss/Battle2.ogg new file mode 100644 index 0000000..0a78d53 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/boss/Battle2.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/boss/Spiders.ogg b/src/main/resources/assets/cinder_loe/sounds/boss/Spiders.ogg new file mode 100644 index 0000000..803ceb9 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/boss/Spiders.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/boss/Victory.ogg b/src/main/resources/assets/cinder_loe/sounds/boss/Victory.ogg new file mode 100644 index 0000000..6abc3f2 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/boss/Victory.ogg differ diff --git a/src/main/resources/assets/lotr/textures/items/cleaver.png b/src/main/resources/assets/lotr/textures/items/cleaver.png new file mode 100644 index 0000000..1b63d74 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cleaver.png differ diff --git a/src/main/resources/credits.txt b/src/main/resources/credits.txt index 860d3f7..4ebbf3c 100644 --- a/src/main/resources/credits.txt +++ b/src/main/resources/credits.txt @@ -75,5 +75,7 @@ Cleric_red ==Sounds:== KeyLime (Although Most of these are or will be taken from existing video games and sources, which will be attached to the name) -• - +• boss/Battle - Baldurs Gate 3 - Ketheric Thorm Battle Theme - Borislav Slavov +• boss/Spiders - Baldurs Gate 3 - Thorms Battle OST - Borislav Slavov +• boss/Battle2 - Baldurs Gate 3 OST - Fight Theme 916 - Ally Down - Borislav Slavov +• boss/Victory - Borislav Slavov - Baldurs Gate 3 OST - Battle - Enemy Down - Borislav Slavov