2
0
Fork 0

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/main/java/com/zivilon/cinder_loe/CinderLoE.java
#	src/main/resources/assets/lotr/textures/items/nimveil_blade.png
#	src/main/resources/assets/lotr/textures/items/war_dart_ancient.png
#	src/main/resources/assets/lotr/textures/items/war_dart_heads_1.png
#	src/main/resources/assets/lotr/textures/items/war_dart_mithril.png
frozen
Cleric_red 1 year ago
commit bad721e87b

@ -37,4 +37,5 @@ dependencies {
implementation files('libs/cindercore.jar')
implementation files('libs/lotr.jar')
implementation files('libs/optifine.jar')
implementation files('libs/variabletriggers.jar')
}

Binary file not shown.

@ -4,42 +4,209 @@ import com.zivilon.cinder_loe.entity.corrupt.CorruptMan;
import com.zivilon.cinder_loe.items.BrokenHalo;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.item.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S04PacketEntityEquipment;
import net.minecraft.network.play.server.S09PacketHeldItemChange;
import net.minecraft.network.play.server.S1CPacketEntityMetadata;
import net.minecraft.network.play.server.S19PacketEntityStatus;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import java.util.Random;
public class CinderEventHandler implements IFuelHandler {
private static final Random random = new Random();
public CinderEventHandler() {
FMLCommonHandler.instance().bus().register((Object)this);
MinecraftForge.EVENT_BUS.register((Object)this);
MinecraftForge.TERRAIN_GEN_BUS.register((Object)this);
GameRegistry.registerFuelHandler((IFuelHandler)this);
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.TERRAIN_GEN_BUS.register(this);
GameRegistry.registerFuelHandler(this);
}
@SubscribeEvent
public void onArrowLoose(ArrowLooseEvent event) {
Entity attacker = event.entityLiving;
if (attacker instanceof EntityPlayerMP player) {
ItemStack bow = player.getHeldItem();
if (bow != null && bow.isItemStackDamageable() && (bow.getItem() instanceof LOTRItemBow || bow.getItem() instanceof ItemBow)) {
float[] durabilityThresholds = {0.6f, 0.5f, 0.4f};
double[] probabilities = {0.02, 0.05, 0.1}; // Corrected probabilities
// Corrected durabilityPercent calculation
float durabilityPercent = (float) (bow.getMaxDamage() - bow.getItemDamage()) / bow.getMaxDamage();
for (int j = 0; j < durabilityThresholds.length; j++) {
if (durabilityPercent <= durabilityThresholds[j] && random.nextDouble() <= probabilities[j]) {
addNegativeModifier(bow, player, "bow");
break; // Exit loop once a modifier is added
}
}
}
}
}
@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.6f, 0.5f, 0.4f};
double[] probabilities = {0.02, 0.05, 0.1}; // 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
}
}
}
}
}
}
@SubscribeEvent
public void onLivingHurt(LivingHurtEvent event) {
if (event.entityLiving == null || event.source.getEntity() == null) {
return;
}
EntityLivingBase entity = event.entityLiving;
EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase)event.source.getEntity() : null;
EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase) event.source.getEntity() : null;
World world = entity.worldObj;
DamageSource source = event.source;
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
}
}
}
}
// Negative Arrow Protection Handler
if (!event.entityLiving.worldObj.isRemote && event.source.isProjectile() && event.entityLiving instanceof EntityPlayerMP player) {
// player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "DEBUG: Initial Damage: " + event.ammount));
float totalAdditionalDamage = 0.0f; // Initialize total additional damage
for (int i = 0; i < 4; i++) {
ItemStack armor = player.getEquipmentInSlot(i + 1);
if (armor != null) {
LOTREnchantment protectRangedWeak1 = LOTREnchantment.getEnchantmentByName("protectRangedWeak1");
LOTREnchantment protectRangedWeak2 = LOTREnchantment.getEnchantmentByName("protectRangedWeak2");
if (LOTREnchantmentHelper.hasEnchant(armor, protectRangedWeak1)) {
float additionalDamage = 0.2f; // 20% more damage per piece
totalAdditionalDamage += additionalDamage; // Accumulate damage increase
}
if (LOTREnchantmentHelper.hasEnchant(armor, protectRangedWeak2)) {
float additionalDamage = 0.4f; // 40% more damage per piece
totalAdditionalDamage += additionalDamage; // Accumulate damage increase
}
}
}
// Apply total additional damage
if (totalAdditionalDamage > 0) {
float newDamage = event.ammount * (1 + totalAdditionalDamage); // 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
}
// player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "DEBUG: Total Additional Damage: " + newDamage));
}
}
// Broken Halo Event handler
if (attacker != null && event.source.getSourceOfDamage() == attacker) {
ItemStack helmet = entity.getEquipmentInSlot(4);
if (helmet != null && helmet.getItem() instanceof BrokenHalo) {
if (random.nextDouble() <= 0.25 ) {
if (random.nextDouble() <= 0.25) {
// Summon Corrupt Civilian NPC
CorruptMan spawnedEntity = new CorruptMan(world);
spawnedEntity.copyLocationAndAnglesFrom(attacker);
@ -51,7 +218,7 @@ public class CinderEventHandler implements IFuelHandler {
spawnedEntity.setHealth(10);
spawnedEntity.addPotionEffect(new PotionEffect(Potion.regeneration.id, 9999, 0));
spawnedEntity.onSpawnWithEgg((IEntityLivingData) null);
spawnedEntity.onSpawnWithEgg(null);
world.spawnEntityInWorld(spawnedEntity);
world.playAuxSFXAtEntity(null, 1016, (int) spawnedEntity.posX, (int) spawnedEntity.posY, (int) spawnedEntity.posZ, 0);
world.playSoundAtEntity(entity, "mob.zombie.unfect", 1F, 1F);
@ -59,7 +226,210 @@ public class CinderEventHandler implements IFuelHandler {
}
}
}
// Smithing Rework event handler
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.6f, 0.5f, 0.4f};
double[] probabilities = {0.02, 0.05, 0.1};
if (weapon.isItemStackDamageable()) {
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 (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};
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]) {
addNegativeModifier(armor, player, "armor");
break; // Exit loop once a modifier is added
}
}
}
}
}
}
private void sendNegativeModifierMessage(EntityPlayerMP player, String type) {
player.addChatMessage(new ChatComponentText(
EnumChatFormatting.RED + "Your " +
EnumChatFormatting.GOLD + type +
EnumChatFormatting.RED + " has received a negative modifier!"
));
}
private void playNegativeModifierSound(World world, double x, double y, double z) {
world.playSoundEffect(x, y, z, "mob.irongolem.hit", 1.0F, 2.0F);
}
private void addNegativeModifier(ItemStack item, EntityPlayerMP player, String type) {
NBTTagCompound tag = item.getTagCompound();
if (tag == null) {
tag = new NBTTagCompound();
item.setTagCompound(tag);
}
if (!tag.hasKey("LOTREnch")) {
tag.setTag("LOTREnch", new NBTTagList());
}
NBTTagList enchList = tag.getTagList("LOTREnch", 8); // 8 is the type for strings
boolean protectWeakUpgraded = false;
boolean protectRangedWeakUpgraded = false;
boolean upgraded = false;
boolean meleeSwift = false;
boolean meleeReach = false;
if (type.equals("armor")) {
// First, iterate and upgrade if necessary
for (int i = 0; i < enchList.tagCount(); i++) {
String ench = enchList.getStringTagAt(i);
switch (ench) {
case "protectWeak1" -> {
enchList.removeTag(i);
enchList.appendTag(new NBTTagString("protectWeak2"));
protectWeakUpgraded = true;
i--; // Adjust index after removal
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Armor");
}
case "protectRangedWeak1" -> {
enchList.removeTag(i);
enchList.appendTag(new NBTTagString("protectRangedWeak2"));
protectRangedWeakUpgraded = true;
i--; // Adjust index after removal
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Armor");
}
case "protectWeak2" -> protectWeakUpgraded = true;
case "protectRangedWeak2" -> protectRangedWeakUpgraded = true;
}
}
// After upgrading, check if we need to add a new modifier
if (!protectWeakUpgraded || !protectRangedWeakUpgraded) {
// Separate conditions for adding new modifiers
if (!protectWeakUpgraded && !protectRangedWeakUpgraded) {
// Randomly add either protectWeak1 or protectRangedWeak1
String[] possibleModifiers = {"protectWeak1", "protectRangedWeak1"};
String newModifier = possibleModifiers[random.nextInt(possibleModifiers.length)];
enchList.appendTag(new NBTTagString(newModifier));
} else if (!protectWeakUpgraded) {
// Only protectWeak1 is added
enchList.appendTag(new NBTTagString("protectWeak1"));
} else if (!protectRangedWeakUpgraded) {
// Only protectRangedWeak1 is added
enchList.appendTag(new NBTTagString("protectRangedWeak1"));
}
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Armor");
}
tag.setTag("LOTREnch", enchList);
} else if (type.equals("bow")) {
for (int i = 0; i < enchList.tagCount(); i++) {
String ench = enchList.getStringTagAt(i);
switch (ench) {
case "rangedWeak1" -> {
enchList.removeTag(i);
enchList.appendTag(new NBTTagString("rangedWeak2"));
upgraded = true;
i--; // Adjust index after removal
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Bow");
}
case "rangedWeak2" -> {
enchList.removeTag(i);
enchList.appendTag(new NBTTagString("rangedWeak3"));
upgraded = true;
i--; // Adjust index after removal
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Bow");
}
case "rangedWeak3" -> upgraded = true;
}
}
if (!upgraded) {
// Randomly add either rangedWeak1... etc
String[] possibleModifiers = {"rangedWeak1", "rangedWeak2", "rangedWeak3"};
String newModifier = possibleModifiers[random.nextInt(possibleModifiers.length)];
enchList.appendTag(new NBTTagString(newModifier));
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Weapon");
}
} else if (type.equals("weapon")) {
// First, iterate and upgrade if necessary
for (int i = 0; i < enchList.tagCount(); i++) {
String ench = enchList.getStringTagAt(i);
switch (ench) {
case "weak1" -> {
enchList.removeTag(i);
enchList.appendTag(new NBTTagString("weak2"));
upgraded = true;
i--; // Adjust index after removal
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Weapon");
}
case "weak3" -> {
enchList.removeTag(i);
enchList.appendTag(new NBTTagString("weak4"));
upgraded = true;
i--; // Adjust index after removal
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Weapon");
}
case "weak4" -> upgraded = true;
case "meleeSlow1" -> meleeSwift = true;
case "meleeUnreach1" -> meleeReach = true;
}
}
// After upgrading, check if we need to add a new modifier
if (!upgraded || !meleeSwift || !meleeReach) {
// Separate conditions for adding new modifiers
if (!upgraded && !meleeSwift && !meleeReach) {
// Randomly add one of the possible modifiers
String[] possibleModifiers = {"weak1", "weak2", "weak3", "weak4", "meleeSlow1", "meleeUnreach1"};
String newModifier = possibleModifiers[random.nextInt(possibleModifiers.length)];
enchList.appendTag(new NBTTagString(newModifier));
} else if (!upgraded) {
// Only weak modifier is added
String[] weakModifiers = {"weak1", "weak2", "weak3", "weak4"};
String newModifier = weakModifiers[random.nextInt(weakModifiers.length)];
enchList.appendTag(new NBTTagString(newModifier));
} else if (!meleeSwift) {
// Only meleeSlow1 is added
enchList.appendTag(new NBTTagString("meleeSlow1"));
} else if (!meleeReach) {
// Only meleeUnreach1 is added
enchList.appendTag(new NBTTagString("meleeUnreach1"));
}
playNegativeModifierSound(player.worldObj, player.posX, player.posY, player.posZ);
sendNegativeModifierMessage(player, "Weapon");
}
tag.setTag("LOTREnch", enchList);
}
}
private ItemStack getRandomWeapon() {
Item[] weapons = new Item[]{LOTRMod.blacksmithHammer, LOTRMod.daggerIron, LOTRMod.dunlendingTrident, LOTRMod.battleaxeBronze, CinderLoE.cleaver};

@ -14,6 +14,17 @@ public class CinderLoE_Config {
public static float enchantment_color_blue;
public static String corrupt_faction;
public static boolean objective_lindon;
public static boolean objective_arnor;
public static boolean objective_angmar;
public static boolean objective_durin;
public static boolean objective_dolguldur;
public static boolean objective_woodelf;
public static boolean objective_lothlorien;
public static boolean objective_dale;
public static boolean objective_rhudaur;
public static void init(FMLPreInitializationEvent event) {
File configFile = new File(event.getModConfigurationDirectory(), "CinderLoE.cfg");
config = new Configuration(configFile);
@ -31,6 +42,17 @@ public class CinderLoE_Config {
enchantment_color_blue = config.getFloat("EnchantmentColorBlue", Configuration.CATEGORY_GENERAL, 0.608f, 0.0f, 1.0f, "Configure blue color for enchantments");
corrupt_faction = config.getString("CorruptFaction", Configuration.CATEGORY_GENERAL, "MORDOR", "Configure the alignment the Corrupt npcs follow");
objective_lindon = config.getBoolean("Lindon", Configuration.CATEGORY_GENERAL, false, "set true if Lindon Objective Complete");
objective_arnor = config.getBoolean("Arnor", Configuration.CATEGORY_GENERAL, false,"set true if Arnor Objective Complete");
objective_angmar = config.getBoolean("Angmar", Configuration.CATEGORY_GENERAL, false, "set true if Angmar Objective Complete");
objective_durin = config.getBoolean("Durin", Configuration.CATEGORY_GENERAL, false, "set true if Durin Objective Complete");
objective_dolguldur = config.getBoolean("Dol_Guldur", Configuration.CATEGORY_GENERAL, false,"set true if Dol Guldur Objective Complete");
objective_woodelf = config.getBoolean("Wood_Elf", Configuration.CATEGORY_GENERAL, false, "set true if Wood Elf Objective Complete");
objective_lothlorien = config.getBoolean("Lothlorien", Configuration.CATEGORY_GENERAL, false, "set true if Lothlorien Objective Complete");
objective_dale = config.getBoolean("Dale", Configuration.CATEGORY_GENERAL, false, "set true if Dalish Objective Complete");
objective_rhudaur = config.getBoolean("Rhudaur", Configuration.CATEGORY_GENERAL, false, "set true if Rhudaur Objective Complete");
// Save the configuration if it has changed
if (config.hasChanged()) {
config.save();

@ -0,0 +1,93 @@
package com.zivilon.cinder_loe;
import lotr.common.LOTRLevelData;
import lotr.common.entity.LOTREntities;
import lotr.common.entity.npc.LOTRBannerBearer;
import lotr.common.entity.npc.LOTRHireableBase;
import lotr.common.entity.npc.LOTRUnitTradeEntry;
import lotr.common.fac.LOTRFaction;
import lotr.common.item.LOTRItemCoin;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
public class CinderUnitTradeEntry extends LOTRUnitTradeEntry {
public Class entityClass;
private String name;
private PledgeType pledgeType = PledgeType.NONE;
private String objectivename;
private static Configuration config;
private String extraInfo;
static {
config = new Configuration(new File("CinderLoE.cfg"));
config.load();
}
public CinderUnitTradeEntry(Class c, int cost, float alignment) {
super(c, cost, alignment);
this.entityClass = c; // Set entityClass to the passed class
if (LOTRBannerBearer.class.isAssignableFrom(this.entityClass)) {
this.setExtraInfo("Banner");
}
}
public CinderUnitTradeEntry(Class c, Class c1, String s, int cost, float alignment) {
super(c, cost, alignment);
this.entityClass = c; // Set entityClass to the passed class
this.mountClass = c1;
this.name = s;
}
public boolean isObjectiveComplete(String objective) {
return config.getBoolean(objective, Configuration.CATEGORY_GENERAL, false, "Set true if " + objective + " is complete");
}
@Override
public boolean hasRequiredCostAndAlignment(EntityPlayer entityplayer, LOTRHireableBase trader) {
int coins = LOTRItemCoin.getInventoryValue(entityplayer, false);
if (coins < this.getCost(entityplayer, trader)) {
return false;
}
LOTRFaction fac = trader.getFaction();
if (!this.pledgeType.canAcceptPlayer(entityplayer, fac)) {
return false;
}
if (objectivename != null && !isObjectiveComplete(objectivename)) {
return false;
}
float alignment = LOTRLevelData.getData(entityplayer).getAlignment(fac);
return alignment >= this.alignmentRequired;
}
public CinderUnitTradeEntry setObjective(String objective) {
this.objectivename = objective;
return this;
}
public String getFormattedExtraInfo() {
return StatCollector.translateToLocal((String) "lotr.unitinfo." + this.objectivename);
}
public LOTRUnitTradeEntry setExtraInfo(String s) {
this.extraInfo = s;
return this;
}
public boolean hasExtraInfo() {
return this.extraInfo != null;
}
public String getUnitTradeName() {
if (this.mountClass == null) {
String entityName = LOTREntities.getStringFromClass(this.entityClass);
return StatCollector.translateToLocal((String)("entity." + entityName + ".name"));
}
return StatCollector.translateToLocal((String)("lotr.unit." + this.name));
}
}

@ -3,12 +3,24 @@ package com.zivilon.cinder_loe;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry;
public class ItemRegistration {
public static FMLControlledNamespacedRegistry<Block> block_registry;
public static FMLControlledNamespacedRegistry<Item> item_registry;
static {
block_registry = GameData.getBlockRegistry();
item_registry = GameData.getItemRegistry();
}
public static List<SimpleEntry<Item, String>> list = new ArrayList<>();
@Deprecated
public static void registerItem(Item item, String item_name, int ordinal) {
while (list.size() <= ordinal) {
list.add(new SimpleEntry<>(null, null));
@ -29,4 +41,11 @@ public class ItemRegistration {
GameRegistry.registerItem(entry.getKey(), entry.getValue());
}
}
public static void register(Item item, String item_name, int id) {
item_registry.addObject(id, item_name, item);
}
public static void register(Block block, String item_name, int id) {
block_registry.addObject(id, item_name, block);
}
}

@ -28,7 +28,7 @@ public class LoECreativeTabs extends CreativeTabs {
tabSpawnLoE.theIcon = new ItemStack(CinderLoE.spawnEgg);
tabMiscLoE.theIcon = new ItemStack(CinderLoE.bonemold);
tabFoodLoE.theIcon = new ItemStack(CinderLoE.onion);
tabDecoLoE.theIcon = new ItemStack(CinderLoE.silverChain);
tabDecoLoE.theIcon = new ItemStack(CinderLoE.goldChain);
tabCharacterLoE.theIcon = new ItemStack(CinderLoE.sarumanStaff);
}

@ -0,0 +1,7 @@
package com.zivilon.cinder_loe;
import net.minecraft.util.DamageSource;
public class LoEDamage {
public static DamageSource shadow = (new DamageSource("cinder_loe.shadow")).setDamageBypassesArmor().setMagicDamage();
}

@ -21,14 +21,10 @@ public class Materials {
modifyMaterial("RHUDAUR", 300, 2.5F, 0.6F, 2, 6.0F, 10, LOTRMod.fur);
modifyMaterial("BATTLENUN", 300, 3F, 0.6F, 2, 6.0F, 10, Items.iron_ingot);
modifyMaterial("ASH", 2000, 0.0F, 0.6F, 2, 7.0F, 10, CinderLoE.ingotAsh);
modifyMaterial("SERPENT", 650,2.0F, 0.6F, 2, 6.0F, 10, LOTRMod.bronze);
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("SERPENT", 650, 2.0F, 0.6F, 2, 6.0F, 10, LOTRMod.bronze);
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("NEX_ICE",1500, 0.0F, 0.8F, 0, 9.0F, 10, null);
modifyMaterial("NEX_FIRE",1500, 0.0F, 0.8F, 0, 9.0F, 10, null);
modifyMaterial("NEX_TOXIN",1500, 0.0F, 0.8F, 0, 9.0F, 10, null);
modifyMaterial("NEX_SHADOW",1500, 0.0F, 0.8F, 0, 9.0F, 10, null);
}
public static void modifyMaterial(String fieldName, int uses, float weapon_damage, float protection, int harvest_level, float speed, int enchantability, Item crafting_item) {

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,7 +27,7 @@ public abstract class BarsBase extends BlockPane {
super("", "", Material.iron, true);
this.textureName = Utilities.toSnakeCase(blockName);
this.setBlockName(blockName);
setCreativeTab((CreativeTabs)LOTRCreativeTabs.tabDeco);
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setHardness(5.0F);
setResistance(10.0F);
setStepSound(Block.soundTypeMetal);

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -16,13 +17,7 @@ public class BlockRedDwarfSteel extends Block {
public BlockRedDwarfSteel() {
super(Material.iron); // Choose the appropriate material
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setHardness(5.0F);
setResistance(15.0F);
setStepSound(Block.soundTypeMetal);

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -29,7 +30,7 @@ public abstract class ChandelierBase extends Block {
super(Material.circuits);
this.textureName = Utilities.toSnakeCase(blockName);
this.setBlockName(blockName);
setCreativeTab((CreativeTabs)LOTRCreativeTabs.tabDeco);
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setHardness(0.0F);
setResistance(2.0F);
setStepSound(Block.soundTypeMetal);

@ -0,0 +1,149 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lotr.common.block.LOTRBlockOrcChain;
import net.minecraft.block.*;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.List;
public class CinderChain extends LOTRBlockOrcChain {
public static final String[] chainTypes = {"bronze", "gold", "silver", "iron"};
@SideOnly(value= Side.CLIENT)
private IIcon[] iconMiddle;
@SideOnly(value=Side.CLIENT)
private IIcon[] iconTop;
@SideOnly(value=Side.CLIENT)
private IIcon[] iconBottom;
@SideOnly(value=Side.CLIENT)
private IIcon[] iconSingle;
@SideOnly(Side.CLIENT)
private IIcon[] iconItem;
public CinderChain() {
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
this.setHardness(1.0f);
this.setStepSound(Block.soundTypeMetal);
setBlockName("lotr:cinderchain");
setBlockTextureName("lotr:cinderchain");
float f = 0.2f;
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, 1.0f, 0.5f + f);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
this.iconItem = new IIcon[chainTypes.length];
for (int i = 0; i < chainTypes.length; ++i) {
this.iconItem[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_item");
}
this.iconMiddle = new IIcon[chainTypes.length];
this.iconTop = new IIcon[chainTypes.length];
this.iconBottom = new IIcon[chainTypes.length];
this.iconSingle = new IIcon[chainTypes.length];
for (int i = 0; i < chainTypes.length; ++i) {
this.iconMiddle[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_mid");
this.iconTop[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_top");
this.iconBottom[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_bottom");
this.iconSingle[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_single");
}
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
Block above = world.getBlock(x, y + 1, z);
Block below = world.getBlock(x, y - 1, z);
boolean chainAbove = above instanceof CinderChain;
boolean chainBelow = below instanceof CinderChain;
int meta = world.getBlockMetadata(x, y, z);
if (chainAbove && chainBelow) {
return this.iconMiddle[meta];
}
if (chainAbove) {
return this.iconBottom[meta];
}
if (chainBelow) {
return this.iconTop[meta];
}
return this.iconSingle[meta];
}
@SideOnly(value=Side.CLIENT)
public IIcon getIcon(int i, int j) {
return i == 1 ? this.iconItem[0] : this.iconItem[1];
}
@SideOnly(value=Side.CLIENT)
public String getItemIconName() {
return this.getTextureName();
}
@Override
public int damageDropped(int meta) {
return meta;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < chainTypes.length; ++i) {
list.add(new ItemStack(item, 1, i));
}
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
// The metadata provided here is the metadata of the block being placed (from the item stack).
return metadata; // Return the metadata of the block that should be placed.
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
Block blockAbove = world.getBlock(x, y + 1, z);
int metaAbove = world.getBlockMetadata(x, y + 1, z);
// Get the metadata of the block to be placed (already handled by onBlockPlaced)
int currentMeta = world.getBlockMetadata(x, y, z); // Metadata of the block being placed
// Check if the block above is a chain block and if the metadata matches
if (blockAbove instanceof CinderChain) {
if (metaAbove != currentMeta) {
return false; // Prevent placement of different types of chains
}
return true; // Same type, allow placement
}
// Other checks for fences, walls, slabs, etc.
if (blockAbove instanceof BlockFence || blockAbove instanceof BlockWall) {
return true;
}
if (blockAbove instanceof BlockSlab && !blockAbove.isOpaqueCube() && (metaAbove & 8) == 0) {
return true;
}
if (blockAbove instanceof BlockStairs && (metaAbove & 4) == 0) {
return true;
}
// Check if the block above is solid on the bottom
return blockAbove.isSideSolid(world, x, y + 1, z, ForgeDirection.DOWN);
}
}

@ -0,0 +1,64 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.util.Utilities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lotr.common.LOTRCreativeTabs;
import lotr.common.block.LOTRBlockBrickBase;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.lang.reflect.Field;
import java.util.List;
public class CinderFurBlock extends Block {
protected IIcon[] brickIcons;
protected String[] brickNames;
public CinderFurBlock() {
super(Material.cloth);
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setBlockTextureName("lotr:cinderfur");
setBlockName("lotr:cinderfur");
setStepSound(Block.soundTypeCloth);
this.setBrickNames("brown", "gray", "black", "white", "obsidian", "bearblack", "bearbrown", "lion", "lioness");
}
protected void setBrickNames(String ... names) {
this.brickNames = names;
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconregister) {
this.brickIcons = new IIcon[this.brickNames.length];
for (int i = 0; i < this.brickNames.length; ++i) {
String texturePath = this.getTextureName() + "_" + this.brickNames[i];
System.out.println("Registering texture: " + texturePath); // Debug log
this.brickIcons[i] = iconregister.registerIcon(texturePath);
}
}
@Override
public IIcon getIcon(int side, int meta) {
return this.brickIcons[meta];
}
@Override
public int damageDropped(int meta) {
return meta;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < this.brickNames.length; ++i) {
list.add(new ItemStack(item, 1, i));
}
}
}

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.util.Utilities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,15 +27,7 @@ public class CobbleBlock extends Block {
this.setHardness(1.5f);
this.setResistance(10.0f);
this.setStepSound(Block.soundTypeStone);
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setBlockTextureName("lotr:cindercobble");
setBlockName("lotr:cindercobble");
this.setBrickNames("drystone", "mordor");

@ -1,47 +0,0 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockIce;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.lang.reflect.Field;
import java.util.Random;
public class EnchantedIce extends BlockIce {
public IIcon baseIcon;
public EnchantedIce() {
super();
this.setTickRandomly(false);
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setBlockTextureName("minecraft:ice");
setBlockName("lotr:enchantedIce");
setLightLevel(0.25F);
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
this.baseIcon = iconRegister.registerIcon(this.getTextureName());
}
@Override
public IIcon getIcon(int side, int meta) {
return this.baseIcon;
}
public IIcon getBaseIcon() {
return this.baseIcon;
}
@Override
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {}
}

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lotr.common.LOTRCreativeTabs;
@ -15,13 +16,7 @@ public class FishBarrel extends StaticBlockBase3 {
public FishBarrel() {
super(Material.wood, "lotr:fishbarrel");
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
setStepSound(Block.soundTypeWood);
setBlockName("lotr:fishbarrel");
setHardness(1.0F);

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.blocks.RotatableBlockBase3;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
@ -12,13 +13,7 @@ import java.lang.reflect.Field;
public class FurBundle extends RotatableBlockBase3 {
public FurBundle() {
super(Material.cloth, "lotr:furBundle");
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
setStepSound(Block.soundTypeCloth);
setBlockName("lotr:furBundle");
setHardness(0.5F);

@ -0,0 +1,45 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCarpet;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class FurCarpet extends BlockCarpet {
public FurCarpet()
{
super();
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
this.setTickRandomly(true);
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
this.func_150089_b(0);
setBlockName("lotr:cinderfurcarpet");
setStepSound(Block.soundTypeCloth);
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
return CinderLoE.cinderfur.getIcon(side, meta);
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
{
for (int i = 0; i < 9; ++i)
{
list.add(new ItemStack(itemIn, 1, i));
}
}
}

@ -1,200 +0,0 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cinder_loe.client.render.block.RenderIceCage;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import java.util.List;
import java.util.Random;
public class IceCage extends Block {
@SideOnly(Side.CLIENT)
private IIcon blockIcon;
@SideOnly(Side.CLIENT)
private IIcon emptyIcon;
public IceCage() {
super(Material.ice);
setHardness(2.0F);
setResistance(1.0F);
setStepSound(soundTypeGlass);
setBlockTextureName(Utilities.toSnakeCase("lotr:iceCage"));
setBlockName(Utilities.toSnakeCase("lotr:iceCage"));
setLightOpacity(5); // Semi-transparent
setCreativeTab(CreativeTabs.tabBlock);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return RenderIceCage.RENDER_ID; // Use the custom render type
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return 1;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("lotr:ice_cage");
this.emptyIcon = iconRegister.registerIcon("lotr:invisible");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if ((meta == 0 && side == 1) || (meta == 1 && side == 0)) {
return this.emptyIcon;
}
return this.blockIcon;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F);
}
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) { // Lower part
float thickness = 0.0625F; // 1/16th of a block thickness
AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{
AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall
AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall
AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall
AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F) // Back wall
};
for (AxisAlignedBB boundingBox : boundingBoxes) {
if (boundingBox != null && aabb.intersectsWith(boundingBox)) {
list.add(boundingBox);
}
}
} else if (meta == 1) { // Upper partplayer.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III
float thickness = 0.0625F; // 1/16th of a block thickness
AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{
AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall
AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall
AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall
AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F), // Back wall
AxisAlignedBB.getBoundingBox(x, y + 1.0F - thickness, z, x + 1.0F, y + 1.0F, z + 1.0F) // Ceiling
};
for (AxisAlignedBB boundingBox : boundingBoxes) {
if (boundingBox != null && aabb.intersectsWith(boundingBox)) {
list.add(boundingBox);
}
}
}
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
AxisAlignedBB blockBounds = AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F);
if (blockBounds != null && blockBounds.intersectsWith(player.boundingBox)) {
player.motionX = 0;
player.motionY = 0;
player.motionZ = 0;
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III
}
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) { // Lower part
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 2.0F, z + 1.0F));
for (EntityPlayer player : players) {
player.motionX = 0;
player.motionY = 0;
player.motionZ = 0;
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III
}
}
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
@Override
public int tickRate(World world) {
return 1; // Adjust the tick rate as needed
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return world.isAirBlock(x, y, z) && world.isAirBlock(x, y + 1, z);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2); // Lower part
world.setBlock(x, y + 1, z, this, 1, 2); // Upper part
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) { // Lower part
if (world.getBlock(x, y + 1, z) != this) {
world.setBlockToAir(x, y, z);
}
} else if (meta == 1) { // Upper part
if (world.getBlock(x, y - 1, z) != this) {
world.setBlockToAir(x, y, z);
}
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if (meta == 0) { // Lower part
if (world.getBlock(x, y + 1, z) == this) {
world.setBlockToAir(x, y + 1, z);
}
} else if (meta == 1) { // Upper part
if (world.getBlock(x, y - 1, z) == this) {
world.setBlockToAir(x, y - 1, z);
}
}
super.breakBlock(world, x, y, z, block, meta);
}
}

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.blocks.RotatableBlockBase3;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
@ -12,13 +13,7 @@ import java.lang.reflect.Field;
public class LeatherBundle extends RotatableBlockBase3 {
public LeatherBundle() {
super(Material.cloth, "lotr:leatherBundle");
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.setCreativeTab(LoECreativeTabs.tabDecoLoE);
setStepSound(Block.soundTypeCloth);
setBlockName("lotr:leatherBundle");
setHardness(0.5F);

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.blocks.RotatableBlockBase3;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
@ -12,13 +13,7 @@ import java.lang.reflect.Field;
public class ReedBale extends RotatableBlockBase3 {
public ReedBale() {
super(Material.grass, "lotr:reedBale");
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setCreativeTab(LoECreativeTabs.tabDecoLoE);
setStepSound(Block.soundTypeGrass);
setBlockName("lotr:reedBale");
setHardness(0.5F);

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -19,13 +20,7 @@ public class RunedDwarvenBrick extends Block {
public RunedDwarvenBrick() {
super(Material.rock); // Choose the appropriate material
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setCreativeTab(LoECreativeTabs.tabDecoLoE);
// Set other properties like hardness, resistance, name, etc.
setHardness(2.0F);
setResistance(5.0F);

@ -1,44 +0,0 @@
package com.zivilon.cinder_loe.blocks;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraft.block.BlockPressurePlate;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.lang.reflect.Field;
public class ShadowTile extends BlockPressurePlate {
public ShadowTile() {
super("lotr:shadow_tile", Material.rock, BlockPressurePlate.Sensitivity.players);
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabMisc"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setBlockTextureName("lotr:shadow_tile");
setBlockName("lotr:shadowTile");
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)entity;
player.attackEntityFrom(new DamageSource("shadow"), 10.0F);
player.addPotionEffect(new PotionEffect(15, 6*20, 0, false));
world.setBlockToAir(x, y, z);
}
}
}

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.util.Utilities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -16,13 +17,7 @@ public class cutDrystone extends Block {
public cutDrystone() {
super(Material.rock); // Choose the appropriate material
// Set other properties like hardness, resistance, name, etc.
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.setCreativeTab(LoECreativeTabs.tabBlockLoE);
setHardness(2.0F);
setResistance(5.0F);
setBlockTextureName(Utilities.toSnakeCase("lotr:cut_drystone"));

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.util.Utilities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -15,13 +16,7 @@ public class reeflessCoral extends Block {
public reeflessCoral() {
super(Material.rock); // Choose the appropriate material
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setCreativeTab(LoECreativeTabs.tabBlockLoE);
// Set other properties like hardness, resistance, name, etc.
setHardness(2.0F);
setResistance(5.0F);

@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import com.zivilon.cinder_loe.entity.npc.FangornAnimal;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornAnimal;
public class CharacterEventListener {

@ -7,7 +7,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import com.zivilon.cinder_loe.entity.npc.FangornElk;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornElk;
public class ModelFangornElk extends ModelBase {
private ModelRenderer body;

@ -7,7 +7,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import com.zivilon.cinder_loe.entity.npc.FangornWolf;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornWolf;
@SideOnly(Side.CLIENT)
public class ModelFangornWolf extends ModelBase {

@ -1,200 +0,0 @@
package com.zivilon.cinder_loe.client.model;
import lotr.common.LOTRConfig;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelNex extends ModelBase {
public ModelRenderer body;
public ModelRenderer neck;
public ModelRenderer head;
public ModelRenderer rightArm;
public ModelRenderer leftArm;
public ModelRenderer rightLeg;
public ModelRenderer leftLeg;
public ModelRenderer tail;
public ModelRenderer rightWing;
public ModelRenderer leftWing;
private boolean isFireModel;
public int heldItemRight;
public ModelNex() {
this(0.0F);
}
public ModelNex(float f) {
this.textureWidth = 128;
this.textureHeight = 256;
this.body = new ModelRenderer(this, 0, 38);
this.body.setRotationPoint(0.0F, 7.0F, 3.0F);
this.body.addBox(-8.0F, -15.0F, -6.0F, 16, 18, 12, f);
this.body.setTextureOffset(0, 207);
this.body.addBox(-9.0F, -6.5F, -7.0F, 7, 1, 14, f);
this.body.addBox(-9.0F, -9.5F, -7.0F, 7, 1, 14, f);
this.body.addBox(-9.0F, -12.5F, -7.0F, 7, 1, 14, f);
this.body.mirror = true;
this.body.addBox(2.0F, -6.5F, -7.0F, 7, 1, 14, f);
this.body.addBox(2.0F, -9.5F, -7.0F, 7, 1, 14, f);
this.body.addBox(2.0F, -12.5F, -7.0F, 7, 1, 14, f);
this.body.mirror = false;
this.body.setTextureOffset(0, 0).addBox(-9.0F, -29.0F, -7.0F, 18, 14, 15, f);
this.body.setTextureOffset(81, 163).addBox(-2.0F, -21.0F, 5.5F, 4, 25, 2, f);
this.neck = new ModelRenderer(this, 76, 0);
this.neck.setRotationPoint(0.0F, -25.0F, -3.0F);
this.neck.addBox(-6.0F, -5.0F, -10.0F, 12, 12, 14, f);
this.body.addChild(this.neck);
this.head = new ModelRenderer(this, 92, 48);
this.head.setRotationPoint(0.0F, 0.0F, -10.0F);
this.head.addBox(-4.0F, -6.0F, -6.0F, 8, 10, 7, f);
this.head.setTextureOffset(57, 58).addBox(-6.0F, -7.0F, -4.0F, 12, 4, 4, f);
this.head.rotateAngleX = (float)Math.toRadians(10.0D);
this.neck.addChild(this.head);
ModelRenderer rightHorn1 = new ModelRenderer(this, 57, 47);
rightHorn1.setRotationPoint(-6.0F, -5.0F, -2.0F);
rightHorn1.addBox(-7.0F, -1.5F, -1.5F, 8, 3, 3, f);
rightHorn1.rotateAngleY = (float)Math.toRadians(-35.0D);
this.head.addChild(rightHorn1);
ModelRenderer rightHorn2 = new ModelRenderer(this, 57, 35);
rightHorn2.setRotationPoint(-7.0F, 0.0F, 0.0F);
rightHorn2.addBox(-1.0F, -1.0F, -6.0F, 2, 2, 6, f);
rightHorn2.rotateAngleY = (float)Math.toRadians(45.0D);
rightHorn1.addChild(rightHorn2);
ModelRenderer leftHorn1 = new ModelRenderer(this, 57, 47);
leftHorn1.setRotationPoint(6.0F, -5.0F, -2.0F);
leftHorn1.mirror = true;
leftHorn1.addBox(-1.0F, -1.5F, -1.5F, 8, 3, 3, f);
leftHorn1.rotateAngleY = (float)Math.toRadians(35.0D);
this.head.addChild(leftHorn1);
ModelRenderer leftHorn2 = new ModelRenderer(this, 57, 35);
leftHorn2.setRotationPoint(7.0F, 0.0F, 0.0F);
leftHorn2.mirror = true;
leftHorn2.addBox(-1.0F, -1.0F, -6.0F, 2, 2, 6, f);
leftHorn2.rotateAngleY = (float)Math.toRadians(-45.0D);
leftHorn1.addChild(leftHorn2);
this.rightArm = new ModelRenderer(this, 59, 136);
this.rightArm.setRotationPoint(-9.0F, -25.0F, 0.0F);
this.rightArm.addBox(-7.0F, -2.0F, -4.0F, 7, 10, 8, f);
this.rightArm.setTextureOffset(93, 136).addBox(-6.5F, 8.0F, -3.0F, 6, 16, 6, f);
this.body.addChild(this.rightArm);
this.leftArm = new ModelRenderer(this, 59, 136);
this.leftArm.setRotationPoint(9.0F, -25.0F, 0.0F);
this.leftArm.mirror = true;
this.leftArm.addBox(0.0F, -2.0F, -4.0F, 7, 10, 8, f);
this.leftArm.setTextureOffset(93, 136).addBox(0.5F, 8.0F, -3.0F, 6, 16, 6, f);
this.body.addChild(this.leftArm);
this.rightLeg = new ModelRenderer(this, 46, 230);
this.rightLeg.setRotationPoint(-6.0F, 6.0F, 3.0F);
this.rightLeg.addBox(-7.0F, -2.0F, -4.0F, 7, 9, 8, f);
this.rightLeg.setTextureOffset(46, 208).addBox(-6.5F, 2.0F, 4.0F, 6, 13, 5, f);
ModelRenderer rightFoot = new ModelRenderer(this, 0, 243);
rightFoot.setRotationPoint(0.0F, 0.0F, 0.0F);
rightFoot.addBox(-7.0F, 15.0F, -6.0F, 7, 3, 9, f);
rightFoot.rotateAngleX = (float)Math.toRadians(25.0D);
this.rightLeg.addChild(rightFoot);
this.leftLeg = new ModelRenderer(this, 46, 230);
this.leftLeg.setRotationPoint(6.0F, 6.0F, 3.0F);
this.leftLeg.mirror = true;
this.leftLeg.addBox(0.0F, -2.0F, -4.0F, 7, 9, 8, f);
this.leftLeg.setTextureOffset(46, 208).addBox(0.5F, 2.0F, 4.0F, 6, 13, 5, f);
ModelRenderer leftFoot = new ModelRenderer(this, 0, 243);
leftFoot.setRotationPoint(0.0F, 0.0F, 0.0F);
leftFoot.mirror = true;
leftFoot.addBox(0.0F, 15.0F, -6.0F, 7, 3, 9, f);
leftFoot.rotateAngleX = (float)Math.toRadians(25.0D);
this.leftLeg.addChild(leftFoot);
this.tail = new ModelRenderer(this, 79, 200);
this.tail.setRotationPoint(0.0F, -3.0F, 3.0F);
this.tail.addBox(-3.5F, -3.0F, 2.0F, 7, 7, 10, f);
this.tail.setTextureOffset(80, 225).addBox(-2.5F, -2.5F, 11.0F, 5, 5, 14, f);
this.tail.setTextureOffset(96, 175).addBox(-1.5F, -2.0F, 24.0F, 3, 3, 12, f);
this.body.addChild(this.tail);
this.rightWing = new ModelRenderer(this, 0, 137);
this.rightWing.setRotationPoint(-6.0F, -27.0F, 4.0F);
this.rightWing.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 25, f);
this.rightWing.setTextureOffset(0, 167).addBox(-1.0F, -2.0F, 25.0F, 2, 24, 2, f);
this.rightWing.setTextureOffset(0, 30).addBox(-0.5F, -7.0F, 25.5F, 1, 5, 1, f);
this.rightWing.setTextureOffset(0, 69).addBox(0.0F, 0.0F, 0.0F, 0, 35, 25, f);
this.body.addChild(this.rightWing);
this.leftWing = new ModelRenderer(this, 0, 137);
this.leftWing.setRotationPoint(6.0F, -27.0F, 4.0F);
this.leftWing.mirror = true;
this.leftWing.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 25, f);
this.leftWing.setTextureOffset(0, 167).addBox(-1.0F, -2.0F, 25.0F, 2, 24, 2, f);
this.leftWing.setTextureOffset(0, 30).addBox(-0.5F, -7.0F, 25.5F, 1, 5, 1, f);
this.leftWing.setTextureOffset(0, 69).addBox(0.0F, 0.0F, 0.0F, 0, 35, 25, f);
this.body.addChild(this.leftWing);
}
public void setFireModel() {
this.isFireModel = true;
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.rightWing.showModel = true;
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.body.render(f5);
this.rightLeg.render(f5);
this.leftLeg.render(f5);
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
this.neck.rotateAngleX = (float)Math.toRadians(-10.0D);
this.neck.rotateAngleY = 0.0F;
this.neck.rotateAngleX += f4 / (float)Math.toDegrees(1.0D);
this.neck.rotateAngleY += f3 / (float)Math.toDegrees(1.0D);
this.body.rotateAngleX = (float)Math.toRadians(10.0D);
this.body.rotateAngleX += MathHelper.cos(f2 * 0.03F) * 0.15F;
this.rightArm.rotateAngleX = 0.0F;
this.leftArm.rotateAngleX = 0.0F;
this.rightArm.rotateAngleZ = 0.0F;
this.leftArm.rotateAngleZ = 0.0F;
this.rightArm.rotateAngleX += MathHelper.cos(f * 0.4F + 3.1415927F) * 0.8F * f1;
this.leftArm.rotateAngleX += MathHelper.cos(f * 0.4F) * 0.8F * f1;
this.rightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
this.leftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
if (this.onGround > -9990.0F) {
float f6 = this.onGround;
this.rightArm.rotateAngleY += this.body.rotateAngleY;
this.leftArm.rotateAngleY += this.body.rotateAngleY;
this.leftArm.rotateAngleX += this.body.rotateAngleY;
f6 = 1.0F - this.onGround;
f6 *= f6;
f6 *= f6;
f6 = 1.0F - f6;
float f7 = MathHelper.sin(f6 * 3.1415927F);
float f8 = MathHelper.sin(this.onGround * 3.1415927F) * -(this.head.rotateAngleX - 0.7F) * 0.75F;
this.rightArm.rotateAngleX = (float)(this.rightArm.rotateAngleX - f7 * 1.2D + f8);
this.rightArm.rotateAngleY += this.body.rotateAngleY * 2.0F;
this.rightArm.rotateAngleZ = MathHelper.sin(this.onGround * 3.1415927F) * -0.4F;
}
if (this.heldItemRight != 0)
this.rightArm.rotateAngleX = this.rightArm.rotateAngleX * 0.5F - 0.31415927F * this.heldItemRight;
this.rightLeg.rotateAngleX = (float)Math.toRadians(-25.0D);
this.leftLeg.rotateAngleX = (float)Math.toRadians(-25.0D);
this.rightLeg.rotateAngleX += MathHelper.sin(f * 0.4F) * 1.2F * f1;
this.leftLeg.rotateAngleX += MathHelper.sin(f * 0.4F + 3.1415927F) * 1.2F * f1;
this.rightWing.rotateAngleX = (float)Math.toRadians(40.0D);
this.leftWing.rotateAngleX = (float)Math.toRadians(40.0D);
this.rightWing.rotateAngleY = (float)Math.toRadians(-40.0D);
this.leftWing.rotateAngleY = (float)Math.toRadians(40.0D);
this.rightWing.rotateAngleY += MathHelper.cos(f2 * 0.04F) * 0.5F;
this.leftWing.rotateAngleY -= MathHelper.cos(f2 * 0.04F) * 0.5F;
this.tail.rotateAngleX = (float)Math.toRadians(-40.0D);
this.tail.rotateAngleY = 0.0F;
this.tail.rotateAngleY += MathHelper.cos(f2 * 0.05F) * 0.15F;
this.tail.rotateAngleY += MathHelper.sin(f * 0.1F) * 0.6F * f1;
}
}

@ -1,6 +1,6 @@
package com.zivilon.cinder_loe.client.render;
import com.zivilon.cinder_loe.entity.npc.BattleNun;
import com.zivilon.cinder_loe.entity.npc.good_human.BattleNun;
import lotr.client.model.LOTRModelHuman;
import lotr.client.render.entity.LOTRRenderBiped;
import lotr.client.render.entity.LOTRRandomSkins;

@ -8,7 +8,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import com.zivilon.cinder_loe.client.model.ModelFangornAuroch;
import com.zivilon.cinder_loe.entity.npc.FangornAuroch;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornAuroch;
public class RenderFangornAuroch extends RenderLiving {
public static LOTRRandomSkins aurochsSkins;

@ -1,6 +1,6 @@
package com.zivilon.cinder_loe.client.render;
import com.zivilon.cinder_loe.entity.npc.FangornBear;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornBear;
import java.util.HashMap;
import java.util.Map;

@ -8,7 +8,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import com.zivilon.cinder_loe.client.model.ModelFangornElk;
import com.zivilon.cinder_loe.entity.npc.FangornElk;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornElk;
public class RenderFangornElk extends RenderLiving {
private static LOTRRandomSkins elkSkins;

@ -11,7 +11,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import com.zivilon.cinder_loe.entity.npc.Limwaith;
import com.zivilon.cinder_loe.entity.npc.evil_human.Limwaith;
public class RenderLimwaith extends LOTRRenderBiped {
public static LOTRRandomSkins skinsMale;

@ -1,6 +1,6 @@
package com.zivilon.cinder_loe.client.render;
import com.zivilon.cinder_loe.entity.npc.Limwaith;
import com.zivilon.cinder_loe.entity.npc.evil_human.Limwaith;
import lotr.client.render.entity.LOTRRandomSkins;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityLiving;

@ -1,134 +0,0 @@
package lotr.client.render.entity;
import com.zivilon.cinder_loe.client.model.ModelNex;
import com.zivilon.cinder_loe.entity.Nex;
import lotr.common.entity.LOTRRandomSkinEntity;
import lotr.common.entity.npc.LOTREntityBalrog;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class RenderNex extends RenderLiving {
private static LOTRRandomSkins balrogSkins;
private static LOTRRandomSkins balrogSkinsBright;
private static final ResourceLocation fireTexture = new ResourceLocation("lotr:mob/balrog/fire.png");
private ModelNex balrogModel;
private ModelNex balrogModelBright;
private ModelNex fireModel;
public RenderNex() {
super((ModelBase)new ModelNex(), 0.5F);
this.balrogModel = (ModelNex)this.mainModel;
this.balrogModelBright = new ModelNex(0.05F);
this.fireModel = new ModelNex(0.0F);
this.fireModel.setFireModel();
balrogSkins = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog");
balrogSkinsBright = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog_bright");
}
protected ResourceLocation getEntityTexture(Entity entity) {
return balrogSkins.getRandomSkin((LOTRRandomSkinEntity)entity);
}
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {
Nex balrog = (Nex)entity;
ItemStack heldItem = balrog.getHeldItem();
this.fireModel.heldItemRight = (heldItem == null) ? 0 : 2;
doRender((EntityLiving)balrog, d, d1, d2, f, f1);
}
protected void preRenderCallback(EntityLivingBase entity, float f) {
Nex balrog = (Nex)entity;
float scale = 2.0F;
GL11.glScalef(scale, scale, scale);
}
private void setupFullBright() {
int light = 15728880;
int lx = light % 65536;
int ly = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lx / 1.0F, ly / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
protected int shouldRenderPass(EntityLivingBase entity, int pass, float f) {
Nex balrog = (Nex)entity;
if (pass == 1) {
float alpha;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
GL11.glMatrixMode(5890);
GL11.glLoadIdentity();
float f1 = balrog.ticksExisted + f;
float f2 = f1 * 0.01F;
float f3 = f1 * 0.01F;
GL11.glTranslatef(f2, f3, 0.0F);
GL11.glMatrixMode(5888);
GL11.glAlphaFunc(516, 0.01F);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
alpha = 0.3F + MathHelper.sin(f1 * 0.05F) * 0.15F;
GL11.glColor4f(alpha, alpha, alpha, 1.0F);
GL11.glDisable(2896);
GL11.glDepthMask(false);
setRenderPassModel((ModelBase)this.fireModel);
bindTexture(fireTexture);
return 1;
}
if (pass == 2) {
GL11.glMatrixMode(5890);
GL11.glLoadIdentity();
GL11.glMatrixMode(5888);
GL11.glAlphaFunc(516, 0.1F);
GL11.glDisable(3042);
GL11.glEnable(2896);
GL11.glDepthMask(true);
GL11.glDisable(2896);
setupFullBright();
setRenderPassModel((ModelBase)this.balrogModelBright);
bindTexture(balrogSkinsBright.getRandomSkin((LOTRRandomSkinEntity)balrog));
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return 1;
}
if (pass == 3) {
GL11.glEnable(2896);
GL11.glDisable(3042);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
return -1;
}
protected void renderEquippedItems(EntityLivingBase entity, float f) {
GL11.glColor3f(1.0F, 1.0F, 1.0F);
ItemStack heldItem = entity.getHeldItem();
if (heldItem != null) {
GL11.glPushMatrix();
this.balrogModel.body.postRender(0.0625F);
this.balrogModel.rightArm.postRender(0.0625F);
GL11.glTranslatef(-0.25F, 1.5F, -0.125F);
float scale = 1.25F;
GL11.glScalef(scale, -scale, scale);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
this.renderManager.itemRenderer.renderItem(entity, heldItem, 0);
if (heldItem.getItem().requiresMultipleRenderPasses())
for (int x = 1; x < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); x++)
this.renderManager.itemRenderer.renderItem(entity, heldItem, x);
GL11.glPopMatrix();
}
}
}

@ -1,76 +0,0 @@
package com.zivilon.cinder_loe.client.render.block;
import com.zivilon.cinder_loe.blocks.IceCage;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
public class RenderIceCage implements ISimpleBlockRenderingHandler {
public static final int RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if (modelID != RENDER_ID) return;
// Render inventory block as flat texture icon
renderer.renderBlockAsItem(block, metadata, 1.0F);
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
if (!(block instanceof IceCage) || modelId != RENDER_ID) {
return false;
}
int meta = world.getBlockMetadata(x, y, z);
float thickness = 0.0625F; // 1/16th of a block thickness
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Render the bounding boxes as defined in the block class
if (meta == 0) { // Lower part
renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0, 0, 1, thickness, 1); // Floor
renderer.renderStandardBlock(block, x, y, z);
} else if (meta == 1) { // Upper part
renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 1, 0, 1, 1 + thickness, 1); // Ceiling
renderer.renderStandardBlock(block, x, y, z);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return false; // Do not render as 3D in inventory
}
@Override
public int getRenderId() {
return RENDER_ID;
}
}

@ -67,10 +67,6 @@ public class LOTRMaterialTransformer implements IClassTransformer {
addMaterial("USURPER", classNode);
addMaterial("WARLORD",classNode);
addMaterial("JADE",classNode);
addMaterial("NEX_ICE",classNode);
addMaterial("NEX_FIRE",classNode);
addMaterial("NEX_TOXIN",classNode);
addMaterial("NEX_SHADOW",classNode);
// Protection Conversion

@ -25,8 +25,7 @@ public class LOTRWeaponLinker implements IClassTransformer {
"frostblade", "spearsolidgold", "whip", "spearUnnamed",
"swordBree",
"maceArnor",
"daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh",
"firstAgeGlaive");
"daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh");
}
return basicClass;
}

@ -0,0 +1,50 @@
package com.zivilon.cinder_loe.enchants;
import lotr.common.enchant.LOTREnchantmentProtectionRanged;
import lotr.common.enchant.LOTREnchantmentProtectionSpecial;
import lotr.common.item.LOTRMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.StatCollector;
public class LOTREnchantmentWeakProtectionRanged extends LOTREnchantmentProtectionSpecial {
public LOTREnchantmentWeakProtectionRanged(String s, int level) {
super(s, level);
}
@Override
public String getDescription(ItemStack itemstack) {
return StatCollector.translateToLocalFormatted((String)"lotr.enchant.protectRanged.desc", (Object[])new Object[]{this.formatAdditiveInt(this.calcIntProtection())});
}
@Override
public boolean canApply(ItemStack itemstack, boolean considering) {
if (super.canApply(itemstack, considering)) {
Item item = itemstack.getItem();
return !(item instanceof ItemArmor) || ((ItemArmor)item).getArmorMaterial() != LOTRMaterial.GALVORN.toArmorMaterial();
}
return false;
}
@Override
public boolean isBeneficial() {
// This enchantment is detrimental, so return false
return false;
}
@Override
protected boolean protectsAgainst(DamageSource damageSource) {
return false;
}
@Override
protected int calcIntProtection() {
return this.protectLevel;
}
}

@ -1,117 +0,0 @@
package com.zivilon.cinder_loe.entity;
import java.util.UUID;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.fac.LOTRFaction;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
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.world.World;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import com.zivilon.cinder_loe.CinderLoE;
public class Nex extends LOTREntityNPC {
public AxisAlignedBB collisionBox;
public AxisAlignedBB hitbox;
public int phase = 1;
public ChunkCoordinates currentFlightTarget;
public EntityPlayer playerTarget;
public Nex(World world) {
super(world);
setSize(1.5F, 3.0F);
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.3D, false));
((EntityLiving) this).tasks.addTask(5, (EntityAIBase) new EntityAIWander(this, 1.0D));
((EntityLiving) this).tasks.addTask(9, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
addTargetTasks(true);
}
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(31, Integer.valueOf(0));
}
protected void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1000.0D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
}
public int getPhase() {
return this.dataWatcher.getWatchableObjectInt(31);
}
public void setPhase(int i) {
this.dataWatcher.updateObject(31, Integer.valueOf(i));
}
public LOTRFaction getFaction() {
return LOTRFaction.UTUMNO;
}
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
nbt.setInteger("NexPhase", getPhase());
}
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
setPhase(nbt.getInteger("NexPhase"));
}
public boolean canBePushed() {
return false;
}
protected void fall(float f) {}
protected void updateFallState(double d, boolean flag) {}
protected boolean canDespawn() {
return false;
}
public void onLivingUpdate() {
super.onLivingUpdate();
if (rand.nextBoolean())
((Entity)this).worldObj.spawnParticle("chill", ((Entity)this).posX + (rand.nextDouble() - 0.5D) * ((Entity)this).width, ((Entity)this).posY + rand.nextDouble() * ((Entity)this).height, ((Entity)this).posZ + (rand.nextDouble() - 0.5D) * ((Entity)this).width, 0.0D, 0.0D, 0.0D);
}
protected void dropFewItems(boolean flag, int i) {
return;
}
protected String getHurtSound() {
return "lotr:wight.hurt";
}
protected String getDeathSound() {
return "lotr:wight.death";
}
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
// Do nothing
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return null;
}
}

@ -1,102 +0,0 @@
package com.zivilon.cinder_loe.entity;
import com.zivilon.cinder_loe.CinderLoE;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOpenDoor;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.EntityAIWatchClosest2;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import lotr.common.LOTRFoods;
import lotr.common.LOTRMod;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.ai.LOTREntityAIDrink;
import lotr.common.entity.ai.LOTREntityAIEat;
import lotr.common.entity.ai.LOTREntityAIFollowHiringPlayer;
import lotr.common.entity.ai.LOTREntityAIHiredRemainStill;
import lotr.common.entity.animal.LOTREntityHorse;
import lotr.common.entity.npc.LOTREntityMan;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.entity.npc.LOTRNPCMount;
import lotr.common.entity.npc.LOTRNames;
import lotr.common.fac.LOTRFaction;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class NexShadow extends LOTREntityMan {
String entity_name = "§7Fuinë";
public NexShadow(World world) {
super(world);
setSize(0.6F, 1.8F);
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.3D, false));
((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, EntityPlayer.class, 8.0F, 0.02F));
((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, LOTREntityNPC.class, 5.0F, 0.02F));
((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, EntityLiving.class, 8.0F, 0.02F));
((EntityLiving) this).tasks.addTask(9, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
addTargetTasks(true);
}
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
}
public void setupNPCGender() {
this.familyInfo.setMale(true);
}
protected void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
}
public LOTRFaction getFaction() {
return LOTRFaction.UTUMNO;
}
public String getNPCName() {
return entity_name;
}
public String getNPCFormattedName(String npcName, String entityName) {
return entity_name;
}
protected void onAttackModeChange(LOTREntityNPC.AttackMode mode, boolean mounted) {
}
protected void dropFewItems(boolean flag, int i) {
}
public boolean getCanSpawnHere() {
return false;
}
public String getSpeechBank(EntityPlayer entityplayer) {
return "nex/shadow";
}
public void setupNPCName() {
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return null;
}
}

@ -0,0 +1,97 @@
package com.zivilon.cinder_loe.entity.ai;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.entity.projectile.LOTREntitySpear;
import lotr.common.item.LOTRItemSpear;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityLiving;
import net.minecraft.pathfinding.PathEntity;
import java.util.List;
public class LoEPreciseAttackOnCollide extends LOTREntityAIAttackOnCollide {
public double attack_range;
public int attack_cooldown;
public LoEPreciseAttackOnCollide(EntityCreature entity, double speed, double reach, int delay, boolean flag) {
super(entity, speed, flag);
attack_range = reach;
attack_cooldown = delay;
}
@Override
public void updateTask() {
updateLookAndPathing();
if (this.attackTick > 0)
this.attackTick--;
ItemStack weapon = this.theOwner.getHeldItem();
// Throw a throwing spear if available
if (weapon != null && weapon.getItem() instanceof LOTRItemSpear && this.attackTick <= 0 && this.theOwner instanceof LOTREntityNPC) {
LOTREntityNPC theNPC = (LOTREntityNPC)this.theOwner;
ItemStack spearBackup = theNPC.npcItemsInv.getSpearBackup();
if (spearBackup != null) {
LOTRItemSpear spearItem = (LOTRItemSpear)weapon.getItem();
double d = this.theOwner.getDistanceToEntity((Entity)this.attackTarget);
double range = this.theOwner.getNavigator().getPathSearchRange();
if (d > 5.0D && d < range * 0.75D) {
LOTREntitySpear spear = new LOTREntitySpear(this.worldObj, (EntityLivingBase)this.theOwner, this.attackTarget, weapon.copy(), 0.75F + (float)d * 0.025F, 0.5F);
this.worldObj.playSoundAtEntity((Entity)this.theOwner, "random.bow", 1.0F, 1.0F / (this.worldObj.rand.nextFloat() * 0.4F + 1.2F) + 0.25F);
this.worldObj.spawnEntityInWorld((Entity)spear);
this.attackTick = 30 + this.theOwner.getRNG().nextInt(20);
if (ItemStack.areItemStacksEqual(theNPC.npcItemsInv.getIdleItem(), theNPC.npcItemsInv.getMeleeWeapon()))
theNPC.npcItemsInv.setIdleItem(spearBackup);
theNPC.npcItemsInv.setMeleeWeapon(spearBackup);
theNPC.npcItemsInv.setSpearBackup(null);
return;
}
}
}
float weaponReach = 1.0F;
if (this.theOwner.ridingEntity != null)
weaponReach = LOTREntityNPC.MOUNT_RANGE_BONUS;
if (weapon == null) {
weaponReach = (float)attack_range;
} else {
weaponReach *= LOTRWeaponStats.getMeleeReachFactor(weapon);
}
float meleeRange = (float)this.theOwner.boundingBox.getAverageEdgeLength() + weaponReach;
double distanceSq = this.theOwner.getDistanceSqToEntity((Entity)this.attackTarget);
if (distanceSq <= (meleeRange * meleeRange) || this.theOwner.boundingBox.intersectsWith(this.attackTarget.boundingBox)) {
if (this.attackTick <= 0) {
this.attackTick = (weapon == null) ? attack_cooldown : LOTRWeaponStats.getAttackTimeMob(weapon); // Apply cooldown here
this.theOwner.attackEntityAsMob((Entity)this.attackTarget);
this.theOwner.swingItem();
}
}
}
@Override
protected void updateLookAndPathing() {
this.theOwner.getLookHelper().setLookPositionWithEntity((Entity)this.attackTarget, 30.0F, 30.0F);
if (this.theOwner.riddenByEntity != null && this.theOwner.riddenByEntity instanceof EntityLiving) {
((EntityLiving)this.theOwner.riddenByEntity).rotationYaw = this.theOwner.rotationYaw;
((EntityLiving)this.theOwner.riddenByEntity).rotationYawHead = this.theOwner.rotationYawHead;
}
if ((this.sightNotRequired || this.theOwner.getEntitySenses().canSee((Entity)this.attackTarget)) && --this.pathCheckTimer <= 0) {
this.pathCheckTimer = 2;
PathEntity path = getPathEntity();
if (path != null)
this.theOwner.getNavigator().setPath(path, this.moveSpeed);
}
}
public PathEntity getPathEntity() {
if (this.theOwner.ridingEntity != null)
return this.worldObj.getPathEntityToEntity((Entity)this.theOwner, (Entity)this.attackTarget, this.theOwner.getNavigator().getPathSearchRange(), true, this.theOwner.getNavigator().getCanBreakDoors(), this.theOwner.getNavigator().getAvoidsWater(), false);
return this.theOwner.getNavigator().getPathToEntityLiving((Entity)this.attackTarget);
}
}

@ -1,52 +0,0 @@
package com.zivilon.cinder_loe.entity.npc;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityDwarfWarrior;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class DwarfLevy extends LOTREntityDwarfWarrior {
private static ItemStack[] levyWeapons = new ItemStack[]{new ItemStack(LOTRMod.daggerDwarven), new ItemStack(LOTRMod.daggerDwarvenPoisoned), new ItemStack(LOTRMod.swordDwarven), new ItemStack(LOTRMod.axeDwarven), new ItemStack(LOTRMod.battleaxeDwarven), new ItemStack(LOTRMod.hammerDwarven), new ItemStack(Items.iron_axe), new ItemStack(LOTRMod.battleaxeIron), new ItemStack(LOTRMod.spearDwarven), new ItemStack(LOTRMod.spearIron)};
private static ItemStack[] levySpears = new ItemStack[]{new ItemStack(LOTRMod.spearDwarven), new ItemStack(LOTRMod.spearIron)};
private static ItemStack[] levyBodies = new ItemStack[]{new ItemStack(Items.leather_chestplate), new ItemStack(LOTRMod.bodyDaleGambeson)};
private static ItemStack[] levyLegs = new ItemStack[]{new ItemStack(Items.leather_leggings), new ItemStack(Items.iron_leggings)};
private static ItemStack[] levyBoots = new ItemStack[]{new ItemStack(Items.leather_boots), new ItemStack(LOTRMod.bootsBronze), null};
private static final int[] colors = new int[]{14823729, 5512477, 14196753, 11374145, 7366222};
public DwarfLevy(World world) {
super(world);
this.npcShield = null;
}
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
data = super.onSpawnWithEgg(data);
int i = (this).rand.nextInt(levyWeapons.length);
this.npcItemsInv.setMeleeWeapon(levyWeapons[i].copy());
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
if ((this).rand.nextInt(5) == 0) {
this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
i = (this).rand.nextInt(levySpears.length);
this.npcItemsInv.setMeleeWeapon(levySpears[i].copy());
}
i = (this).rand.nextInt(levyBoots.length);
this.setCurrentItemOrArmor(1, levyBoots[i].copy());
i = (this).rand.nextInt(levyLegs.length);
this.setCurrentItemOrArmor(2, levyLegs[i].copy());
i = (this).rand.nextInt(levyBodies.length);
this.setCurrentItemOrArmor(3, levyBodies[i].copy());
this.setCurrentItemOrArmor(4, null);
return data;
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return new ItemStack(CinderLoE.spawnEgg, 1, 24);
}
}

@ -1,60 +0,0 @@
package com.zivilon.cinder_loe.entity.npc;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityBreeGuard;
import lotr.common.entity.npc.LOTREntityNearHaradrim;
import lotr.common.item.LOTRItemHaradRobes;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.util.MovingObjectPosition;
public class HaradLevy extends LOTREntityNearHaradrim {
private static ItemStack[] levyWeapons = new ItemStack[]{new ItemStack(LOTRMod.daggerHarad), new ItemStack(LOTRMod.daggerHaradPoisoned), new ItemStack(LOTRMod.swordHarad), new ItemStack(LOTRMod.swordMoredain), new ItemStack(LOTRMod.battleaxeBronze), new ItemStack(LOTRMod.maceNearHarad), new ItemStack(Items.iron_sword), new ItemStack(LOTRMod.swordBronze), new ItemStack(LOTRMod.battleaxeIron), new ItemStack(LOTRMod.poleaxeNearHarad), new ItemStack(LOTRMod.spearHarad), new ItemStack(LOTRMod.spearIron), new ItemStack(LOTRMod.spearBronze)};
private static ItemStack[] levySpears = new ItemStack[]{new ItemStack(LOTRMod.spearHarad), new ItemStack(LOTRMod.spearIron), new ItemStack(LOTRMod.spearBronze)};
private static ItemStack[] levyBodies = new ItemStack[]{new ItemStack(Items.leather_chestplate), new ItemStack(LOTRMod.bodyBronze), new ItemStack(LOTRMod.bodyHaradRobes)};
private static ItemStack[] levyLegs = new ItemStack[]{new ItemStack(Items.leather_leggings), new ItemStack(LOTRMod.legsBronze)};
private static ItemStack[] levyBoots = new ItemStack[]{new ItemStack(Items.leather_boots), new ItemStack(LOTRMod.bootsBronze), null};
private static final int[] colors = new int[]{14823729, 5512477, 14196753, 11374145, 7366222};
public HaradLevy(World world) {
super(world);
this.spawnRidingHorse = false;
this.addTargetTasks(true);
this.npcShield = null;
}
@Override
public void setupNPCGender() {
this.familyInfo.setMale(true);
}
@Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
data = super.onSpawnWithEgg(data);
int i = (this).rand.nextInt(levyWeapons.length);
this.npcItemsInv.setMeleeWeapon(levyWeapons[i].copy());
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
if ((this).rand.nextInt(5) == 0) {
this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
i = (this).rand.nextInt(levySpears.length);
this.npcItemsInv.setMeleeWeapon(levySpears[i].copy());
}
i = (this).rand.nextInt(levyBoots.length);
this.setCurrentItemOrArmor(1, levyBoots[i].copy());
i = (this).rand.nextInt(levyLegs.length);
this.setCurrentItemOrArmor(2, levyLegs[i].copy());
i = (this).rand.nextInt(levyBodies.length);
this.setCurrentItemOrArmor(3, levyBodies[i].copy());
this.setCurrentItemOrArmor(4, null);
return data;
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return new ItemStack(CinderLoE.spawnEgg, 1, 25);
}
}

@ -0,0 +1,29 @@
package com.zivilon.cinder_loe.entity.npc;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.entity.npc.LOTRBannerBearer;
import lotr.common.entity.npc.LOTREntityHobbitBounder;
import lotr.common.item.LOTRItemBanner;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class HobbitBannerBearer extends LOTREntityHobbitBounder implements LOTRBannerBearer {
public HobbitBannerBearer(World world) {
super(world);
}
@Override
public LOTRItemBanner.BannerType getBannerType() {
return LOTRItemBanner.BannerType.HOBBIT;
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return new ItemStack(CinderLoE.spawnEgg, 1, 16);
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) {
}
}

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.dwarf;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.dwarf;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.dwarf;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.dwarf;
import com.zivilon.cinder_loe.CinderLoE;

@ -0,0 +1,82 @@
package com.zivilon.cinder_loe.entity.npc.elf;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRAchievement;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityHighElf;
import lotr.common.entity.npc.LOTREntityHighElfWarrior;
import lotr.common.entity.npc.LOTREntityMoredain;
import lotr.common.entity.npc.LOTRNPCMount;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class Sirrandrai extends LOTREntityHighElfWarrior {
public Sirrandrai(World world) {
super(world);
this.tasks.addTask(2, this.meleeAttackAI);
this.spawnRidingHorse = this.rand.nextInt(4) == 0;
this.npcShield = LOTRShields.ALIGNMENT_HIGH_ELF;
}
@Override
protected EntityAIBase createElfMeleeAttackAI() {
return new LOTREntityAIAttackOnCollide(this, 1.5, false);
}
@Override
protected EntityAIBase createElfRangedAttackAI() {
return this.createElfMeleeAttackAI();
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24.0);
}
@Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
data = super.onSpawnWithEgg(data);
int i = this.rand.nextInt(2);
if (i == 0) {
this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.polearmHighElven));
if (this.rand.nextInt(5) == 0) {
this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearHighElven));
}
} else if (i == 1) {
this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearHighElven));
this.npcItemsInv.setSpearBackup(null);
}
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
this.npcItemsInv.setRangedWeapon(this.npcItemsInv.getMeleeWeapon());
this.setCurrentItemOrArmor(1, new ItemStack(LOTRMod.bootsHighElven));
this.setCurrentItemOrArmor(2, new ItemStack(LOTRMod.legsHighElven));
this.setCurrentItemOrArmor(3, new ItemStack(LOTRMod.bodyHighElven));
this.setCurrentItemOrArmor(4, new ItemStack(LOTRMod.helmetHighElven));
return data;
}
@Override
public float getAlignmentBonus() {
return 3.0f;
}
@Override
public String getSpeechBank(EntityPlayer entityplayer) {
if (this.isFriendlyAndAligned(entityplayer)) {
if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) {
return "highElf/elf/hired";
}
return "highElf/warrior/friendly";
}
return "highElf/warrior/hostile";
}
}

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -0,0 +1,44 @@
package com.zivilon.cinder_loe.entity.npc.evil_human;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityAngmarHillmanWarrior;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class RhudaurSoldier extends LOTREntityAngmarHillmanWarrior {
private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordAngmar), new ItemStack(LOTRMod.battleaxeAngmar), new ItemStack(LOTRMod.hammerAngmar), new ItemStack(LOTRMod.polearmAngmar), new ItemStack(LOTRMod.spearAngmar)};
private static ItemStack[] helmets = new ItemStack[]{new ItemStack(CinderLoE.helmetRhudaur)};
private static ItemStack[] bodies = new ItemStack[]{new ItemStack(CinderLoE.bodyRhudaur)};
private static ItemStack[] legs = new ItemStack[]{new ItemStack(CinderLoE.legsRhudaur)};
private static ItemStack[] boots = new ItemStack[]{new ItemStack(CinderLoE.bootsRhudaur)};
public RhudaurSoldier(World world) {
super(world);
this.npcShield = LOTRShields.ALIGNMENT_MORDOR;
}
@Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
data = super.onSpawnWithEgg(data);
int i = this.rand.nextInt(weapons.length);
this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
i = this.rand.nextInt(boots.length);
this.setCurrentItemOrArmor(1, boots[i].copy());
i = this.rand.nextInt(legs.length);
this.setCurrentItemOrArmor(2, legs[i].copy());
i = this.rand.nextInt(bodies.length);
this.setCurrentItemOrArmor(3, bodies[i].copy());
if (this.rand.nextInt(5) != 0) {
i = this.rand.nextInt(helmets.length);
this.setCurrentItemOrArmor(4, helmets[i].copy());
}
return data;
}
}

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.entity.npc.LOTRBannerBearer;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRCapes;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityDunedain;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;

@ -0,0 +1,23 @@
package com.zivilon.cinder_loe.entity.npc.good_human;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityDaleSoldier;
import lotr.common.entity.npc.LOTREntityDunedain;
import lotr.common.fac.LOTRFaction;
import lotr.common.quest.LOTRMiniQuest;
import lotr.common.quest.LOTRMiniQuestFactory;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EsgarothSoldier extends LOTREntityDaleSoldier {
public EsgarothSoldier(World world) {
super(world);
this.npcShield = LOTRShields.ALIGNMENT_ESGAROTH;
}
}

@ -0,0 +1,54 @@
package com.zivilon.cinder_loe.entity.npc.good_human;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityDaleSoldier;
import lotr.common.entity.npc.LOTREntityTauredain;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class TauredainTrueBlood extends LOTREntityTauredain {
public TauredainTrueBlood(World world) {
super(world);
this.npcShield = LOTRShields.ALIGNMENT_TAUREDAIN;
}
@Override
public EntityAIBase createHaradrimAttackAI() {
return new LOTREntityAIAttackOnCollide(this, 1.7, false);
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(26.0);
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24.0);
this.getEntityAttribute(npcAttackDamageExtra).setBaseValue(2.0);
}
private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordTauredain), new ItemStack(LOTRMod.battleaxeTauredain), new ItemStack(LOTRMod.hammerTauredain), new ItemStack(LOTRMod.spearTauredain), new ItemStack(LOTRMod.pikeTauredain)};
private static ItemStack[] helmets = new ItemStack[]{new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainChieftain), new ItemStack(LOTRMod.helmetTauredainGold, 0)};
private static ItemStack[] bodies = new ItemStack[]{new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredain), new ItemStack(LOTRMod.bodyTauredainGold, 0)};
private static ItemStack[] legs = new ItemStack[]{new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredain), new ItemStack(LOTRMod.legsTauredainGold, 0)};
private static ItemStack[] boots = new ItemStack[]{new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredain), new ItemStack(LOTRMod.bootsTauredainGold, 0)};
@Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
data = super.onSpawnWithEgg(data);
int i = this.rand.nextInt(weapons.length);
this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
i = this.rand.nextInt(boots.length);
this.setCurrentItemOrArmor(1, boots[i].copy());
i = this.rand.nextInt(legs.length);
this.setCurrentItemOrArmor(2, legs[i].copy());
i = this.rand.nextInt(bodies.length);
this.setCurrentItemOrArmor(3, bodies[i].copy());
if (this.rand.nextInt(5) != 0) {
i = this.rand.nextInt(helmets.length);
this.setCurrentItemOrArmor(4, helmets[i].copy());
}
return data;
}
}

@ -0,0 +1,13 @@
package com.zivilon.cinder_loe.entity.npc.orc;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityMordorOrc;
import net.minecraft.world.World;
public class MorgulOrc extends LOTREntityMordorOrc {
public MorgulOrc(World world) {
super(world);
this.npcShield = LOTRShields.ALIGNMENT_MINAS_MORGUL;
}
}

@ -0,0 +1,74 @@
package com.zivilon.cinder_loe.entity.npc.orc;
import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityAngmarHillmanWarrior;
import lotr.common.entity.npc.LOTREntityGundabadUruk;
import lotr.common.fac.LOTRFaction;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class NorthernOrc extends LOTREntityGundabadUruk {
private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordAngmar), new ItemStack(LOTRMod.battleaxeAngmar), new ItemStack(LOTRMod.hammerGundabadUruk), new ItemStack(LOTRMod.polearmAngmar), new ItemStack(LOTRMod.spearAngmar), new ItemStack(LOTRMod.swordGundabadUruk)};
private static ItemStack[] helmets = new ItemStack[]{new ItemStack(LOTRMod.helmetAngmar), new ItemStack(LOTRMod.helmetGundabadUruk), new ItemStack(LOTRMod.helmetBone)};
private static ItemStack[] bodies = new ItemStack[]{new ItemStack(LOTRMod.bodyAngmar), new ItemStack(LOTRMod.bodyGundabadUruk), new ItemStack(LOTRMod.bodyUruk)};
private static ItemStack[] legs = new ItemStack[]{new ItemStack(LOTRMod.legsAngmar), new ItemStack(LOTRMod.legsGundabadUruk), new ItemStack(LOTRMod.legsUruk)};
private static ItemStack[] boots = new ItemStack[]{new ItemStack(LOTRMod.bootsAngmar), new ItemStack(LOTRMod.bootsGundabadUruk), new ItemStack(LOTRMod.bootsUruk)};
public NorthernOrc(World world) {
super(world);
this.setSize(0.6f, 1.8f);
this.isWeakOrc = false;
this.npcShield = LOTRShields.ALIGNMENT_ANGMAR;
}
@Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
data = super.onSpawnWithEgg(data);
int i = this.rand.nextInt(weapons.length);
this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
i = this.rand.nextInt(boots.length);
this.setCurrentItemOrArmor(1, boots[i].copy());
i = this.rand.nextInt(legs.length);
this.setCurrentItemOrArmor(2, legs[i].copy());
i = this.rand.nextInt(bodies.length);
this.setCurrentItemOrArmor(3, bodies[i].copy());
if (this.rand.nextInt(5) != 0) {
i = this.rand.nextInt(helmets.length);
this.setCurrentItemOrArmor(4, helmets[i].copy());
}
return data;
}
@Override
public LOTRFaction getFaction() {
return LOTRFaction.ANGMAR;
}
@Override
public String getSpeechBank(EntityPlayer entityplayer) {
if (this.isFriendlyAndAligned(entityplayer)) {
if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) {
return "angmar/orc/hired";
}
if (LOTRLevelData.getData(entityplayer).getAlignment(this.getFaction()) >= 100.0f) {
return "angmar/orc/friendly";
}
return "angmar/orc/neutral";
}
return "angmar/orc/hostile";
}
@Override
public boolean canOrcSkirmish() {
return false;
}
}

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.radagast;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.radagast;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.radagast;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.radagast;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.radagast;
import com.zivilon.cinder_loe.CinderLoE;

@ -1,4 +1,4 @@
package com.zivilon.cinder_loe.entity.npc;
package com.zivilon.cinder_loe.entity.npc.radagast;
import com.zivilon.cinder_loe.CinderLoE;

@ -13,6 +13,8 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
public class EntityWarDart extends LOTREntityProjectileBase {
@ -33,7 +35,8 @@ public class EntityWarDart extends LOTREntityProjectileBase {
public int knockbackStrength = 0;
public ItemStack item;
public int damage;
public double damage;
public int dart_type;
public EntityWarDart(World world) {
super(world);
@ -44,6 +47,7 @@ public class EntityWarDart extends LOTREntityProjectileBase {
this.item = item.copy(); // Store a copy of the item stack
this.item.stackSize = 1;
this.damage = WarDart.getDamageFromMeta(item.getItemDamage());
this.dart_type = item.getItemDamage();
}
@Override
@ -104,9 +108,18 @@ public class EntityWarDart extends LOTREntityProjectileBase {
}
}
@Override
protected void onCollideWithTarget(Entity entity) {
super.onCollideWithTarget(entity);
if (entity instanceof EntityLivingBase)
if (this.dart_type == 14) {
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.wither.id, 160));
}
}
@Override
public float getBaseImpactDamage(Entity entity, ItemStack itemStack) {
return this.damage;
return (float)this.damage;
}
@Override
@ -144,6 +157,7 @@ public class EntityWarDart extends LOTREntityProjectileBase {
this.item = ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("Item"));
if (this.item != null) {
this.damage = WarDart.getDamageFromMeta(this.item.getItemDamage());
this.dart_type = this.item.getItemDamage();
this.dataWatcher.updateObject(ITEMSTACK_WATCHER_ID, this.item); // Ensure DataWatcher is updated with the deserialized ItemStack
}
}

@ -2,7 +2,7 @@ package com.zivilon.cinder_loe.entity.trader;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.entity.npc.Limwaith;
import com.zivilon.cinder_loe.entity.npc.evil_human.Limwaith;
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.entity.npc.LOTRTradeEntries;

@ -2,7 +2,7 @@ package com.zivilon.cinder_loe.entity.trader;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.entity.npc.Limwaith;
import com.zivilon.cinder_loe.entity.npc.evil_human.Limwaith;
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.entity.npc.LOTRTradeEntries;

@ -0,0 +1,56 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class CinderFurItem extends Item {
public IIcon[] icons;
public CinderFurItem() {
super();
this.setCreativeTab(LoECreativeTabs.tabMiscLoE);
setHasSubtypes(true);
}
@Override
public void registerIcons(IIconRegister iconRegister) {
icons = new IIcon[7];
for (int i = 0; i < 7; i++) {
icons[i] = iconRegister.registerIcon("lotr:cinder_fur_item_" + i);
}
}
@Override
public String getUnlocalizedName(ItemStack item) {
return "item.cinder_fur_item_" + item.getItemDamage();
}
@Override
public IIcon getIconIndex(ItemStack item) {
return getIcon(item, 0);
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass) {
int dmg = stack.getItemDamage();
// Ensure dmg is within the expected range of subtypes
if (dmg < 7) {
return icons[dmg];
}
return icons[0]; // Default to 0 if out of bounds
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 7; i++) {
list.add(new ItemStack(item, 1, i));
}
}
}

@ -1,11 +1,16 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.entity.*;
import com.zivilon.cinder_loe.entity.corrupt.*;
import com.zivilon.cinder_loe.entity.npc.*;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfArbalest;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfBannerBearer;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfCommander;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfWarrior;
import com.zivilon.cinder_loe.entity.npc.evil_human.*;
import com.zivilon.cinder_loe.entity.npc.good_human.*;
import com.zivilon.cinder_loe.entity.npc.radagast.*;
import com.zivilon.cinder_loe.entity.trader.*;
import net.minecraft.creativetab.CreativeTabs;
@ -75,8 +80,6 @@ public class CinderLoESpawnEgg extends Item {
ENTITY_CLASSES.add(BreeOutrider.class);
ENTITY_CLASSES.add(BreeSoldierBannerBearer.class);
ENTITY_CLASSES.add(BreeCaptain.class);
ENTITY_CLASSES.add(DwarfLevy.class); // unregistered
ENTITY_CLASSES.add(HaradLevy.class); // unregistered
ENTITY_CLASSES.add(FangornElk.class);
ENTITY_CLASSES.add(FangornBear.class);
ENTITY_CLASSES.add(FangornWildBoar.class);
@ -92,6 +95,7 @@ public class CinderLoESpawnEgg extends Item {
ENTITY_CLASSES.add(CorruptHobbit.class);
ENTITY_CLASSES.add(CorruptMan.class);
ENTITY_CLASSES.add(CorruptOrc.class);
ENTITY_CLASSES.add(HobbitBannerBearer.class);
}
@Override
@ -115,7 +119,6 @@ public class CinderLoESpawnEgg extends Item {
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (!world.isRemote) {
// Perform a ray trace to find the block the player is looking at
MovingObjectPosition target = getMovingObjectPositionFromPlayer(world, player, true);
if (target != null && target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
@ -123,7 +126,6 @@ public class CinderLoESpawnEgg extends Item {
int y = target.blockY;
int z = target.blockZ;
// Adjust the y coordinate to spawn the entity on top of the block clicked
y += 1;
try {

@ -1,57 +0,0 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import lotr.common.LOTRBannerProtection;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.item.LOTRItemSword;
import lotr.common.item.LOTRItemPolearm;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class FirstAgeGlaive extends LOTRItemPolearm {
public FirstAgeGlaive() {
super(CinderLoE.MATERIAL_NEX_ICE);
this.lotrWeaponDamage = 11.5F;
this.setUnlocalizedName("lotr:firstAgeGlaive");
this.setTextureName("lotr:firstAgeGlaive");
this.setCreativeTab(LoECreativeTabs.tabCombatLoE);
LOTRWeaponStats.registerMeleeReach(FirstAgeGlaive.class, 1.8F);
LOTRWeaponStats.registerMeleeSpeed(FirstAgeGlaive.class, 1.0F);
}
public boolean getIsRepairable(ItemStack itemstack, ItemStack repairItem) {
return (repairItem.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce));
}
// private void checkIncompatibleModifiers(ItemStack itemstack) {}
public static UUID accessWeaponDamageModifier() {
return null;
}
}

@ -0,0 +1,58 @@
package com.zivilon.cinder_loe.items;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemSword;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class ForgingKit extends Item {
public IIcon[] icons;
public ForgingKit() {
this.setHasSubtypes(true);
setMaxStackSize(64);
this.setMaxDamage(0);
setCreativeTab(LoECreativeTabs.tabMiscLoE);
}
@Override
public IIcon getIconFromDamage(int damage) {
if (damage < 0 || damage >= icons.length) {
damage = 0;
}
return this.icons[damage];
}
@Override
public void registerIcons(IIconRegister iconRegister) {
this.icons = new IIcon[2];
this.icons[0] = iconRegister.registerIcon("lotr:repair_kit");
this.icons[1] = iconRegister.registerIcon("lotr:upgrade_kit");
}
@Override
public String getUnlocalizedName(ItemStack item) {
switch(item.getItemDamage()) {
case 0:
return "item.repair_kit";
case 1:
return "item.upgrade_kit";
default:
return "item.repair_kit";
}
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < icons.length; i++) {
list.add(new ItemStack(item, 1, i));
}
}
}

@ -0,0 +1,40 @@
package com.zivilon.cinder_loe.items;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemArmor;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class LoEArmor extends LOTRItemArmor {
public Item repair_item;
public LoEArmor(LOTRMaterial material, int slotType) {
this(material, slotType, "");
}
public LoEArmor(LOTRMaterial material, int slotType, String s) {
this(material, slotType, s, (Item) null);
}
public LoEArmor(LOTRMaterial material, int slotType, Item item) {
this(material, slotType, "", item);
}
public LoEArmor(LOTRMaterial material, int slotType, Block block) {
this(material, slotType, "", block);
}
public LoEArmor(LOTRMaterial material, int slotType, String s, Block block) {
this(material, slotType, s, Item.getItemFromBlock(block));
}
public LoEArmor(LOTRMaterial material, int slotType, String s, Item item) {
super(material, slotType, s);
repair_item = item;
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
@Override
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
if (repair_material.getItem() == repair_item)
return true;
return false;
}
}

@ -0,0 +1,43 @@
package com.zivilon.cinder_loe.items;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemBow;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class LoEBow extends LOTRItemBow {
public Item repair_item;
public LoEBow(LOTRMaterial material) {
this(material, (Item) null, 1.0D);
}
public LoEBow(LOTRMaterial material, Block repair_block) {
this(material, Item.getItemFromBlock(repair_block), 1.0D);
}
public LoEBow(LOTRMaterial material, Block repair_block, double damage) {
this(material, Item.getItemFromBlock(repair_block), damage);
}
public LoEBow(LOTRMaterial material, double damage, Block repair_block) {
this(material, Item.getItemFromBlock(repair_block), damage);
}
public LoEBow(LOTRMaterial material, double damage) {
this(material, (Item) null, damage);
}
public LoEBow(LOTRMaterial material, double damage, Item item) {
this(material, item, damage);
}
public LoEBow(LOTRMaterial material, Item item, double damage) {
super(material, damage);
repair_item = item;
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
@Override
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
if (repair_material.getItem() == repair_item)
return true;
return false;
}
}

@ -0,0 +1,31 @@
package com.zivilon.cinder_loe.items;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemHammer;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class LoEHammer extends LOTRItemHammer {
public Item repair_item;
public LoEHammer(LOTRMaterial material) {
this(material, (Item) null);
}
public LoEHammer(LOTRMaterial material, Block repair_block) {
this(material, Item.getItemFromBlock(repair_block));
}
public LoEHammer(LOTRMaterial material, Item item) {
super(material);
repair_item = item;
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
@Override
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
if (repair_material.getItem() == repair_item)
return true;
return false;
}
}

@ -0,0 +1,69 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.LoECreativeTabs;
import lotr.common.item.LOTRItemMug;
import lotr.common.item.LOTRItemMug.Vessel;
import lotr.client.render.LOTRDrinkIcons;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LoEItemMug extends LOTRItemMug {
@SideOnly(Side.CLIENT)
public IIcon[] drinkIcons;
@SideOnly(Side.CLIENT)
public IIcon liquidIcon;
public LoEItemMug(boolean full, boolean food) {
super(full, food, false, 0.0F);
}
public LoEItemMug(float alc) {
this(true, false, true, alc);
}
public LoEItemMug(boolean full, boolean food, boolean brew, float alc) {
super(full, food, brew, alc);
setCreativeTab(LoECreativeTabs.tabFoodLoE);
}
public void setTextureNameFromUnlocalizedName() {
String textureName = getUnlocalizedName().substring("item.".length()); // Strip the "item." prefix
this.setTextureName(textureName);
}
public void registerIcons(IIconRegister iconregister) {
if (this.isFullMug) {
this.drinkIcons = new IIcon[(Vessel.values()).length];
for (int i = 0; i < (Vessel.values()).length; i++) {
this.drinkIcons[i] = LOTRDrinkIcons.registerDrinkIcon(iconregister, this, getIconString(), (Vessel.values()[i]).name);
}
this.liquidIcon = LOTRDrinkIcons.registerLiquidIcon(iconregister, this, getIconString());
barrelGui_emptyBucketSlotIcon = iconregister.registerIcon("lotr:barrel_emptyBucketSlot");
barrelGui_emptyMugSlotIcon = iconregister.registerIcon("lotr:barrel_emptyMugSlot");
} else {
super.registerIcons(iconregister);
}
}
public IIcon getIconFromDamage(int i) {
if (this.isFullMug) {
if (i == -1)
return this.liquidIcon;
int vessel = (getVessel(i)).id;
return this.drinkIcons[vessel];
}
return super.getIconFromDamage(i);
}
public static Vessel getVessel(int damage) {
int i = damage / vesselMeta;
return Vessel.forMeta(i);
}
}

@ -0,0 +1,31 @@
package com.zivilon.cinder_loe.items;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemSpear;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class LoESpear extends LOTRItemSpear {
public Item repair_item;
public LoESpear(LOTRMaterial material) {
this(material, (Item) null);
}
public LoESpear(LOTRMaterial material, Block repair_block) {
this(material, Item.getItemFromBlock(repair_block));
}
public LoESpear(LOTRMaterial material, Item item) {
super(material);
repair_item = item;
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
@Override
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
if (repair_material.getItem() == repair_item)
return true;
return false;
}
}

@ -0,0 +1,36 @@
package com.zivilon.cinder_loe.items;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemSword;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class LoESword extends LOTRItemSword {
public Item repair_item;
public LoESword(LOTRMaterial material) {
this(material, (Item) null);
}
public LoESword(LOTRMaterial material, Block repair_block) {
this(material, Item.getItemFromBlock(repair_block));
}
public LoESword(LOTRMaterial material, Item item) {
super(material);
repair_item = item;
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
public LoESword setWeaponDamage(float damage) {
this.lotrWeaponDamage = damage;
return this;
}
@Override
public boolean getIsRepairable(ItemStack item, ItemStack repair_material) {
if (repair_material.getItem() == repair_item)
return true;
return false;
}
}

@ -11,11 +11,11 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import com.zivilon.cinder_loe.util.BlockPos;
import com.zivilon.cinder_loe.entity.npc.FangornBear;
import com.zivilon.cinder_loe.entity.npc.FangornWildBoar;
import com.zivilon.cinder_loe.entity.npc.FangornAuroch;
import com.zivilon.cinder_loe.entity.npc.FangornElk;
import com.zivilon.cinder_loe.entity.npc.FangornAnimal;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornBear;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornWildBoar;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornAuroch;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornElk;
import com.zivilon.cinder_loe.entity.npc.radagast.FangornAnimal;
import java.util.Random;

@ -1,17 +0,0 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.item.Item;
public class ToxicCore extends Item {
public ToxicCore() {
this.setUnlocalizedName("lotr:toxicCore");
this.setTextureName("lotr:toxic_core");
setCreativeTab(LoECreativeTabs.tabMiscLoE);
this.setMaxDamage(100);
this.setNoRepair();
this.setMaxStackSize(1);
}
}

@ -1,8 +1,8 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.entity.projectile.EntityWarDart;
import com.zivilon.cinder_loe.LoECreativeTabs;
import lotr.common.dispenser.LOTRDispenseThrowingAxe;
import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
@ -62,7 +62,7 @@ public class WarDart extends Item {
@Override
public void registerIcons(IIconRegister iconRegister) {
this.icons = new IIcon[14];
this.icons = new IIcon[15];
this.icons[0] = iconRegister.registerIcon("lotr:war_dart_headless");
this.icons[1] = iconRegister.registerIcon("lotr:war_dart_copper");
this.icons[2] = iconRegister.registerIcon("lotr:war_dart_bronze");
@ -77,6 +77,7 @@ public class WarDart extends Item {
this.icons[11] = iconRegister.registerIcon("lotr:war_dart_red_dwarven");
this.icons[12] = iconRegister.registerIcon("lotr:war_dart_mithril");
this.icons[13] = iconRegister.registerIcon("lotr:war_dart_ancient");
this.icons[14] = iconRegister.registerIcon("lotr:war_dart_morgul");
}
public static String getDartMaterial(ItemStack item) {
@ -107,6 +108,8 @@ public class WarDart extends Item {
return "mithril";
case 13:
return "ancient";
case 14:
return "morgul";
default:
return "headless";
}
@ -122,22 +125,23 @@ public class WarDart extends Item {
return damage;
}
public static int getDamageFromMeta(int meta) {
public static double getDamageFromMeta(int meta) {
switch(meta) {
case 1: return 3; // Copper
case 2: return 3; // Bronze
case 3: return 4; // Iron
case 4: return 5; // Orc
case 5: return 6; // Dwarven
case 6: return 6; // Uruk
case 7: return 6; // Blue Dwarven
case 8: return 6; // Black Uruk
case 9: return 6; // Elven
case 10: return 5; // Gilded Iron
case 11: return 6; // Red Dwarven
case 12: return 10; // Mithril
case 13: return 12; // Ancient
default: return 0;
case 1: return 5.5D; // Copper
case 2: return 5.5D; // Bronze
case 3: return 6.0D; // Iron
case 4: return 6.5D; // Orc
case 5: return 7.0D; // Dwarven
case 6: return 7.0D; // Uruk
case 7: return 7.0D; // Blue Dwarven
case 8: return 7.0D; // Black Uruk
case 9: return 7.0D; // Elven
case 10: return 6.5D; // Gilded Iron
case 11: return 7.0D; // Red Dwarven
case 12: return 9.0D; // Mithril
case 13: return 12.0D; // Ancient
case 14: return 6.5D; // Morgul
default: return 0.0D;
}
}

@ -12,7 +12,7 @@ import net.minecraft.util.IIcon;
import java.util.List;
public class WarDartHeads extends Item {
private IIcon[] icons;
public IIcon[] icons;
public WarDartHeads() {
super();
@ -22,10 +22,13 @@ public class WarDartHeads extends Item {
@Override
public void registerIcons(IIconRegister iconRegister) {
icons = new IIcon[6];
for (int i = 0; i < icons.length; i++) {
icons = new IIcon[12];
for (int i = 0; i < 6; i++) {
icons[i] = iconRegister.registerIcon("lotr:war_dart_heads_" + i);
}
for (int i = 0; i < 6; i++) {
icons[i + 6] = iconRegister.registerIcon("lotr:war_dart_heads_" + i + "_morgul");
}
}
@Override
@ -50,7 +53,8 @@ public class WarDartHeads extends Item {
case 10: return 0xFFFFB0; // Gilded Iron
case 11: return 0xFFC48B; // Red dwarven
case 12: return 0xAFB3D3; // Mithril
case 13: return 0x033346; // Ancient
case 13: return 0x335753; // Ancient
case 14: return 16777215; // Morgul
default: return 0xFFFFFF; // Blank
}
}
@ -63,16 +67,22 @@ public class WarDartHeads extends Item {
@Override
public IIcon getIcon(ItemStack stack, int renderPass) {
int count = stack.stackSize;
int dmg = stack.getItemDamage();
if (count > 5 || count < 1) {
if (dmg == 14)
return icons[6];
return icons[0];
} else {
if (dmg == 14)
return icons[count + 6];
return icons[count];
}
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 1; i < 14; i++) {
for (int i = 1; i < 15; i++) {
list.add(new ItemStack(item, 1, i));
}
}

@ -0,0 +1,82 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.entity.npc.LOTRHiredNPCInfo;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class unitLevelTool extends Item {
public unitLevelTool() {
setCreativeTab(LoECreativeTabs.tabMiscLoE);
}
public EnumAction getItemUseAction(ItemStack itemstack) {
return EnumAction.bow;
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
List<LOTREntityNPC> hiredNPCs = this.findHiredNPCsNearPlayer(player);
if (!hiredNPCs.isEmpty()) {
for (LOTREntityNPC hiredNPC : hiredNPCs) {
if (hiredNPC != null && hiredNPC.hiredNPCInfo != null) {
try {
LOTRHiredNPCInfo npcInfo = hiredNPC.hiredNPCInfo;
Method addExperienceMethod = LOTRHiredNPCInfo.class.getDeclaredMethod("addExperience", int.class);
addExperienceMethod.setAccessible(true);
int xpToAdd = 1;
try {
xpToAdd = Integer.parseInt(itemStack.getDisplayName());
} catch (NumberFormatException e) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Tool name wasnt a number, applying 1 Xp instead"));
continue;
}
addExperienceMethod.invoke(npcInfo, xpToAdd);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
return itemStack;
}
private List<LOTREntityNPC> findHiredNPCsNearPlayer(EntityPlayer player) {
// Logic to find all nearby hired NPCs within a certain range
double range = 20.0D; // Set the range within which the NPCs should be found
List<LOTREntityNPC> nearbyHiredNPCs = new ArrayList<>();
for (Object entity : player.worldObj.getEntitiesWithinAABB(LOTREntityNPC.class, player.boundingBox.expand(range, range, range))) {
LOTREntityNPC npc = (LOTREntityNPC) entity;
// Check if the player has sufficient permission level (admin tool usage)
if (npc.hiredNPCInfo.getHiringPlayerUUID() != null && player.canCommandSenderUseCommand(2, "")) {
nearbyHiredNPCs.add(npc);
}
}
return nearbyHiredNPCs;
}
}

@ -0,0 +1,27 @@
package com.zivilon.cinder_loe.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
@Mixin(EnchantmentHelper.class)
public class MixinEnchantmentHelper {
/**
* @author Shinare
* @reason Having full knockbackResistance attribute now negates bonus knockback as well
*/
@Overwrite
public static int getKnockbackModifier(EntityLivingBase attacker, EntityLivingBase target) {
int vanilla_ench_level = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, attacker.getHeldItem());
int base_extra_knockback = LOTRWeaponStats.getBaseExtraKnockback(attacker.getHeldItem());
int modifier_extra_knockback = LOTREnchantmentHelper.calcExtraKnockback(attacker.getHeldItem());
if (target.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue() == 1.0D) return 0;
return vanilla_ench_level + base_extra_knockback + modifier_extra_knockback;
}
}

@ -0,0 +1,12 @@
package com.zivilon.cinder_loe.mixins;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(Entity.class)
public interface MixinEntity {
@Accessor("invulnerable")
void setInvulnerable(boolean invulnerable);
}

@ -0,0 +1,305 @@
package com.zivilon.cinder_loe.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Overwrite;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.AxisAlignedBB;
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 net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import java.util.List;
import net.minecraft.entity.monster.EntityEnderman;
@Mixin(EntityArrow.class)
public abstract class MixinEntityArrow extends Entity {
public MixinEntityArrow(World world) {
super(world);
}
@Shadow
public abstract void setIsCritical(boolean p_70243_1_);
@Shadow
public abstract boolean getIsCritical();
@Shadow
private Block field_145790_g;
@Shadow
private int field_145791_d;
@Shadow
private int field_145792_e;
@Shadow
private int field_145789_f;
@Shadow
private boolean inGround;
@Shadow
public int arrowShake;
@Shadow
private int inData;
@Shadow
private int ticksInGround;
@Shadow
private int ticksInAir;
@Shadow
public Entity shootingEntity;
@Shadow
private int knockbackStrength;
@Shadow
private double damage;
/**
* @author Shinare
* @reason Having full knockbackResistance attribute now negates bonus knockback as well
*/
@Overwrite
public void onUpdate() {
super.onUpdate();
EntityArrow arrow = (EntityArrow)(Object)this;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
}
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (block.getMaterial() != Material.air) {
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
this.inGround = true;
}
}
if (this.arrowShake > 0) {
--this.arrowShake;
}
if (this.inGround) {
int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (block == this.field_145790_g && j == this.inData) {
++this.ticksInGround;
if (this.ticksInGround == 1200) {
this.setDead();
}
} else {
this.inGround = false;
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
this.ticksInGround = 0;
this.ticksInAir = 0;
}
} else {
++this.ticksInAir;
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
for (i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity)list.get(i);
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
if (movingobjectposition1 != null) {
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) {
movingobjectposition = null;
}
}
float f2;
float f4;
if (movingobjectposition != null) {
if (movingobjectposition.entityHit != null) {
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
int k = MathHelper.ceiling_double_int((double)f2 * this.damage);
if (this.getIsCritical()) {
k += this.rand.nextInt(k / 2 + 2);
}
DamageSource damagesource = null;
if (this.shootingEntity == null) {
damagesource = DamageSource.causeArrowDamage(arrow, this);
} else {
damagesource = DamageSource.causeArrowDamage(arrow, this.shootingEntity);
}
if (arrow.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) {
movingobjectposition.entityHit.setFire(5);
}
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k)) {
if (movingobjectposition.entityHit instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
if (!this.worldObj.isRemote) {
entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);
}
double knockback_resistance = entitylivingbase.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
if (this.knockbackStrength > 0 && knockback_resistance < 1.0D) {
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f4 > 0.0F) {
entitylivingbase.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4);
}
}
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) {
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
}
if (this.shootingEntity != null && entitylivingbase != this.shootingEntity && entitylivingbase instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) {
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
}
}
arrow.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
if (!(movingobjectposition.entityHit instanceof EntityEnderman)) {
arrow.setDead();
}
} else {
this.motionX *= -0.10000000149011612D;
this.motionY *= -0.10000000149011612D;
this.motionZ *= -0.10000000149011612D;
this.rotationYaw += 180.0F;
this.prevRotationYaw += 180.0F;
this.ticksInAir = 0;
}
} else {
this.field_145791_d = movingobjectposition.blockX;
this.field_145792_e = movingobjectposition.blockY;
this.field_145789_f = movingobjectposition.blockZ;
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.inData = arrow.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));
this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));
this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;
this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;
this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.arrowShake = 7;
this.setIsCritical(false);
if (this.field_145790_g.getMaterial() != Material.air) {
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
}
}
}
if (arrow.getIsCritical()) {
for (i = 0; i < 4; ++i) {
arrow.worldObj.spawnParticle("crit", arrow.posX + arrow.motionX * (double)i / 4.0D, arrow.posY + arrow.motionY * (double)i / 4.0D, arrow.posZ + arrow.motionZ * (double)i / 4.0D, -arrow.motionX, -arrow.motionY + 0.2D, -arrow.motionZ);
}
}
arrow.posX += arrow.motionX;
arrow.posY += arrow.motionY;
arrow.posZ += arrow.motionZ;
f2 = MathHelper.sqrt_double(arrow.motionX * arrow.motionX + arrow.motionZ * arrow.motionZ);
arrow.rotationYaw = (float)(Math.atan2(arrow.motionX, arrow.motionZ) * 180.0D / Math.PI);
for (arrow.rotationPitch = (float)(Math.atan2(arrow.motionY, (double)f2) * 180.0D / Math.PI); arrow.rotationPitch - arrow.prevRotationPitch < -180.0F; arrow.prevRotationPitch -= 360.0F) {
;
}
while (arrow.rotationPitch - arrow.prevRotationPitch >= 180.0F) {
arrow.prevRotationPitch += 360.0F;
}
while (arrow.rotationYaw - arrow.prevRotationYaw < -180.0F) {
arrow.prevRotationYaw -= 360.0F;
}
while (arrow.rotationYaw - arrow.prevRotationYaw >= 180.0F) {
arrow.prevRotationYaw += 360.0F;
}
arrow.rotationPitch = arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * 0.2F;
arrow.rotationYaw = arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * 0.2F;
float f3 = 0.99F;
f1 = 0.05F;
if (arrow.isInWater()) {
for (int l = 0; l < 4; ++l) {
f4 = 0.25F;
arrow.worldObj.spawnParticle("bubble", arrow.posX - arrow.motionX * (double)f4, arrow.posY - arrow.motionY * (double)f4, arrow.posZ - arrow.motionZ * (double)f4, arrow.motionX, arrow.motionY, arrow.motionZ);
}
f3 = 0.8F;
}
if (arrow.isWet()) {
arrow.extinguish();
}
arrow.motionX *= (double)f3;
arrow.motionY *= (double)f3;
arrow.motionZ *= (double)f3;
arrow.motionY -= (double)f1;
arrow.setPosition(arrow.posX, arrow.posY, arrow.posZ);
this.func_145775_I();
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save