diff --git a/gradle.properties b/gradle.properties index a61743f..2f8e6bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ modName = CinderLoE -modVersion = 1.5.0 +modVersion = 1.5.2 modId = cinder_loe modGroup = com.zivilon.cinder_loe diff --git a/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java b/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java index d7ba2f0..8f7089e 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java @@ -8,10 +8,20 @@ public class CinderAchievement { public static LOTRAchievement tameMonkey; public static LOTRAchievement pickOlog; + public static LOTRAchievement spiceOrcBrew; + public static LOTRAchievement spiceHumanBrew; + public static LOTRAchievement spiceElfBrew; + public static LOTRAchievement spiceDwarfBrew; + public static LOTRAchievement Overdose; public static void createAchievements() { tameMonkey = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 78, LOTRMod.banana, "tameMonkey"); pickOlog = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 79, Items.skull, "pickpocketOlog"); + spiceOrcBrew = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 80,CinderLoE.spiceOrcish , "spiceOrcBrew"); + spiceHumanBrew = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 81,CinderLoE.spiceHuman , "spiceHumanBrew"); + spiceElfBrew = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 82,CinderLoE.spiceElven , "spiceElfBrew"); + spiceDwarfBrew = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 83,CinderLoE.spiceDwarven , "spiceDwarfBrew"); + Overdose = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 84, LOTRMod.barrel , "Overdose"); } } diff --git a/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java b/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java index 90629d6..9d924a7 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderEventHandler.java @@ -1,21 +1,31 @@ package com.zivilon.cinder_loe; import com.zivilon.cinder_loe.entity.corrupt.CorruptMan; +import com.zivilon.cinder_loe.entity.projectile.EntityElvenArrow; import com.zivilon.cinder_loe.items.specials.BrokenHalo; import com.zivilon.cinder_loe.network.PacketWarbandLocations; +import com.zivilon.cinder_loe.util.RangedDamageUtil; import cpw.mods.fml.common.FMLCommonHandler; 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; @@ -24,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; @@ -81,34 +92,77 @@ 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(); - if (attacker instanceof EntityPlayerMP player) { - ItemStack weapon = player.getHeldItem(); - // smithing rework for melee - if (weapon != null && (weapon.getItem() instanceof LOTRItemSpear || weapon.getItem() instanceof LOTRItemSword || weapon.getItem() instanceof LOTRItemDagger || weapon.getItem() instanceof LOTRItemBattleaxe || weapon.getItem() instanceof LOTRItemHammer || weapon.getItem() instanceof ItemSword)) { - float[] durabilityThresholds = {0.5f, 0.4f, 0.25f}; - double[] probabilities = {0.0005, 0.001, 0.005}; // Corrected probabilities - if (weapon.isItemStackDamageable()) { - // Corrected durabilityPercent calculation - float durabilityPercent = (float) (weapon.getMaxDamage() - weapon.getItemDamage()) / weapon.getMaxDamage(); - - for (int j = 0; j < durabilityThresholds.length; j++) { - if (durabilityPercent <= durabilityThresholds[j] && random.nextDouble() <= probabilities[j]) { - addNegativeModifier(weapon, player, "weapon"); - break; // Exit loop once a modifier is added - } - } + if (!(attacker instanceof EntityPlayerMP player)) return; + + ItemStack weapon = player.getHeldItem(); + if (weapon == null) return; + boolean isMelee = weapon.getItem() instanceof LOTRItemSpear + || weapon.getItem() instanceof LOTRItemSword + || weapon.getItem() instanceof LOTRItemDagger + || weapon.getItem() instanceof LOTRItemBattleaxe + || weapon.getItem() instanceof LOTRItemHammer + || weapon.getItem() instanceof ItemSword; + if (!isMelee || !weapon.isItemStackDamageable()) return; + + float[] durabilityThresholds = {0.5f, 0.4f, 0.25f}; + double[] probabilities = {0.0005, 0.001, 0.005}; + LOTREnchantment sturdy = LOTREnchantment.getEnchantmentByName("meleeSturdy"); + boolean hasSturdy = LOTREnchantmentHelper.hasEnchant(weapon, sturdy); + + float durabilityPercent = (weapon.getMaxDamage() - weapon.getItemDamage()) / (float)weapon.getMaxDamage(); + for (int i = 0; i < durabilityThresholds.length; i++) { + if (durabilityPercent <= durabilityThresholds[i]) { + double chance = probabilities[i] * (hasSturdy ? 0.5 : 1.0); + if (random.nextDouble() <= chance) { + addNegativeModifier(weapon, player, "weapon"); } + break; } } } @SubscribeEvent public void onLivingHurt(LivingHurtEvent event) { + if (event.entityLiving == null || event.source.getEntity() == null) { return; } @@ -118,64 +172,11 @@ public class CinderEventHandler implements IFuelHandler { World world = entity.worldObj; DamageSource source = event.source; - /* Blocking event handler removed and replaced with one in DamageEvent class. Temporarily stored for backup reasons. - - if (event.entity instanceof EntityPlayer && !source.isUnblockable()) { - EntityPlayerMP player = (EntityPlayerMP) event.entity; - ItemStack sword = player.getHeldItem(); - - - float playerYaw = player.getRotationYawHead(); - float attackerYaw = attacker.getRotationYawHead(); - -// Normalize both angles to be within 0 - 360 - playerYaw = (playerYaw + 360) % 360; - attackerYaw = (attackerYaw + 360) % 360; - -// Calculate the angle difference - float angleDifference = Math.abs(playerYaw - attackerYaw); - - if (angleDifference > 180) { - angleDifference = 360 - angleDifference; - } - ItemStack weapon = attacker.getHeldItem(); - if (weapon != null) { - if (player.isBlocking() && angleDifference >= 135 && angleDifference <=225) { - - float additionalDamage = 0.0f; - if (weapon.getItem() instanceof ItemAxe || weapon.getItem() instanceof LOTRItemAxe || weapon.getItem() instanceof LOTRItemBattleaxe) { - sword.damageItem((int) (event.ammount *1.5), player); // Axes deal 150% the Durability damage - player.clearItemInUse(); - world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F); - additionalDamage = 0.75f; // Only 25% Passes through - } else if (weapon.getItem() instanceof LOTRItemHammer) { - sword.damageItem((int) event.ammount, player); // Hammers bypass the block better, but only deal 100% of the durability damage - player.clearItemInUse(); - world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F); - additionalDamage = 0.5f; // Only 50% Passes through - } else { - additionalDamage = 0.0f; // 0% Damage Passes through - sword.damageItem((int) (event.ammount/2), player); //Swords only deal 50% of durability damage - player.clearItemInUse(); - world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F); - } - - float newDamage = event.ammount * (additionalDamage); // Calculate new damage - float newHealth = player.getHealth() - (newDamage - event.ammount); // Calculate health after applying extra damage - - if (newHealth > 0) { - player.setHealth(newHealth); - event.setCanceled(true); - } else { - event.ammount = player.getHealth(); // Ensure player dies if health reaches 0 or below - } - - } - } + //Elven Arrow, deals more damage to orc kind + // Utilizing the new Util, test if it works! + if (!world.isRemote && entity instanceof LOTREntityOrc && event.source.getSourceOfDamage() instanceof EntityElvenArrow) { + RangedDamageUtil.applyExtraDamage(event, 0.2f); // increase damage by 20% } - */ - - // Negative Arrow Protection Handler if (!event.entityLiving.worldObj.isRemote && event.source.isProjectile() && event.entityLiving instanceof EntityPlayerMP player) { @@ -243,7 +244,9 @@ public class CinderEventHandler implements IFuelHandler { } // Smithing Rework event handler - if (attacker instanceof EntityPlayerMP player) { + + //Removed, there is a handler for when you already attack, this is redundant + /*if (attacker instanceof EntityPlayerMP player) { ItemStack weapon = player.getHeldItem(); // smithing rework for melee if (weapon !=null && (weapon.getItem() instanceof LOTRItemSpear || weapon.getItem() instanceof LOTRItemSword || weapon.getItem() instanceof LOTRItemDagger || weapon.getItem() instanceof LOTRItemBattleaxe || weapon.getItem() instanceof LOTRItemHammer || weapon.getItem() instanceof ItemSword)) { @@ -260,26 +263,32 @@ public class CinderEventHandler implements IFuelHandler { } } } - } + }*/ if (entity instanceof EntityPlayerMP player) { // Durability thresholds and corresponding probabilities for adding a negative modifier - float[] durabilityThresholds = {0.6f, 0.5f, 0.4f}; - double[] probabilities = {0.02, 0.05, 0.1}; + float[] durabilityThresholds = {0.4f, 0.3f, 0.2f}; + double[] probabilities = {0.0005, 0.001, 0.005}; + LOTREnchantment sturdyArmor = LOTREnchantment.getEnchantmentByName("armorSturdy"); - for (int i = 0; i < 4; ++i) { - ItemStack armor = player.getEquipmentInSlot(i + 1); - if (armor != null && armor.isItemStackDamageable()) { - float durabilityPercent = (float) (armor.getMaxDamage() - armor.getItemDamage()) / armor.getMaxDamage(); - // Check each threshold and apply negative modifier if conditions are met - for (int j = 0; j < durabilityThresholds.length; j++) { - if (durabilityPercent <= durabilityThresholds[j] && random.nextDouble() <= probabilities[j]) { + for (int slot = 1; slot <= 4; slot++) { + ItemStack armor = player.getEquipmentInSlot(slot); + if (armor == null || !armor.isItemStackDamageable()) continue; + + float durabilityPercent = (armor.getMaxDamage() - armor.getItemDamage()) / (float)armor.getMaxDamage(); + boolean hasSturdy = LOTREnchantmentHelper.hasEnchant(armor, sturdyArmor); + + for (int i = 0; i < durabilityThresholds.length; i++) { + if (durabilityPercent <= durabilityThresholds[i]) { + double chance = probabilities[i] * (hasSturdy ? 0.5 : 1.0); + if (random.nextDouble() <= chance) { addNegativeModifier(armor, player, "armor"); - break; // Exit loop once a modifier is added } + break; } } } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 8b96e0c..e058762 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -15,6 +15,7 @@ import com.zivilon.cinder_loe.command.CommandWarband; import com.zivilon.cinder_loe.command.CommandUnitConversion; import com.zivilon.cinder_loe.entity.*; import com.zivilon.cinder_loe.entity.animals.Monkey; +import com.zivilon.cinder_loe.entity.boss.CryptBoss; import com.zivilon.cinder_loe.entity.corrupt.*; import com.zivilon.cinder_loe.entity.npc.*; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfArbalest; @@ -95,11 +96,11 @@ import static lotr.common.LOTRMod.horseArmorIron; @Mod( modid = "cinder_loe", - version = "1.5.0", + version = "1.5.2", name = "CinderLoE", dependencies = "required-after:spongemixins@[1.1.0,);required-after:lotr", acceptedMinecraftVersions = "[1.7.10]", - acceptableRemoteVersions = "[1.5.0]") + acceptableRemoteVersions = "[1.5.2]") public class CinderLoE { @Instance("cinder_loe") @@ -121,6 +122,7 @@ public class CinderLoE { public static LOTRMaterial MATERIAL_USURPER; public static LOTRMaterial MATERIAL_WARLORD; public static LOTRMaterial MATERIAL_JADE; + public static LOTRMaterial MATERIAL_GILDEDGALVORN; // Blocks // public static Block barricade; @@ -175,6 +177,7 @@ public class CinderLoE { public static Item pasta; public static Item pretzel; public static Item halva; + public static Item flatbread; // public static Item honey; public static Item doner_kebab; @@ -235,6 +238,10 @@ public class CinderLoE { public static Item legsWarlord; public static Item bootsWarlord; public static Item maceWarlord; + public static Item helmetGildedGalvorn; + public static Item bodyGildedGalvorn; + public static Item legsGildedGalvorn; + public static Item bootsGildedGalvorn; // public static Item bowserpent; //public static Item swordUsurper; @@ -375,7 +382,7 @@ public class CinderLoE { // event.registerServerCommand(new CommandMobileSound()); } - public void registerEntities() { // Last ID added: 63 + public void registerEntities() { // Last ID added: 65 ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock"); ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword"); @@ -414,6 +421,8 @@ public class CinderLoE { EntityRegistry.registerModEntity(LOTREntitySauron.class, "LOTREntitySauron", (entityID + 28), this, 64, 1, true); EntityRegistry.registerModEntity(UtumnoSlaveTrader.class, "UtumnoSlaveTrader", (entityID + 30), this, 64, 1, true); EntityRegistry.registerModEntity(Monkey.class, "Monkey", (entityID + 62), this, 64, 1, true); + EntityRegistry.registerModEntity(CryptBoss.class, "CryptBoss", (entityID + 63), this, 64, 1, true); + EntityRegistry.registerModEntity(EntityMorgulBlast.class, "EntityMorgulBlast", (entityID + 65), this, 64, 1, true); @@ -583,6 +592,7 @@ public class CinderLoE { pretzel = new LOTRItemFood(4,1.0f, false).setUnlocalizedName("lotr:pretzel").setTextureName("lotr:pretzel"); halva = new LOTRItemFood (7, 4.0f, false).setUnlocalizedName("lotr:halva").setTextureName("lotr:halva"); doner_kebab = new LOTRItemFood (6, 6.0f, false).setUnlocalizedName("lotr:doner_kebab").setTextureName("lotr:doner_kebab"); + flatbread = new LOTRItemFood (3, 8.0f, false).setUnlocalizedName("lotr:flatbread").setTextureName("lotr:flatbread"); // honey = new LOTRItemFood(3, 0.4f, false).setPotionEffect(Potion.regeneration.id, 5, 0, 100).setUnlocalizedName("lotr:honey").setTextureName("lotr:honey"); spiceElven = new Item().setUnlocalizedName("lotr:spice_elven").setTextureName("lotr:spice_elven"); spiceHuman = new Item().setUnlocalizedName("lotr:spice_human").setTextureName("lotr:spice_human"); @@ -592,7 +602,7 @@ public class CinderLoE { mugElfBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.moveSpeed.id, 60, 1).toxic().setUnlocalizedName("lotr:mugElfBrew"); mugHumanBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.regeneration.id, 60, 1).toxic().setUnlocalizedName("lotr:mugHumanBrew"); - mugOrcBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.damageBoost.id, 60, 1).toxic().setUnlocalizedName("lotr:mugOrcBrew"); + mugOrcBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.damageBoost.id, 60, 1).toxic().setDamageAmount(2).setUnlocalizedName("lotr:mugOrcBrew"); mugDwarfBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.field_76443_y.id, 120).toxic().setUnlocalizedName("lotr:mugDwarfBrew"); ((LoEItemMug)mugElfBrew).setTextureNameFromUnlocalizedName(); ((LoEItemMug)mugHumanBrew).setTextureNameFromUnlocalizedName(); @@ -675,6 +685,7 @@ public class CinderLoE { ItemRegistration.register(spiceOrcish, "spiceOrcish",6920); ItemRegistration.register(spiceDwarven, "spiceDwarven",6921); ItemRegistration.register(spiceIngredient, "spiceIngredient",6922); + ItemRegistration.register(flatbread, "flatbread",6923); ItemRegistration.register(spawnEgg, "spawnEgg", 6003); @@ -742,11 +753,13 @@ public class CinderLoE { warDartHeads = (new WarDartHeads()).setUnlocalizedName("war_dart_heads").setTextureName("lotr:war_dart_heads_0"); ItemRegistration.register(cleaver,"cleaver",6109); - linkLOTRWeapon(cleaver, "cleaver"); + ItemRegistration.register(warDart,"warDart",6111); ItemRegistration.register(warDartHeads,"warDartHeads",6500); + //Override Galvorn Helmet with new model texture + LOTRMod.helmetGalvorn = new LOTRItemArmor(LOTRMaterial.GALVORN, 0, "helmet").setUnlocalizedName("lotr:helmetGalvorn"); //ASH MATERIAL_ASH = getLOTRMaterialByName("ASH"); @@ -906,7 +919,7 @@ public class CinderLoE { linkLOTRWeapon(swordBree, "swordBree"); //Elite Armors - //Elite Armors + MATERIAL_SERPENT = getLOTRMaterialByName("SERPENT"); if (MATERIAL_SERPENT != null) { helmetserpent = (new LOTRItemArmor(MATERIAL_SERPENT, 0)).setUnlocalizedName("lotr:helmetserpent").setTextureName("lotr:helmetserpent").setCreativeTab(null); @@ -955,6 +968,22 @@ public class CinderLoE { } linkLOTRWeapon(maceWarlord, "maceWarlord"); + MATERIAL_GILDEDGALVORN = getLOTRMaterialByName("GILDEDGALVORN"); + if (MATERIAL_GILDEDGALVORN != null) { + helmetGildedGalvorn = (new LOTRItemArmor(MATERIAL_GILDEDGALVORN, 0, "helmet")).setUnlocalizedName("lotr:helmetGildedGalvorn").setTextureName("lotr:helmetGildedGalvorn").setCreativeTab(null); + bodyGildedGalvorn = (new LOTRItemArmor(MATERIAL_GILDEDGALVORN, 1)).setUnlocalizedName("lotr:bodyGildedGalvorn").setTextureName("lotr:bodyGildedGalvorn").setCreativeTab(null); + legsGildedGalvorn = (new LOTRItemArmor(MATERIAL_GILDEDGALVORN, 2)).setUnlocalizedName("lotr:legsGildedGalvorn").setTextureName("lotr:legsGildedGalvorn").setCreativeTab(null); + bootsGildedGalvorn = (new LOTRItemArmor(MATERIAL_GILDEDGALVORN, 3)).setUnlocalizedName("lotr:bootsGildedGalvorn").setTextureName("lotr:bootsGildedGalvorn").setCreativeTab(null); + + ItemRegistration.register(helmetGildedGalvorn, "helmetGildedGalvorn", 6813); + ItemRegistration.register(bodyGildedGalvorn, "bodyGildedGalvorn", 6814); + ItemRegistration.register(legsGildedGalvorn, "legsGildedGalvorn", 6815); + ItemRegistration.register(bootsGildedGalvorn, "bootsGildedGalvorn", 6816); + } else { + System.err.println("Failed to find WARLORD material for armor initialization."); + } + + //Rhudaur MATERIAL_RHUDAUR = getLOTRMaterialByName("RHUDAUR"); if (MATERIAL_RHUDAUR != null) { @@ -1016,6 +1045,7 @@ public class CinderLoE { // RenderingRegistry.registerEntityRenderingHandler(DwarfLevy.class, new LOTRRenderDwarf()); RenderingRegistry.registerEntityRenderingHandler(EntityWarDart.class, new RenderWarDart()); + RenderingRegistry.registerEntityRenderingHandler(EntityMorgulBlast.class, new RenderMorgulBlast()); RenderingRegistry.registerEntityRenderingHandler(BladorthinSmith.class, new LOTRRenderDorwinionElfVintner()); RenderingRegistry.registerEntityRenderingHandler(DarkSpider.class, new RenderDarkSpider()); RenderingRegistry.registerEntityRenderingHandler(CorruptDwarf.class, new RenderCorruptDwarf()); @@ -1033,6 +1063,7 @@ public class CinderLoE { RenderingRegistry.registerEntityRenderingHandler(RenegadeCaptain.class, new RenderRenegade()); RenderingRegistry.registerEntityRenderingHandler(Wraith.class, new RenderWraith()); RenderingRegistry.registerEntityRenderingHandler(Monkey.class, new RenderMonkey()); + RenderingRegistry.registerEntityRenderingHandler(CryptBoss.class, new RenderCryptBoss()); RenderingRegistry.registerEntityRenderingHandler(RedDwarfWarrior.class, new LOTRRenderDwarf()); RenderingRegistry.registerEntityRenderingHandler(RedDwarfArbalest.class, new LOTRRenderDwarf()); @@ -1336,6 +1367,7 @@ public class CinderLoE { CinderCore.registerEntityFallback(Renegade.class, LOTREntityBandit.class, "cinder_loe", "1.0"); CinderCore.registerEntityFallback(RenegadeCaptain.class, LOTREntityBandit.class, "cinder_loe", "1.1"); CinderCore.registerEntityFallback(Wraith.class, LOTREntityMarshWraith.class, "cinder_loe", "1.0"); + CinderCore.registerEntityFallback(CryptBoss.class, LOTREntityMarshWraith.class, "cinder_loe", "1.0"); CinderCore.registerEntityFallback(LOTREntitySauron.class, LOTREntityBarrowWight.class, "cinder_loe", "1.1"); CinderCore.registerEntityFallback(RedDwarfWarrior.class, LOTREntityDwarfWarrior.class, "cinder_loe", "1.0"); diff --git a/src/main/java/com/zivilon/cinder_loe/Materials.java b/src/main/java/com/zivilon/cinder_loe/Materials.java index da30bc0..829ba7f 100644 --- a/src/main/java/com/zivilon/cinder_loe/Materials.java +++ b/src/main/java/com/zivilon/cinder_loe/Materials.java @@ -25,6 +25,7 @@ public class Materials { modifyMaterial("USURPER",650, 2.0F, 0.6F, 2, 6.0F, 10, Items.iron_ingot); modifyMaterial("WARLORD", 650, 2.0F, 0.6F, 2, 6.0F, 10, LOTRMod.bronze); modifyMaterial("JADE",2400, 5.0F, 0.8F, 0, 9.0F, 10, LOTRMod.emerald); + modifyMaterial("GILDEDGALVORN",600, 3.0F, 0.6F, 2, 7.0F, 15, LOTRMod.galvorn); } public static void modifyMaterial(String fieldName, int uses, float weapon_damage, float protection, int harvest_level, float speed, int enchantability, Item crafting_item) { diff --git a/src/main/java/com/zivilon/cinder_loe/carriage/CarriageDestinationsData.java b/src/main/java/com/zivilon/cinder_loe/carriage/CarriageDestinationsData.java index bd3a25a..d4afe8c 100644 --- a/src/main/java/com/zivilon/cinder_loe/carriage/CarriageDestinationsData.java +++ b/src/main/java/com/zivilon/cinder_loe/carriage/CarriageDestinationsData.java @@ -8,6 +8,7 @@ import net.minecraft.world.WorldServer; import net.minecraft.world.storage.MapStorage; import java.util.*; +import java.util.function.BiPredicate; public class CarriageDestinationsData extends WorldSavedData { public static final String DATA_NAME = "carriage_destinations"; @@ -76,73 +77,77 @@ public class CarriageDestinationsData extends WorldSavedData { } public List getNearestFour(double px, double pz) { - CarriageDestination north = null, south = null, east = null, west = null; - double nDist = Double.MAX_VALUE, sDist = Double.MAX_VALUE, eDist = Double.MAX_VALUE, wDist = Double.MAX_VALUE; - - Set alreadyPicked = new HashSet<>(); - - for (CarriageDestination dest : destinations.values()) { - double dx = dest.x - px; - double dz = dest.z - pz; - double distance = Math.sqrt(dx * dx + dz * dz); - - if (distance < 10) { - continue; // skip nearby - } - - // north - if (dz < 0 && Math.abs(dz) < nDist && !alreadyPicked.contains(dest)) { - nDist = Math.abs(dz); - north = dest; - } - // south - if (dz > 0 && dz < sDist && !alreadyPicked.contains(dest)) { - sDist = dz; - south = dest; - } - // east - if (dx > 0 && dx < eDist && !alreadyPicked.contains(dest)) { - eDist = dx; - east = dest; - } - // west - if (dx < 0 && Math.abs(dx) < wDist && !alreadyPicked.contains(dest)) { - wDist = Math.abs(dx); - west = dest; - } + double skipRadius = 100; + Set picked = new HashSet<>(); + List result = new ArrayList<>(4); + + // north + CarriageDestination best = null; + double bestDist = Double.MAX_VALUE; + for (CarriageDestination d : destinations.values()) { + if (picked.contains(d)) continue; + double dx = d.x - px, dz = d.z - pz; + double dist = Math.sqrt(dx*dx + dz*dz); + if (dist < skipRadius || dz >= 0) continue; + double measure = Math.abs(dz); + if (measure < bestDist) { bestDist = measure; best = d; } } - - // track already selected - if (north != null) alreadyPicked.add(north); - if (south != null) alreadyPicked.add(south); - if (east != null) alreadyPicked.add(east); - if (west != null) alreadyPicked.add(west); - - // second pass: fill missing slots with next nearest - for (CarriageDestination dest : destinations.values()) { - if (alreadyPicked.contains(dest)) continue; - - double dx = dest.x - px; - double dz = dest.z - pz; - double distance = Math.sqrt(dx * dx + dz * dz); - - if (distance < 10) continue; - - if (north == null && dz < 0) { north = dest; alreadyPicked.add(dest); continue; } - if (south == null && dz > 0) { south = dest; alreadyPicked.add(dest); continue; } - if (east == null && dx > 0) { east = dest; alreadyPicked.add(dest); continue; } - if (west == null && dx < 0) { west = dest; alreadyPicked.add(dest); continue; } + if (best != null) { picked.add(best); result.add(best); } + + // south + best = null; bestDist = Double.MAX_VALUE; + for (CarriageDestination d : destinations.values()) { + if (picked.contains(d)) continue; + double dx = d.x - px, dz = d.z - pz; + double dist = Math.sqrt(dx*dx + dz*dz); + if (dist < skipRadius || dz <= 0) continue; + if (dz < bestDist) { bestDist = dz; best = d; } + } + if (best != null) { picked.add(best); result.add(best); } + + // east + best = null; bestDist = Double.MAX_VALUE; + for (CarriageDestination d : destinations.values()) { + if (picked.contains(d)) continue; + double dx = d.x - px, dz = d.z - pz; + double dist = Math.sqrt(dx*dx + dz*dz); + if (dist < skipRadius || dx <= 0) continue; + if (dx < bestDist) { bestDist = dx; best = d; } + } + if (best != null) { picked.add(best); result.add(best); } + + // west + best = null; bestDist = Double.MAX_VALUE; + for (CarriageDestination d : destinations.values()) { + if (picked.contains(d)) continue; + double dx = d.x - px, dz = d.z - pz; + double dist = Math.sqrt(dx*dx + dz*dz); + if (dist < skipRadius || dx >= 0) continue; + double measure = Math.abs(dx); + if (measure < bestDist) { bestDist = measure; best = d; } + } + if (best != null) { picked.add(best); result.add(best); } + + // fill remaining slots + List sorted = new ArrayList<>(destinations.values()); + sorted.sort(Comparator.comparingDouble(d -> { + double dx = d.x - px, dz = d.z - pz; + return Math.sqrt(dx*dx + dz*dz); + })); + for (CarriageDestination d : sorted) { + if (result.size() >= 4) break; + double dx = d.x - px, dz = d.z - pz; + double dist = Math.sqrt(dx*dx + dz*dz); + if (dist < skipRadius) continue; + if (!picked.contains(d)) { + picked.add(d); + result.add(d); + } } - List result = new ArrayList<>(); - if (north != null) result.add(north); - if (south != null) result.add(south); - if (east != null) result.add(east); - if (west != null) result.add(west); return result; } - } diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelGalvornHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/ModelGalvornHelmet.java new file mode 100644 index 0000000..f5cc786 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/model/ModelGalvornHelmet.java @@ -0,0 +1,91 @@ +package com.zivilon.cinder_loe.client.model; +// Made with Blockbench 4.11.1 +// Exported for Minecraft version 1.7 - 1.12 +// Paste this class into your mod and generate all required imports + + +import lotr.client.model.LOTRModelBiped; +import net.minecraft.client.model.ModelBox; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelGalvornHelmet extends LOTRModelBiped { + private final ModelRenderer crest; + private final ModelRenderer shape12; + private final ModelRenderer shape3; + private final ModelRenderer shape4; + private final ModelRenderer shape5; + private final ModelRenderer shape6; + + public ModelGalvornHelmet(float f) { + super(f); + this.textureWidth = 64; + this.textureHeight = 32; + + crest = new ModelRenderer(this); + crest.setRotationPoint(0.0F, -1.0F, 0.55F); + + shape12 = new ModelRenderer(this); + shape12.setRotationPoint(0.5F, -4.0F, -6.35F); + setRotationAngle(shape12, 1.5708F, 0.0F, 0.0F); + shape12.cubeList.add(new ModelBox(shape12, 43, 22, -1.0F, 0.0F, -1.5F, 1, 1, 9, 0.0F)); + + shape3 = new ModelRenderer(this); + shape3.setRotationPoint(0.0F, 0.0F, 0.0F); + setRotationAngle(shape3, 0.0F, -0.2276F, 0.0F); + shape3.cubeList.add(new ModelBox(shape3, 0, 25, -1.0F, 0.1F, 0.0F, 1, 0, 6, 0.0F)); + + shape4 = new ModelRenderer(this); + shape4.setRotationPoint(0.0F, 0.0F, 0.0F); + setRotationAngle(shape4, 0.0F, -0.2731F, 0.0F); + shape4.cubeList.add(new ModelBox(shape4, 16, 23, -1.0F, 0.2F, 0.0F, 1, 0, 5, 0.0F)); + + shape5 = new ModelRenderer(this); + shape5.setRotationPoint(-1.0F, 0.0F, 0.0F); + setRotationAngle(shape5, 0.0F, 0.2276F, 0.0F); + shape5.cubeList.add(new ModelBox(shape5, 50, 3, 0.0F, 0.1F, 0.0F, 1, 0, 6, 0.0F)); + + shape6 = new ModelRenderer(this); + shape6.setRotationPoint(0.0F, 0.0F, 0.0F); + + setRotationAngle(shape6, 0.0F, 0.2731F, 0.0F); + shape6.cubeList.add(new ModelBox(shape6, 49, 13, 0.0F, 0.2F, 0.0F, 1, 0, 5, 0.0F)); + + this.bipedHead.cubeList.clear(); + + bipedHead = new ModelRenderer(this); + bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F); + bipedHead.cubeList.add(new ModelBox(bipedHead, 0, 0, -4.0F, -8.0F, -4.0F, 8, 8, 8, 1.0F)); + +// this.crest.addChild(this.shape12); +// this.crest.addChild(this.shape3); +// this.crest.addChild(this.shape4); +// this.crest.addChild(this.shape5); +// this.crest.addChild(this.shape6); + crest.addChild(shape12); + shape12.addChild(shape3); + shape3.addChild(shape4); + shape12.addChild(shape5); + shape5.addChild(shape6); + this.bipedHead.addChild(this.crest); + + this.bipedHeadwear.cubeList.clear(); + this.bipedBody.cubeList.clear(); + this.bipedRightArm.cubeList.clear(); + this.bipedLeftArm.cubeList.clear(); + this.bipedRightLeg.cubeList.clear(); + this.bipedLeftLeg.cubeList.clear(); + + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + bipedHead.render(f5); + } + + public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} \ No newline at end of file diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelJadeHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/ModelJadeHelmet.java index 2e0b612..f0fde8a 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/model/ModelJadeHelmet.java +++ b/src/main/java/com/zivilon/cinder_loe/client/model/ModelJadeHelmet.java @@ -26,6 +26,7 @@ public class ModelJadeHelmet extends LOTRModelBiped { public ModelJadeHelmet(float f) { super (f); + this.textureWidth = 64; this.textureHeight = 32; this.bipedHead.cubeList.clear(); diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelWarlordHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/ModelWarlordHelmet.java index 7fe2b10..e3d1b74 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/model/ModelWarlordHelmet.java +++ b/src/main/java/com/zivilon/cinder_loe/client/model/ModelWarlordHelmet.java @@ -23,6 +23,7 @@ public class ModelWarlordHelmet extends LOTRModelBiped { super (f); this.textureWidth = 64; this.textureHeight = 32; + this.shape31 = new ModelRenderer(this, 2, 2); this.shape31.setRotationPoint(0.0F, 0.0F, 0.0F); this.shape31.addBox(-4.0F, -10.0F, -7.0F, 8, 3, 6, 1.0F); diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderCryptBoss.java b/src/main/java/com/zivilon/cinder_loe/client/render/RenderCryptBoss.java new file mode 100644 index 0000000..ce3c1b0 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/RenderCryptBoss.java @@ -0,0 +1,43 @@ +package com.zivilon.cinder_loe.client.render; + +import com.zivilon.cinder_loe.entity.Wraith; +import com.zivilon.cinder_loe.entity.boss.CryptBoss; +import lotr.client.model.LOTRModelMarshWraith; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderCryptBoss extends RenderLiving { + private static ResourceLocation skin = new ResourceLocation("cinder_loe:mob/wraith/wraith.png"); + + public RenderCryptBoss() { + super((ModelBase)new LOTRModelMarshWraith(), 0.5F); + } + + protected ResourceLocation getEntityTexture(Entity entity) { + return skin; + } + + protected void preRenderCallback(EntityLivingBase entity, float f) { + super.preRenderCallback(entity, f); + float f1 = 0.9375F; + float hover = MathHelper.sin((((Entity)entity).ticksExisted + f) * 0.15F) * 0.2F - 0.5F; + GL11.glScalef(f1, f1, f1); + GL11.glTranslatef(0.0F, hover, 0.0F); + CryptBoss wraith = (CryptBoss)entity; + if (wraith.getDeathFadeTime() > 0) { + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + GL11.glEnable(3008); + GL11.glColor4f(1.0F, 1.0F, 1.0F, wraith.getDeathFadeTime() / 30.0F); + } + } + + protected float getDeathMaxRotation(EntityLivingBase entity) { + return 0.0F; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderElvenArrow.java b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderElvenArrow.java new file mode 100644 index 0000000..d92343a --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderElvenArrow.java @@ -0,0 +1,13 @@ +package com.zivilon.cinder_loe.client.render.projectile; + +import net.minecraft.client.renderer.entity.RenderArrow; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class RenderElvenArrow extends RenderArrow { + private static final ResourceLocation arrowPoisonTexture = new ResourceLocation("lotr:item/arrowPoisoned.png"); + + protected ResourceLocation getEntityTexture(Entity entity) { + return arrowPoisonTexture; + } +} \ No newline at end of file diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderMorgulBlast.java b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderMorgulBlast.java new file mode 100644 index 0000000..f062335 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderMorgulBlast.java @@ -0,0 +1,15 @@ +package com.zivilon.cinder_loe.client.render.projectile; + +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class RenderMorgulBlast extends Render { + protected ResourceLocation getEntityTexture(Entity entity) { + return TextureMap.locationBlocksTexture; + } + + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanFireball.java b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanFireball.java similarity index 96% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanFireball.java rename to src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanFireball.java index fad8631..f0f6fc4 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanFireball.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanFireball.java @@ -1,6 +1,5 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.projectile; -import lotr.client.LOTRClientProxy; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanWhiteFireball.java b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanWhiteFireball.java similarity index 96% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanWhiteFireball.java rename to src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanWhiteFireball.java index ec581ab..6da4f50 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanWhiteFireball.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanWhiteFireball.java @@ -1,6 +1,5 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.projectile; -import lotr.client.LOTRClientProxy; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; 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/coremod/LOTRDimensionAdder.java b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRDimensionAdder.java index 4f68562..4c213a4 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRDimensionAdder.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRDimensionAdder.java @@ -29,7 +29,7 @@ public class LOTRDimensionAdder implements IClassTransformer { public void registerDimensions() { System.out.println("Registering dimensions"); custom_dimensions = new ArrayList<>(); -// register("ISLAND", "Island", 102, CinderWorldProviderIsland.class, 100); + //register("ISLAND", "Island", 102, CinderWorldProviderIsland.class, 100); } // The ASM code you shouldn't touch diff --git a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java index 12f87c3..642a09b 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java @@ -67,6 +67,7 @@ public class LOTRMaterialTransformer implements IClassTransformer { addMaterial("USURPER", classNode); addMaterial("WARLORD",classNode); addMaterial("JADE",classNode); + addMaterial("GILDEDGALVORN",classNode); // Protection Conversion diff --git a/src/main/java/com/zivilon/cinder_loe/entity/boss/CryptBoss.java b/src/main/java/com/zivilon/cinder_loe/entity/boss/CryptBoss.java new file mode 100644 index 0000000..02c397c --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/boss/CryptBoss.java @@ -0,0 +1,214 @@ +package com.zivilon.cinder_loe.entity.boss; + +import com.zivilon.cinder_loe.entity.projectile.EntityMorgulBlast; +import lotr.common.LOTRMod; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; +import lotr.common.entity.ai.*; +import lotr.common.entity.npc.LOTREntityMarshWraith; +import lotr.common.entity.npc.LOTREntityNPC; +import lotr.common.fac.LOTRFaction; +import lotr.common.quest.LOTRMiniQuest; +import lotr.common.world.structure.LOTRChestContents; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.*; +import net.minecraft.entity.ai.*; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +import java.util.Random; + +public class CryptBoss extends LOTREntityNPC { + + private EntityAIBase meleeAttackAI = new LOTREntityAIAttackOnCollide(this, 2.0, false); + private EntityAIBase rangedAttackAI = new LOTREntityAIRangedAttack(this, 1.5, 30, 50, 60.0f); + + //Copying Wraith temporarily + public CryptBoss(World world) { + super(world); + setSize(0.8F, 2.5F); + this.tasks.taskEntries.clear(); + this.tasks.addTask(0, (EntityAIBase)new EntityAISwimming((EntityLiving)this)); + //Causes crash + //this.tasks.addTask(0, (EntityAIBase)new LOTREntityAIBossJumpAttack(this, 1.5, 0.02f)); + this.tasks.addTask(2, (EntityAIBase)new EntityAIWander((EntityCreature)this, 1.0)); + this.tasks.addTask(3, (EntityAIBase)new EntityAIWatchClosest2((EntityLiving)this, EntityPlayer.class, 12.0f, 0.02f)); + this.tasks.addTask(3, (EntityAIBase)new EntityAIWatchClosest2((EntityLiving)this, LOTREntityNPC.class, 8.0f, 0.02f)); + this.tasks.addTask(4, (EntityAIBase)new EntityAIWatchClosest((EntityLiving)this, EntityLiving.class, 10.0f, 0.02f)); + this.tasks.addTask(5, (EntityAIBase)new EntityAILookIdle((EntityLiving)this)); + addTargetTasks(true); + } + + @Override + public void sendSpeechBank(EntityPlayer entityplayer, String speechBank) { + this.sendSpeechBank(entityplayer, speechBank, (LOTRMiniQuest)null); + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(17, Integer.valueOf(0)); + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(32.0); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.0); + this.getEntityAttribute(npcAttackDamage).setBaseValue(16.0); + } + + public int getDeathFadeTime() { + return this.dataWatcher.getWatchableObjectInt(17); + } + + public void setDeathFadeTime(int i) { + this.dataWatcher.updateObject(17, Integer.valueOf(i)); + } + + public LOTRFaction getFaction() { + return LOTRFaction.UTUMNO; + } + + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("DeathFadeTime", getDeathFadeTime()); + } + + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + setDeathFadeTime(nbt.getInteger("DeathFadeTime")); + } + + @Override + public void moveEntityWithHeading(float strafe, float forward) { + // First, call the super method to preserve normal movement behavior + super.moveEntityWithHeading(strafe, forward); + + // Check for water at the entity's feet + int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.posY); + int z = MathHelper.floor_double(this.posZ); + + boolean isWater = this.worldObj.getBlock(x, y, z).getMaterial() == Material.water || + this.worldObj.getBlock(x, y - 1, z).getMaterial() == Material.water; // Check below the entity too + + if (isWater) { + this.onGround = true; // Treat water as solid ground + this.motionY = 0.0; // Stop falling/sinking + this.setPosition(this.posX, y + 1, this.posZ); // Adjust position to stay on top of the water + } + } + + + public void setInWeb() {} + + @Override + public void onLivingUpdate() { + super.onLivingUpdate(); + if (this.worldObj.isRemote) { + for (int l = 0; l < 1; ++l) { + double d = this.posX + (double)this.width * MathHelper.getRandomDoubleInRange((Random)this.rand, (double)-0.5, (double)0.5); + double d1 = this.posY + (double)this.height * MathHelper.getRandomDoubleInRange((Random)this.rand, (double)0.4, (double)0.8); + double d2 = this.posZ + (double)this.width * MathHelper.getRandomDoubleInRange((Random)this.rand, (double)-0.5, (double)0.5); + double d3 = MathHelper.getRandomDoubleInRange((Random)this.rand, (double)-0.1, (double)0.1); + double d4 = MathHelper.getRandomDoubleInRange((Random)this.rand, (double)-0.2, (double)-0.05); + double d5 = MathHelper.getRandomDoubleInRange((Random)this.rand, (double)-0.1, (double)0.1); + if (this.rand.nextBoolean()) { + LOTRMod.proxy.spawnParticle("morgulPortal", d, d1, d2, d3, d4, d5); + continue; + } + this.worldObj.spawnParticle("smoke", d, d1, d2, d3, d4, d5); + } + } + } + + @Override + public void onAttackModeChange(LOTREntityNPC.AttackMode mode, boolean mounted) { + if (mode == LOTREntityNPC.AttackMode.IDLE) { + this.tasks.removeTask(this.meleeAttackAI); + this.tasks.removeTask(this.rangedAttackAI); + this.tasks.addTask(1, this.meleeAttackAI); + } + if (mode == LOTREntityNPC.AttackMode.MELEE) { + this.tasks.removeTask(this.meleeAttackAI); + this.tasks.removeTask(this.rangedAttackAI); + this.tasks.addTask(1, this.meleeAttackAI); + } + if (mode == LOTREntityNPC.AttackMode.RANGED) { + this.tasks.removeTask(this.meleeAttackAI); + this.tasks.removeTask(this.rangedAttackAI); + this.tasks.addTask(1, this.rangedAttackAI); + } + } + + @Override + public void attackEntityWithRangedAttack(EntityLivingBase target, float f) { + EntityMorgulBlast projectile = new EntityMorgulBlast(this.worldObj, (EntityLivingBase)this, target); + projectile.leavesDamage = 16.0f; + this.worldObj.spawnEntityInWorld((Entity)projectile); + this.playSound("lotr:wraith.marshWraith_shoot", this.getSoundVolume(), this.getSoundPitch()); + this.swingItem(); + } + + public boolean attackEntityFrom(DamageSource damagesource, float f) { + boolean vulnerable = false; + Entity entity = damagesource.getEntity(); + if (entity instanceof EntityLivingBase && entity == damagesource.getSourceOfDamage()) { + ItemStack itemstack = ((EntityLivingBase)entity).getHeldItem(); + if (itemstack != null && LOTREnchantmentHelper.hasEnchant(itemstack, LOTREnchantment.baneWight)) + vulnerable = true; + } + if (vulnerable && getDeathFadeTime() == 0) { + boolean flag = super.attackEntityFrom(damagesource, f); + return flag; + } + return false; + } + + public void onDeath(DamageSource damagesource) { + super.onDeath(damagesource); + if (!((Entity)this).worldObj.isRemote) + setDeathFadeTime(30); + } + + protected void dropFewItems(boolean flag, int i) { + super.dropFewItems(flag, i); + int flesh = 1 + rand.nextInt(3) + rand.nextInt(i + 1); + for (int l = 0; l < flesh; l++) + dropItem(Items.rotten_flesh, 1); + dropChestContents(LOTRChestContents.MARSH_REMAINS, 1, 3 + i); + } + + public EnumCreatureAttribute getCreatureAttribute() { + return EnumCreatureAttribute.UNDEAD; + } + + protected String getHurtSound() { + return "lotr:wight.hurt"; + } + + protected String getDeathSound() { + return "lotr:wight.death"; + } + + public boolean handleWaterMovement() { + return false; + } + + protected void func_145780_a(int i, int j, int k, Block block) {} + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + if (this.isFriendlyAndAligned(entityplayer)) { + return "corruptSpeak/all/neutral"; + } + return "corruptSpeak/all/hostile"; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityElvenArrow.java b/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityElvenArrow.java new file mode 100644 index 0000000..68cf73c --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityElvenArrow.java @@ -0,0 +1,67 @@ +package com.zivilon.cinder_loe.entity.projectile; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityElvenArrow extends EntityArrow implements IEntityAdditionalSpawnData { + public EntityElvenArrow(World world) { + super(world); + } + + public EntityElvenArrow(World world, double d, double d1, double d2) { + super(world, d, d1, d2); + } + + public EntityElvenArrow(World world, EntityLivingBase shooter, EntityLivingBase target, float charge, float inaccuracy) { + super(world, shooter, target, charge, inaccuracy); + } + + public EntityElvenArrow(World world, EntityLivingBase shooter, float charge) { + super(world, shooter, charge); + } + + public void writeSpawnData(ByteBuf data) { + data.writeDouble(this.motionX); + data.writeDouble(this.motionY); + data.writeDouble(this.motionZ); + data.writeInt(this.shootingEntity == null ? -1 : this.shootingEntity.getEntityId()); + } + + public void readSpawnData(ByteBuf data) { + Entity entity; + this.motionX = data.readDouble(); + this.motionY = data.readDouble(); + this.motionZ = data.readDouble(); + int id = data.readInt(); + if (id >= 0 && (entity = this.worldObj.getEntityByID(id)) != null) { + this.shootingEntity = entity; + } + } + + public void onCollideWithPlayer(EntityPlayer entityplayer) { + boolean isInGround; + NBTTagCompound nbt = new NBTTagCompound(); + this.writeEntityToNBT(nbt); + boolean bl = isInGround = nbt.getByte("inGround") == 1; + if (!this.worldObj.isRemote && isInGround && this.arrowShake <= 0) { + boolean pickup; + boolean bl2 = pickup = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityplayer.capabilities.isCreativeMode; + //Need to add it as an item first +// if (this.canBePickedUp == 1 && !entityplayer.inventory.addItemStackToInventory(new ItemStack(LOTRMod.arrowPoisoned, 1))) { +// pickup = false; +// } + if (pickup) { + this.playSound("random.pop", 0.2f, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7f + 1.0f) * 2.0f); + entityplayer.onItemPickup((Entity)this, 1); + this.setDead(); + } + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityMorgulBlast.java b/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityMorgulBlast.java new file mode 100644 index 0000000..728e987 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityMorgulBlast.java @@ -0,0 +1,174 @@ +package com.zivilon.cinder_loe.entity.projectile; + +import lotr.common.LOTRMod; +import lotr.common.entity.npc.LOTREntityNPC; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +import java.util.List; +import java.util.UUID; + +public class EntityMorgulBlast extends EntityThrowable { + private UUID throwerUUID; + private int leavesAge; + private static int MAX_LEAVES_AGE = 200; + public float leavesDamage; + + + public EntityMorgulBlast(World world) { + super(world); + this.setSize(2.0f, 2.0f); + this.setPosition(this.posX, this.posY, this.posZ); + } + + public EntityMorgulBlast(World world, EntityLivingBase thrower, EntityLivingBase target) { + super(world, thrower); + this.setSize(2.0f, 2.0f); + this.setPosition(this.posX, this.posY, this.posZ); + this.throwerUUID = thrower.getUniqueID(); + this.posY = thrower.posY + (double)thrower.getEyeHeight() - 0.1; + double dx = target.posX - thrower.posX; + double dy = target.boundingBox.minY + (double)(target.height / 3.0f) - this.posY; + double dz = target.posZ - thrower.posZ; + double dxz = MathHelper.sqrt_double((double)(dx * dx + dz * dz)); + if (dxz >= 1.0E-7) { + float f2 = (float)(Math.atan2(dz, dx) * 180.0 / Math.PI) - 90.0f; + float f3 = (float)(-(Math.atan2(dy, dxz) * 180.0 / Math.PI)); + double d4 = dx / dxz; + double d5 = dz / dxz; + this.setLocationAndAngles(thrower.posX + d4, this.posY, thrower.posZ + d5, f2, f3); + this.yOffset = 0.0f; + this.setThrowableHeading(dx, dy, dz, this.func_70182_d(), 1.0f); + } + } + + public EntityMorgulBlast(World world, double d, double d1, double d2) { + super(world, d, d1, d2); + this.setSize(2.0f, 2.0f); + this.setPosition(this.posX, this.posY, this.posZ); + } + + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("LeavesAge", this.leavesAge); + nbt.setFloat("LeavesDamage", this.leavesDamage); + if (this.throwerUUID != null) { + nbt.setString("ThrowerUUID", this.throwerUUID.toString()); + } + } + + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + this.leavesAge = nbt.getInteger("LeavesAge"); + this.leavesDamage = nbt.getFloat("LeavesDamage"); + if (nbt.hasKey("ThrowerUUID")) { + this.throwerUUID = UUID.fromString(nbt.getString("ThrowerUUID")); + } + } + + protected void onImpact(MovingObjectPosition m) { + if (!this.worldObj.isRemote) { + Entity entity; + if (m.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + this.explode(null); + } else if (m.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && this.isEntityVulnerable(entity = m.entityHit)) { + this.explode(entity); + } + } + } + + private void explode(Entity target) { + if (!this.worldObj.isRemote) { + double range = 3.0; + List entities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(range, range, range)); + if (!entities.isEmpty()) { + for (int i = 0; i < entities.size(); ++i) { + float damage; + EntityLivingBase entity = (EntityLivingBase)entities.get(i); + if (!this.isEntityVulnerable((Entity)entity) || !((damage = this.leavesDamage / Math.max(1.0f, this.getDistanceToEntity((Entity)entity))) > 0.0f)) continue; + entity.attackEntityFrom(DamageSource.causeMobDamage((EntityLivingBase)this.getThrower()), damage); + } + } + this.setDead(); + } + } + private boolean isEntityVulnerable(Entity target) { + if (target == this.getThrower()) { + return false; + } + if (target instanceof EntityLivingBase) { + EntityLivingBase livingTarget = (EntityLivingBase)target; + EntityLivingBase thrower = this.getThrower(); + if (thrower instanceof LOTREntityNPC) { + ((LOTREntityNPC)thrower).getJumpHelper().doJump(); + return LOTRMod.canNPCAttackEntity((LOTREntityNPC)thrower, livingTarget, false); + } + return true; + } + return false; + } + + @Override + public void onUpdate() { + super.onUpdate(); + if (!this.worldObj.isRemote) { + ++this.leavesAge; + if (this.leavesAge >= MAX_LEAVES_AGE) { + this.explode(null); + } + } else { + Vec3 axis = Vec3.createVectorHelper((double)(-this.motionX), (double)(-this.motionY), (double)(-this.motionZ)); + int leaves = 20; + for (int l = 0; l < leaves; ++l) { + float angle = (float)l / (float)leaves * 2.0f * (float)Math.PI; + Vec3 rotate = Vec3.createVectorHelper((double)1.0, (double)1.0, (double)1.0); + rotate.rotateAroundX((float)Math.toRadians(40.0)); + rotate.rotateAroundY(angle); + float dot = (float)rotate.dotProduct(axis); + Vec3 parallel = Vec3.createVectorHelper((double)(axis.xCoord * (double)dot), (double)(axis.yCoord * (double)dot), (double)(axis.zCoord * (double)dot)); + Vec3 perp = parallel.subtract(rotate); + Vec3 cross = rotate.crossProduct(axis); + float sin = MathHelper.sin((float)(-angle)); + float cos = MathHelper.cos((float)(-angle)); + Vec3 crossSin = Vec3.createVectorHelper((double)(cross.xCoord * (double)sin), (double)(cross.yCoord * (double)sin), (double)(cross.zCoord * (double)sin)); + Vec3 perpCos = Vec3.createVectorHelper((double)(perp.xCoord * (double)cos), (double)(perp.yCoord * (double)cos), (double)(perp.zCoord * (double)cos)); + Vec3 result = parallel.addVector(crossSin.xCoord + perpCos.xCoord, crossSin.yCoord + perpCos.yCoord, crossSin.zCoord + perpCos.zCoord); + double d = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + double d3 = result.xCoord / 10.0; + double d4 = result.yCoord / 10.0; + double d5 = result.zCoord / 10.0; + LOTRMod.proxy.spawnParticle("morgulPortal", d, d1, d2, d3, d4, d5); + // LOTRMod.proxy.spawnParticle("smoke", d, d1, d2, d3 * 0.5, d4 * 0.5, d5 * 0.5); + worldObj.spawnParticle("smoke", d, d1, d2, d3 * 0.5, d4 * 0.5, d5 * 0.5); + + } + } + } + public EntityLivingBase getThrower() { + if (this.throwerUUID != null) { + for (Object obj : this.worldObj.loadedEntityList) { + Entity entity = (Entity)obj; + if (!(entity instanceof EntityLivingBase) || !entity.getUniqueID().equals(this.throwerUUID)) continue; + return (EntityLivingBase)entity; + } + } + return null; + } + + protected float func_70182_d() { + return 1.0f; + } + + protected float getGravityVelocity() { + return 0.0f; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/trader/RedDwarfSmith.java b/src/main/java/com/zivilon/cinder_loe/entity/trader/RedDwarfSmith.java index bb87cc3..d14376d 100644 --- a/src/main/java/com/zivilon/cinder_loe/entity/trader/RedDwarfSmith.java +++ b/src/main/java/com/zivilon/cinder_loe/entity/trader/RedDwarfSmith.java @@ -76,9 +76,10 @@ public class RedDwarfSmith extends LOTREntityDwarf implements LOTRTradeable.Smit new LOTRTradeEntry(new ItemStack(CinderLoE.legsRedDwarf), 30), new LOTRTradeEntry(new ItemStack(CinderLoE.bootsRedDwarf), 22), new LOTRTradeEntry(new ItemStack(CinderLoE.boarArmorRedDwarf), 25), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.barsRedDwarf, 8), 20), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), - new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200) + new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), } ); diff --git a/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java b/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java index 6900eb0..520c9f1 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java +++ b/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java @@ -1,8 +1,13 @@ package com.zivilon.cinder_loe.items; +import com.zivilon.cinder_loe.CinderAchievement; +import com.zivilon.cinder_loe.CinderLoE; import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.potion.LoEPotions; +import lotr.common.LOTRAchievement; +import lotr.common.LOTRLevelData; +import lotr.common.LOTRReflection; import lotr.common.item.LOTRItemMug; import lotr.common.item.LOTRItemMug.Vessel; import lotr.client.render.LOTRDrinkIcons; @@ -89,8 +94,25 @@ public class LoEItemMug extends LOTRItemMug { return this; } public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { - if (is_toxic) + if (is_toxic) { increment_toxin(entityplayer); + + } + if (this == CinderLoE.mugHumanBrew) { + LOTRLevelData.getData(entityplayer).addAchievement(CinderAchievement.spiceHumanBrew); + for (int i = 0; i < Potion.potionTypes.length; ++i) { + Potion potion = Potion.potionTypes[i]; + if (potion == null || !LOTRReflection.isBadEffect(potion)) continue; + entityplayer.removePotionEffect(potion.id); + } + } + if (this == CinderLoE.mugDwarfBrew) + LOTRLevelData.getData(entityplayer).addAchievement(CinderAchievement.spiceDwarfBrew); + if (this == CinderLoE.mugOrcBrew) + LOTRLevelData.getData(entityplayer).addAchievement(CinderAchievement.spiceOrcBrew); + if (this == CinderLoE.mugElfBrew) + LOTRLevelData.getData(entityplayer).addAchievement(CinderAchievement.spiceElfBrew); + return super.onEaten(itemstack, world, entityplayer); } public void increment_toxin(EntityPlayer player) { @@ -99,5 +121,7 @@ public class LoEItemMug extends LOTRItemMug { PotionEffect potion = player.getActivePotionEffect(LoEPotions.overdose); if (potion != null) effect_potency = potion.getAmplifier() + 1; player.addPotionEffect(new PotionEffect(LoEPotions.overdose.id, effect_duration, effect_potency)); + if (effect_potency == 2) + LOTRLevelData.getData(player).addAchievement(CinderAchievement.Overdose); } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRArmorModels.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRArmorModels.java index 46bd3d1..0409601 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRArmorModels.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRArmorModels.java @@ -102,6 +102,7 @@ public class MixinLOTRArmorModels { map.put(CinderLoE.bodyJade, new ModelBodyJade(1.0f)); map.put(CinderLoE.legsJade, new ModelLegsJade(1.0f)); map.put(CinderLoE.helmetJade, new ModelJadeHelmet(1.0f)); + map.put(CinderLoE.helmetGildedGalvorn, new ModelGalvornHelmet(1.0f)); map.put(LOTRMod.plate, new LOTRModelHeadPlate()); map.put(LOTRMod.woodPlate, new LOTRModelHeadPlate()); map.put(LOTRMod.ceramicPlate, new LOTRModelHeadPlate()); 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 c08d748..71a96d7 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantment.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantment.java @@ -32,11 +32,12 @@ public class MixinLOTREnchantment { LOTREnchantment rangedStrong4 = new LOTREnchantmentRangedDamage("rangedStrong4", 1.4f).setEnchantWeight(0).setSkilful(); LOTREnchantment meleeReach2 = new LOTREnchantmentMeleeReach("meleeReach2", 1.33f).setEnchantWeight(0).setSkilful(); LOTREnchantment meleeSpeed2 = new LOTREnchantmentMeleeSpeed("meleeSpeed2", 1.33f).setEnchantWeight(0).setSkilful(); - LOTREnchantment Shinare = new LOTREnchantmentArmorSpecial("Shinare").setEnchantWeight(0).setSkilful(); LOTREnchantment swiftness = new LOTREnchantmentArmorSpecial("swiftness").setEnchantWeight(0).setSkilful(); LOTREnchantment fireRepair = new LOTREnchantmentArmorSpecial("fireRepair").setEnchantWeight(0).setSkilful(); LOTREnchantment mountArmor = new LOTREnchantmentArmorSpecial("mountArmor").setEnchantWeight(0).setSkilful(); LOTREnchantment stealth = new LOTREnchantmentArmorSpecial("stealth").setEnchantWeight(0).setSkilful(); + LOTREnchantment meleeSturdy = new LOTREnchantmentArmorSpecial("meleeSturdy").setEnchantWeight(1); + LOTREnchantment armorSturdy = new LOTREnchantmentArmorSpecial("armorSturdy").setEnchantWeight(1); LOTREnchantment.allEnchantments.add(protectRangedWeak1); @@ -47,7 +48,8 @@ public class MixinLOTREnchantment { LOTREnchantment.allEnchantments.add(rangedStrong4); LOTREnchantment.allEnchantments.add(meleeReach2); LOTREnchantment.allEnchantments.add(meleeSpeed2); - LOTREnchantment.allEnchantments.add(Shinare); + LOTREnchantment.allEnchantments.add(meleeSturdy); + LOTREnchantment.allEnchantments.add(armorSturdy); LOTREnchantment.allEnchantments.add(swiftness); LOTREnchantment.allEnchantments.add(fireRepair); LOTREnchantment.allEnchantments.add(mountArmor); @@ -66,7 +68,8 @@ public class MixinLOTREnchantment { enchantsByName.put(rangedStrong4.enchantName, rangedStrong4); enchantsByName.put(meleeReach2.enchantName, meleeReach2); enchantsByName.put(meleeSpeed2.enchantName, meleeSpeed2); - enchantsByName.put(Shinare.enchantName, Shinare); + enchantsByName.put(meleeSturdy.enchantName, meleeSturdy); + enchantsByName.put(armorSturdy.enchantName, armorSturdy); enchantsByName.put(swiftness.enchantName, swiftness); enchantsByName.put(fireRepair.enchantName, fireRepair); enchantsByName.put(mountArmor.enchantName, mountArmor); diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTREnchantmenHelper.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTREnchantmenHelper.java new file mode 100644 index 0000000..99167de --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTREnchantmenHelper.java @@ -0,0 +1,30 @@ +package com.zivilon.cinder_loe.mixins.overrides; + +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(LOTREnchantmentHelper.class) +public class MixinLOTREnchantmenHelper { + + /** + * Prevent negative modifiers (weak or detrimental enchants) from being applied. + */ + @Redirect( + method = "applyRandomEnchantments(Lnet/minecraft/item/ItemStack;Ljava/util/Random;ZZ)V", + at = @At( + value = "INVOKE", + target = "Llotr/common/enchant/LOTREnchantmentHelper;setHasEnchant(Lnet/minecraft/item/ItemStack;Llotr/common/enchant/LOTREnchantment;)V" + ), + remap = false + ) + private static void skipNegativeEnchant(ItemStack itemstack, LOTREnchantment ench) { + // Only apply if enchant is beneficial + if (ench.isBeneficial()) { + LOTREnchantmentHelper.setHasEnchant(itemstack, ench); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java index 87a41c9..637ae8c 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java @@ -126,6 +126,8 @@ public abstract class MixinLOTRTradeEntriesOverrides { @Shadow public static LOTRTradeEntries DALE_BLACKSMITH_SELL; @Shadow public static LOTRTradeEntries WICKED_DWARF_BUY; + @Shadow public static LOTRTradeEntries DALE_BAKER_BUY; + /** * @author @@ -134,6 +136,42 @@ public abstract class MixinLOTRTradeEntriesOverrides { @Inject(method = "setupTrades1", at = @At("RETURN"), remap = false) private static void newTrades(CallbackInfo ci) { + DALE_BAKER_BUY = new LOTRTradeEntries(TradeType.BUY, + new LOTRTradeEntry(new ItemStack(Items.bread), 5), + new LOTRTradeEntry(new ItemStack(LOTRMod.cornBread), 5), + new LOTRTradeEntry(new ItemStack(LOTRMod.cram), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.oliveBread), 6), + new LOTRTradeEntry(new ItemStack(LOTRMod.dalishPastryItem), 12), + new LOTRTradeEntry(new ItemStack(Items.cake), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.lemonCakeItem), 20), + new LOTRTradeEntry(new ItemStack(LOTRMod.appleCrumbleItem), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.berryPieItem), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.cherryPieItem), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.marzipan), 8), + new LOTRTradeEntry(new ItemStack(LOTRMod.marzipanChocolate), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.marzipanBlock), 20), + new LOTRTradeEntry(new ItemStack(Items.cookie), 4), + new LOTRTradeEntry(new ItemStack(LOTRMod.plate), 4), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.ceramicPlate), 2)); + ((MixinLOTRTradeEntriesOverrides)(Object)DALE_BAKER_BUY).setVessels(LOTRFoods.DALE_DRINK); + + TAUREDAIN_FARMER_BUY = new LOTRTradeEntries(TradeType.BUY, + new LOTRTradeEntry(new ItemStack(Items.wheat), 2), + new LOTRTradeEntry(new ItemStack(Items.wheat_seeds), 1), + new LOTRTradeEntry(new ItemStack(Items.carrot), 3), + new LOTRTradeEntry(new ItemStack(Items.potato), 2), + new LOTRTradeEntry(new ItemStack(LOTRMod.lettuce), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.mango), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.banana), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.reeds), 2), + new LOTRTradeEntry(new ItemStack(LOTRMod.driedReeds), 2), + new LOTRTradeEntry(new ItemStack(Items.dye, 1, 3), 8), + new LOTRTradeEntry(new ItemStack(CinderLoE.fruitsalad, 1), 6), + new LOTRTradeEntry(new ItemStack(CinderLoE.spice, 1), 10), + new LOTRTradeEntry(new ItemStack(LOTRMod.corn), 3)); + ((MixinLOTRTradeEntriesOverrides)(Object)TAUREDAIN_FARMER_BUY).setVessels(LOTRFoods.TAUREDAIN_DRINK); + DWARF_MINER_BUY = new LOTRTradeEntries(TradeType.BUY, new LOTRTradeEntry(new ItemStack(Items.coal, 2), 4), @@ -157,6 +195,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.amber), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.amethyst), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.topaz), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 10), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)DWARF_MINER_BUY).setVessels(LOTRFoods.DWARF_DRINK); @@ -381,6 +420,8 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugCider, 1, 9999), 8), new LOTRTradeEntry(new ItemStack(LOTRMod.mugRum, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugAppleJuice), 6), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)DUNLENDING_BARTENDER_BUY).setVessels(LOTRFoods.DUNLENDING_DRINK); @@ -401,6 +442,8 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugWater), 2), new LOTRTradeEntry(new ItemStack(LOTRMod.mugMead, 1, 9999), 8), new LOTRTradeEntry(new ItemStack(LOTRMod.mugMilk), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)ROHAN_MEADHOST_BUY).setVessels(LOTRFoods.ROHAN_DRINK); @@ -425,6 +468,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.amber), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.amethyst), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.topaz), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 11), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)BLUE_DWARF_MINER_BUY).setVessels(LOTRFoods.DWARF_DRINK); @@ -475,6 +519,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.ruby), 20), new LOTRTradeEntry(new ItemStack(LOTRMod.amethyst), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.topaz), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 9), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)BLUE_DWARF_MERCHANT_BUY).setVessels(LOTRFoods.DWARF_DRINK); @@ -639,6 +684,10 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.bootsElven), 16), new LOTRTradeEntry(new ItemStack(LOTRMod.horseArmorGaladhrim), 25), new LOTRTradeEntry(new ItemStack(LOTRMod.elvenBow), 20), + new LOTRTradeEntry(new ItemStack(CinderLoE.helmetGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bodyGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.legsGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bootsGildedGalvorn), 100), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(Items.arrow, 4), 3)); @@ -659,6 +708,10 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.bootsHighElven), 16), new LOTRTradeEntry(new ItemStack(LOTRMod.horseArmorHighElven), 25), new LOTRTradeEntry(new ItemStack(LOTRMod.highElvenBow), 20), + new LOTRTradeEntry(new ItemStack(CinderLoE.helmetGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bodyGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.legsGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bootsGildedGalvorn), 100), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(Items.arrow, 4), 3)); @@ -682,6 +735,10 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.bootsWoodElven), 16), new LOTRTradeEntry(new ItemStack(LOTRMod.elkArmorWoodElven), 25), new LOTRTradeEntry(new ItemStack(LOTRMod.mirkwoodBow), 15), + new LOTRTradeEntry(new ItemStack(CinderLoE.helmetGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bodyGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.legsGildedGalvorn), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bootsGildedGalvorn), 100), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(Items.arrow, 4), 3), @@ -697,6 +754,10 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.rhinoRaw), 6), new LOTRTradeEntry(new ItemStack(Items.rotten_flesh), 3), new LOTRTradeEntry(new ItemStack(Items.feather), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.helmetWarlord), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bodyWarlord), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.legsWarlord), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bootsWarlord), 100), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 4), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)MOREDAIN_HUNTSMAN_BUY).setVessels(LOTRFoods.MOREDAIN_DRINK); @@ -736,6 +797,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.amber), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.amethyst), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.topaz), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 9), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)IRON_HILLS_MERCHANT_BUY).setVessels(LOTRFoods.DWARF_DRINK); @@ -751,6 +813,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugChocolate), 4), new LOTRTradeEntry(new ItemStack(LOTRMod.mugTauredainCocoa, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugTauredainCure), 20), + new LOTRTradeEntry(new ItemStack(CinderLoE.chocolatebar, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)TAUREDAIN_SHAMAN_BUY).setVessels(LOTRFoods.TAUREDAIN_DRINK); @@ -782,6 +845,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.legsDwarvenGold), 75), new LOTRTradeEntry(new ItemStack(LOTRMod.bootsDwarvenGold), 70), new LOTRTradeEntry(new ItemStack(LOTRMod.boarArmorDwarven), 25), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(LOTRMod.dwarfBars, 8), 20)); @@ -806,6 +870,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.legsBlueDwarven), 30), new LOTRTradeEntry(new ItemStack(LOTRMod.bootsBlueDwarven), 22), new LOTRTradeEntry(new ItemStack(LOTRMod.boarArmorBlueDwarven), 25), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(LOTRMod.blueDwarfBars, 8), 20)); @@ -906,6 +971,8 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugMead, 1, 9999), 8), new LOTRTradeEntry(new ItemStack(LOTRMod.mugRedWine, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugWhiteWine, 1, 9999), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)GONDOR_BARTENDER_BUY).setVessels(LOTRFoods.GONDOR_DRINK); @@ -1094,6 +1161,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.deerRaw), 4), new LOTRTradeEntry(new ItemStack(Items.leather), 3), new LOTRTradeEntry(new ItemStack(Items.feather), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 4), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)RHUN_BUTCHER_BUY).setVessels(LOTRFoods.RHUN_DRINK); @@ -1265,6 +1333,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { } + /** * @author * @reason @@ -1295,6 +1364,10 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.crossbowBolt, 4), 3), new LOTRTradeEntry(new ItemStack(LOTRMod.ironCrossbow), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.bronzeCrossbow), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.helmetserpent), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bodyserpent), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.legsserpent), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bootsserpent), 100), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(LOTRMod.horseArmorNearHarad), 25)); @@ -1345,6 +1418,10 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.crossbowBolt, 4), 3), new LOTRTradeEntry(new ItemStack(LOTRMod.ironCrossbow), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.bronzeCrossbow), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.helmetUsurper), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bodyUsurper), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.legsUsurper), 100), + new LOTRTradeEntry(new ItemStack(CinderLoE.bootsUsurper), 100), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), new LOTRTradeEntry(new ItemStack(LOTRMod.horseArmorUmbar), 25)); @@ -1399,6 +1476,9 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugLemonLiqueur, 1, 9999), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.mugLimeLiqueur, 1, 9999), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.mugCactusLiqueur, 1, 9999), 15), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), + new LOTRTradeEntry(new ItemStack(CinderLoE.fruitsalad, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)HARNEDOR_BARTENDER_BUY).setVessels(LOTRFoods.HARNEDOR_DRINK); @@ -1481,6 +1561,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack((Block)Blocks.double_plant, 1, 5), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.doubleFlower, 1, 1), 15), new LOTRTradeEntry(new ItemStack(LOTRMod.morgulShroom, 1, 0), 20), + new LOTRTradeEntry(new ItemStack(CinderLoE.spice, 1), 10), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 5), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)HARAD_FLORIST_BUY).setVessels(LOTRFoods.SOUTHRON_DRINK); @@ -1557,6 +1638,9 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugLemonLiqueur, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugLimeLiqueur, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugCactusLiqueur, 1, 9999), 12), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), + new LOTRTradeEntry(new ItemStack(CinderLoE.fruitsalad, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)SOUTHRON_BARTENDER_BUY).setVessels(LOTRFoods.SOUTHRON_DRINK); @@ -1598,6 +1682,9 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugCactusLiqueur, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugBananaBeer, 1, 9999), 12), new LOTRTradeEntry(new ItemStack(LOTRMod.mugMangoJuice), 10), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), + new LOTRTradeEntry(new ItemStack(CinderLoE.fruitsalad, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)GULF_BARTENDER_BUY).setVessels(LOTRFoods.GULF_HARAD_DRINK); @@ -1655,6 +1742,7 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.wall4, 8, 6), 8), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 1), 200), new LOTRTradeEntry(new ItemStack(CinderLoE.forgingKit, 1, 0), 200), + new LOTRTradeEntry(new ItemStack(CinderLoE.spicedHam, 1), 6), new LOTRTradeEntry(new ItemStack(LOTRMod.gateDwarven, 1, 0), 12)); ((MixinLOTRTradeEntriesOverrides)(Object)WICKED_DWARF_BUY).setVessels(LOTRFoods.DWARF_DRINK); @@ -1715,6 +1803,8 @@ public abstract class MixinLOTRTradeEntriesOverrides { new LOTRTradeEntry(new ItemStack(LOTRMod.mugAppleJuice), 6), new LOTRTradeEntry(new ItemStack(LOTRMod.pipeweed, 4), 8), new LOTRTradeEntry(new ItemStack(LOTRMod.hobbitPipe), 25), + new LOTRTradeEntry(new ItemStack(CinderLoE.flatbread, 1), 3), + new LOTRTradeEntry(new ItemStack(CinderLoE.lightStew, 1), 6), new LOTRTradeEntry(new ItemStack(CinderLoE.spiceIngredient, 1, 3), 6666)); ((MixinLOTRTradeEntriesOverrides)(Object)BREE_INNKEEPER_BUY).setVessels(LOTRFoods.BREE_DRINK); diff --git a/src/main/java/com/zivilon/cinder_loe/recipes.java b/src/main/java/com/zivilon/cinder_loe/recipes.java index 1bf759b..ccc23cf 100644 --- a/src/main/java/com/zivilon/cinder_loe/recipes.java +++ b/src/main/java/com/zivilon/cinder_loe/recipes.java @@ -20,6 +20,7 @@ import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.RecipeSorter.Category; import static lotr.common.recipe.LOTRBrewingRecipes.BARREL_CAPACITY; +import static lotr.common.recipe.LOTRRecipes.uncraftableUnsmeltingRecipes; public class recipes { @@ -35,6 +36,7 @@ public class recipes { registerAngmarRecipes(); registerBrewingRecipes(); registerMillstoneRecipes(); + registerSmeltingRecipes(); } public static void registerGeneralRecipes() { @@ -127,7 +129,7 @@ public class recipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.fieldRepairKit), new ItemStack(CinderLoE.forgingKit, 1, 0), - new ItemStack(CinderLoE.spiceIngredient, 1, 1))); + new ItemStack(CinderLoE.forgingKit, 1, 1))); OreDictionary.registerOre("vegetable1", CinderLoE.onion); @@ -170,11 +172,13 @@ public class recipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.fruitsalad), Items.bowl, "fruit1", "fruit2", "fruit3")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.pasta, 4), new ItemStack(LOTRMod.rollingPin, 1, OreDictionary.WILDCARD_VALUE), CinderLoE.dough, CinderLoE.dough)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.halva), Items.sugar, CinderLoE.dough, CinderLoE.spice, LOTRMod.almond)); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.doner_kebab), CinderLoE.dough, "vegetable2", CinderLoE.spice, LOTRMod.kebab)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.doner_kebab), CinderLoE.flatbread, "vegetable2", CinderLoE.spice, LOTRMod.kebab)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.chocolatebar, 2), LOTRMod.mugChocolate)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.pelmen), Items.wheat, "meat", LOTRMod.salt)); GameRegistry.addRecipe(new LOTRRecipesPoisonDrinks()); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.woodpanel, 4), "XY", "YX", + 'X', "logWood" , 'Y', "plankWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderBlock), "XXX", "XYX", "XXX", 'X', Blocks.stone, 'Y', LOTRMod.balrogFire)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.reedBale), "XXX", "XXX", "XXX", @@ -442,4 +446,15 @@ public class recipes { LOTRMillstoneRecipes.addRecipe(LOTRMod.corn, new ItemStack(CinderLoE.flour)); } + public static void registerSmeltingRecipes() { + System.out.println("[CinderLoE] Registering Smelting recipes..."); + + GameRegistry.addSmelting(new ItemStack(CinderLoE.flour), new ItemStack(CinderLoE.flatbread), 0f); + } + + public static void createUnsmeltingRecipes() { + uncraftableUnsmeltingRecipes.add((IRecipe)new ShapedOreRecipe(new ItemStack(LOTRMod.utumnoBow), new Object[]{" XY", "X Y", " XY", Character.valueOf('X'), LOTRMod.orcSteel, Character.valueOf('Y'), Items.string})); + + } + } diff --git a/src/main/java/com/zivilon/cinder_loe/util/RangedDamageUtil.java b/src/main/java/com/zivilon/cinder_loe/util/RangedDamageUtil.java new file mode 100644 index 0000000..ec89412 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/util/RangedDamageUtil.java @@ -0,0 +1,21 @@ +package com.zivilon.cinder_loe.util; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraftforge.event.entity.living.LivingHurtEvent; + +public class RangedDamageUtil { + public static void applyExtraDamage(LivingHurtEvent event, float multiplier) { + EntityLivingBase target = event.entityLiving; + float base = event.ammount; + float extra = base * multiplier; + float currentHealth = target.getHealth(); + if (currentHealth > extra) { + target.setHealth(currentHealth - extra); + event.setCanceled(true); + } else { + event.ammount = currentHealth; + } + } +} + + diff --git a/src/main/java/com/zivilon/cinder_loe/world/CinderGenLayerWorld.java b/src/main/java/com/zivilon/cinder_loe/world/CinderGenLayerWorld.java new file mode 100644 index 0000000..8b27c98 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/world/CinderGenLayerWorld.java @@ -0,0 +1,65 @@ +package com.zivilon.cinder_loe.world; + +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.ModContainer; +import lotr.common.LOTRDimension; +import lotr.common.LOTRMod; +import lotr.common.world.biome.LOTRBiome; +import lotr.common.world.genlayer.LOTRGenLayerWorld; +import org.apache.logging.log4j.Level; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.util.Enumeration; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class CinderGenLayerWorld extends LOTRGenLayerWorld { + private static byte[] biomeImageData; + + public CinderGenLayerWorld() { + super(); + if (!LOTRGenLayerWorld.loadedBiomeImage()) { + try { + BufferedImage biomeImage = null; + String imageName = "assets/lotr/map/map.png"; + ModContainer mc = LOTRMod.getModContainer(); + if (mc.getSource().isFile()) { + ZipFile zip = new ZipFile(mc.getSource()); + Enumeration entries = zip.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + if (!entry.getName().equals(imageName)) continue; + biomeImage = ImageIO.read(zip.getInputStream(entry)); + } + zip.close(); + } else { + File file = new File(LOTRMod.class.getResource("/" + imageName).toURI()); + biomeImage = ImageIO.read(new FileInputStream(file)); + } + if (biomeImage == null) { + throw new RuntimeException("Could not load Cinder biome map image"); + } + imageWidth = biomeImage.getWidth(); + imageHeight = biomeImage.getHeight(); + int[] colors = biomeImage.getRGB(0, 0, imageWidth, imageHeight, null, 0, imageWidth); + biomeImageData = new byte[imageWidth * imageHeight]; + for (int i = 0; i < colors.length; ++i) { + int color = colors[i]; + Integer biomeID = LOTRDimension.MIDDLE_EARTH.colorsToBiomeIDs.get(color); + if (biomeID != null) { + CinderGenLayerWorld.biomeImageData[i] = (byte)biomeID.intValue(); + continue; + } + FMLLog.log((Level) Level.ERROR, (String)("Found unknown biome on map " + Integer.toHexString(color)), (Object[])new Object[0]); + CinderGenLayerWorld.biomeImageData[i] = (byte) LOTRBiome.ocean.biomeID; + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/world/CinderWorldProvider.java b/src/main/java/com/zivilon/cinder_loe/world/CinderWorldProvider.java new file mode 100644 index 0000000..a1cf2c5 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/world/CinderWorldProvider.java @@ -0,0 +1,75 @@ +package com.zivilon.cinder_loe.world; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lotr.common.*; +import lotr.common.world.LOTRWorldChunkManager; +import lotr.common.world.LOTRWorldProvider; +import net.minecraft.util.StatCollector; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.client.IRenderHandler; + +public abstract class CinderWorldProvider extends LOTRWorldProvider { + public static int MOON_PHASES = 8; + @SideOnly(value= Side.CLIENT) + private IRenderHandler lotrSkyRenderer; + @SideOnly(value=Side.CLIENT) + private IRenderHandler lotrCloudRenderer; + @SideOnly(value=Side.CLIENT) + private IRenderHandler lotrWeatherRenderer; + private boolean spawnHostiles = true; + private boolean spawnPeacefuls = true; + private double cloudsR; + private double cloudsG; + private double cloudsB; + private double fogR; + private double fogG; + private double fogB; + + public abstract LOTRDimension getLOTRDimension(); + + public void registerWorldChunkManager() { + this.worldChunkMgr = new LOTRWorldChunkManager(this.worldObj, this.getLOTRDimension()); + this.dimensionId = this.getLOTRDimension().dimensionID; + } + + public String getWelcomeMessage() { + return StatCollector.translateToLocalFormatted((String)"lotr.dimension.enter", (Object[])new Object[]{this.getLOTRDimension().getDimensionName()}); + } + + public String getDepartMessage() { + return StatCollector.translateToLocalFormatted((String)"lotr.dimension.exit", (Object[])new Object[]{this.getLOTRDimension().getDimensionName()}); + } + + public String getSaveFolder() { + return this.getLOTRDimension().dimensionName; + } + + public String getDimensionName() { + return this.getLOTRDimension().dimensionName; + } + + public boolean canRespawnHere() { + return false; + } + + public BiomeGenBase getBiomeGenForCoords(int i, int k) { + Chunk chunk; + if (this.worldObj.blockExists(i, 0, k) && (chunk = this.worldObj.getChunkFromBlockCoords(i, k)) != null) { + int chunkX = i & 0xF; + int chunkZ = k & 0xF; + int biomeID = chunk.getBiomeArray()[chunkZ << 4 | chunkX] & 0xFF; + if (biomeID == 255) { + BiomeGenBase biomegenbase = this.worldChunkMgr.getBiomeGenAt((chunk.xPosition << 4) + chunkX, (chunk.zPosition << 4) + chunkZ); + biomeID = biomegenbase.biomeID; + chunk.getBiomeArray()[chunkZ << 4 | chunkX] = (byte)(biomeID & 0xFF); + } + LOTRDimension dim = this.getLOTRDimension(); + return dim.biomeList[biomeID] == null ? dim.biomeList[0] : dim.biomeList[biomeID]; + } + return this.worldChunkMgr.getBiomeGenAt(i, k); + } + + +} 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 074267e..8461713 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -124,6 +124,7 @@ item.lotr:pasta.name=Pasta item.lotr:pretzel.name=Pretzel item.lotr:halva.name=Halva item.lotr:doner_kebab.name=Döner Kebab +item.lotr:flatbread.name=Flatbread item.lotr:bonemold.name=Bonemold item.lotr:helmetLimwaith.name=Limwaith Helmet @@ -155,6 +156,11 @@ item.lotr:legsArnorBanner.name=Light Arnorian Leggings item.lotr:bootsArnorBanner.name=Light Arnorian Boots item.lotr:maceArnor.name=Arnorian Mace +item.lotr:helmetGildedGalvorn.name=Gilded Galvorn Helmet +item.lotr:bodyGildedGalvorn.name=Gilded Galvorn Chestplate +item.lotr:legsGildedGalvorn.name=Gilded Galvorn Leggings +item.lotr:bootsGildedGalvorn.name=Gilded Galvorn Boots + item.lotr:ingotAsh.name=Ashen Ingot item.lotr:swordAsh.name=Ash-Forged Sword item.lotr:staffAsh.name=Ash-Forged Bardiche @@ -358,6 +364,10 @@ lotr.enchant.stealth=Cloaked lotr.enchant.stealth.desc=Reduces NPC detection range lotr.enchant.mountArmor=Heavy lotr.enchant.mountArmor.desc=+1 mount armor +lotr.enchant.meleeSturdy=Sturdy +lotr.enchant.meleeSturdy.desc=Reduces chance of negative modifiers +lotr.enchant.armorSturdy=Sturdy +lotr.enchant.armorSturdy.desc=Reduces chance of negative modifiers lotr.unit.Banner_Warg=Warg Rider Banner @@ -382,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. @@ -417,5 +427,18 @@ lotr.achievement.tameMonkey.desc=Tame a Monkey lotr.achievement.pickpocketOlog.title=Minor Mistake lotr.achievement.pickpocketOlog.desc=Attempt and Fail to pickpocket an Olog-Hai +lotr.achievement.spiceHumanBrew.title=Invigorated! +lotr.achievement.spiceHumanBrew.desc=Drink a brew infused with Kings Herbs. +lotr.achievement.spiceElfBrew.title=Taste of starlight +lotr.achievement.spiceElfBrew.desc=Drink a brew infused with Silverblend. +lotr.achievement.spiceOrcBrew.title=Ghâsh-Drinker +lotr.achievement.spiceOrcBrew.desc=Drink a brew infused with Morgul Salts. +lotr.achievement.spiceDwarfBrew.title=Belly of Stone +lotr.achievement.spiceDwarfBrew.desc=Drink a brew infused with Stonegrit. +lotr.achievement.Overdose.title=I don't feel so good... +lotr.achievement.Overdose.desc=Overdose on concentrated brews. + + + #Biomes lotr.biome.mistyForest.name=Misty Forest diff --git a/src/main/resources/assets/lotr/armor/gildedgalvorn_1.png b/src/main/resources/assets/lotr/armor/gildedgalvorn_1.png new file mode 100644 index 0000000..a3186dc Binary files /dev/null and b/src/main/resources/assets/lotr/armor/gildedgalvorn_1.png differ diff --git a/src/main/resources/assets/lotr/armor/gildedgalvorn_2.png b/src/main/resources/assets/lotr/armor/gildedgalvorn_2.png new file mode 100644 index 0000000..9ef090c Binary files /dev/null and b/src/main/resources/assets/lotr/armor/gildedgalvorn_2.png differ diff --git a/src/main/resources/assets/lotr/armor/gildedgalvorn_helmet.png b/src/main/resources/assets/lotr/armor/gildedgalvorn_helmet.png new file mode 100644 index 0000000..5a1a359 Binary files /dev/null and b/src/main/resources/assets/lotr/armor/gildedgalvorn_helmet.png differ 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 0000000..46c266b Binary files /dev/null and b/src/main/resources/assets/lotr/item/banner/banner_bank.png differ diff --git a/src/main/resources/assets/lotr/textures/items/bodyGildedGalvorn.png b/src/main/resources/assets/lotr/textures/items/bodyGildedGalvorn.png new file mode 100644 index 0000000..8e5c836 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/bodyGildedGalvorn.png differ diff --git a/src/main/resources/assets/lotr/textures/items/bootsGildedGalvorn.png b/src/main/resources/assets/lotr/textures/items/bootsGildedGalvorn.png new file mode 100644 index 0000000..1daa131 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/bootsGildedGalvorn.png differ diff --git a/src/main/resources/assets/lotr/textures/items/flatbread.png b/src/main/resources/assets/lotr/textures/items/flatbread.png new file mode 100644 index 0000000..32847c6 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/flatbread.png differ diff --git a/src/main/resources/assets/lotr/textures/items/helmetGildedGalvorn.png b/src/main/resources/assets/lotr/textures/items/helmetGildedGalvorn.png new file mode 100644 index 0000000..1039aaa Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/helmetGildedGalvorn.png differ diff --git a/src/main/resources/assets/lotr/textures/items/legsGildedGalvorn.png b/src/main/resources/assets/lotr/textures/items/legsGildedGalvorn.png new file mode 100644 index 0000000..375f134 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/legsGildedGalvorn.png differ diff --git a/src/main/resources/mixins.cinder_loe.json b/src/main/resources/mixins.cinder_loe.json index 6a39d4f..6f4c2cd 100644 --- a/src/main/resources/mixins.cinder_loe.json +++ b/src/main/resources/mixins.cinder_loe.json @@ -47,6 +47,7 @@ "overrides.MixinLOTRTradeEntriesOverrides", "overrides.MixinLOTRUnitTradeEntries", "overrides.MixinLOTRBiome", + "overrides.MixinLOTREnchantmenHelper", "MixinLOTREntityOrc", "MixinEntityLivingBase", "MixinEntityPlayer",