2
0
Fork 0

Frozen Dungeon updates

frozen
Shinare 1 year ago
parent 0973a7c328
commit 3f4ddeadc1

@ -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.

@ -5,18 +5,18 @@ import com.zivilon.cinder_loe.character.CharacterEventListener;
import com.zivilon.cinder_loe.character.CharacterRoleAPI;
import com.zivilon.cinder_loe.client.render.*;
import com.zivilon.cinder_loe.client.render.block.*;
import com.zivilon.cinder_loe.client.render.projectile.*;
import com.zivilon.cinder_loe.client.render.corrupt.*;
import com.zivilon.cinder_loe.client.render.projectile.*;
import com.zivilon.cinder_loe.client.render.tileentity.*;
import com.zivilon.cinder_loe.command.CommandCinderCharacter;
import com.zivilon.cinder_loe.entity.*;
import com.zivilon.cinder_loe.entity.projectile.*;
import com.zivilon.cinder_loe.entity.corrupt.*;
import com.zivilon.cinder_loe.entity.effect.*;
import com.zivilon.cinder_loe.entity.npc.*;
import com.zivilon.cinder_loe.entity.trader.BladorthinSmith;
import com.zivilon.cinder_loe.entity.trader.LimwaithFishmonger;
import com.zivilon.cinder_loe.entity.trader.LimwaithShaman;
import com.zivilon.cinder_loe.entity.trader.RedDwarfSmith;
import com.zivilon.cinder_loe.entity.projectile.*;
import com.zivilon.cinder_loe.entity.trader.*;
import com.zivilon.cinder_loe.items.*;
import com.zivilon.cinder_loe.potion.LoEPotions;
import com.zivilon.cinder_loe.tileentity.*;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cindercore.CinderCore;
@ -40,6 +40,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -67,6 +68,7 @@ import lotr.common.world.spawning.LOTRSpawnList;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.entity.RenderLightningBolt;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.init.Blocks;
@ -114,6 +116,8 @@ public class CinderLoE {
public static LOTRMaterial MATERIAL_NEX_FIRE;
public static LOTRMaterial MATERIAL_NEX_TOXIN;
public static LOTRMaterial MATERIAL_NEX_SHADOW;
public static LOTRMaterial MATERIAL_NIMVEIL;
public static LOTRMaterial MATERIAL_FROZEN;
// Blocks
@ -143,7 +147,7 @@ public class CinderLoE {
public static Block entityBarrier;
public static Block iceCage;
public static Block enchantedIce;
public static Block nexIceCrystal;
public static Block forgingStation;
//public static Block verticalWeaponRack;
@ -160,6 +164,7 @@ public class CinderLoE {
public static Item spice;
public static Item spicedHam;
public static Item lightStew;
public static Item chocolatebar;
public static Item fruitsalad;
public static Item flour;
@ -206,10 +211,19 @@ public class CinderLoE {
public static Item bodyNexShadow;
public static Item legsNexShadow;
public static Item bootsNexShadow;
public static Item firstAgeGlaive;
public static Item celeiniss;
public static Item nimveil;
public static Item nimveilPart;
public static Item blessedHammer;
public static Item toxicCore;
public static Item iceThawer;
public static Item demonbloodVial;
public static Item mugDemonicHealthPotion;
public static Item deceiverBlade;
public static Item anaroreBow;
public static Item trollChieftainClub;
public static Item glaechirSpear;
public static Item weaponPart;
// Misc
@ -308,16 +322,18 @@ public class CinderLoE {
public static LOTRSpawnList LIMWAITH;
public static LOTRSpawnList Rhudaur;
private static CinderEventHandler modEventHandler;
public static CinderEventHandler modEventHandler;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
CinderLoE_Config.init(event);
Materials.registerMaterials();
registerBlocks();
registerItems();
ItemRegistration.registerItems();
registerBlocks();
registerEntities();
modEventHandler = new CinderEventHandler();
LoEPotions.registerPotions();
}
@Mod.EventHandler
@ -347,8 +363,8 @@ public class CinderLoE {
recipes.registerRecipes(); // Register recipes at com.zivilon.cinder_loe.recipes.java
setupTradeEntries();
LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F);
LOTRWeaponStats.registerMeleeReach(FirstAgeGlaive.class, 1.8F);
LOTRWeaponStats.registerMeleeSpeed(FirstAgeGlaive.class, 1.0F);
LOTRWeaponStats.registerMeleeReach(Celeiniss.class, 1.8F);
LOTRWeaponStats.registerMeleeSpeed(Celeiniss.class, 1.0F);
LoECreativeTabs.setupIcons();
}
@ -359,8 +375,10 @@ public class CinderLoE {
event.registerServerCommand(new CommandCinderCharacter());
}
public void registerEntities() { // Last ID added: 49
public void registerEntities() { // Last ID added: 51
///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock");
GameRegistry.registerTileEntity(TileEntityShadowTile.class, "TileEntityShadowTile");
GameRegistry.registerTileEntity(TileEntityForgingStation.class, "TileEntityForgingStation");
///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword");
int entityID = 7320; // Always increment entityID by 1 over the last entity to ensure unique IDs
@ -433,6 +451,8 @@ public class CinderLoE {
EntityRegistry.registerModEntity(NexIce.class, "NexIce", (entityID + 47), this, 64, 1, true);
EntityRegistry.registerModEntity(NexFire.class, "NexFire", (entityID + 48), this, 64, 1, true);
EntityRegistry.registerModEntity(NexToxin.class, "NexToxin", (entityID + 49), this, 64, 1, true);
EntityRegistry.registerModEntity(NexCloud.class, "NexCloud", (entityID + 50), this, 64, 1, true);
EntityRegistry.registerModEntity(NimveilLightningBolt.class, "NimveilLightningBolt", (entityID + 51), this, 64, 1, true);
}
public void registerBlocks() {
@ -510,9 +530,8 @@ public class CinderLoE {
GameRegistry.registerBlock(iceCage, "ice_cage");
enchantedIce = (new EnchantedIce());
GameRegistry.registerBlock(enchantedIce, "enchanted_ice");
nexIceCrystal = (new NexIceCrystal());
GameRegistry.registerBlock(nexIceCrystal, "nex_ice_crystal");
GameRegistry.registerTileEntity(TileEntityNexIceCrystal.class, "tileEntityNexIceCrystal");
forgingStation = (new ForgingStation());
GameRegistry.registerBlock(forgingStation, "forging_station");
// Building Blocks
cutDrystone = (new cutDrystone());
@ -579,7 +598,7 @@ public class CinderLoE {
* Item Registation, add up the "last ID added" upon adding a new item
* Weapons will need to be linked
*/
// Last ID added: 117
// Last ID added: 127
// ==Food Items==
ItemRegistration.registerItem(onion, "onion", 58);
@ -622,6 +641,8 @@ public class CinderLoE {
MATERIAL_NEX_FIRE = getLOTRMaterialByName("NEX_FIRE");
MATERIAL_NEX_TOXIN = getLOTRMaterialByName("NEX_TOXIN");
MATERIAL_NEX_SHADOW = getLOTRMaterialByName("NEX_SHADOW");
MATERIAL_NIMVEIL = getLOTRMaterialByName("NIMVEIL");
MATERIAL_FROZEN = getLOTRMaterialByName("FROZEN");
frostblade = (new LOTRItemSword(EVENT)).setUnlocalizedName("lotr:frostblade").setTextureName("lotr:frostblade");
daggervoid = (new VoidDagger(EVENT)).addWeaponDamage(5.0F).setUnlocalizedName("lotr:daggerVoid").setTextureName("lotr:daggerVoid").setCreativeTab(null);
@ -634,45 +655,69 @@ public class CinderLoE {
legsJade = (new LOTRItemArmor(MATERIAL_JADE, 2,"leggings")).setUnlocalizedName("lotr:legsJade").setTextureName("lotr:legsJade").setCreativeTab(null);
bootsJade = (new LOTRItemArmor(MATERIAL_JADE, 3)).setUnlocalizedName("lotr:bootsJade").setTextureName("lotr:bootsJade").setCreativeTab(null);
helmetNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 0)).setUnlocalizedName("lotr:helmetNexIce").setTextureName("lotr:helmetNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bodyNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 1)).setUnlocalizedName("lotr:bodyNexIce").setTextureName("lotr:bodyNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE);
legsNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 2)).setUnlocalizedName("lotr:legsNexIce").setTextureName("lotr:legsNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bootsNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 3)).setUnlocalizedName("lotr:bootsNexIce").setTextureName("lotr:bootsNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE);
helmetNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 0)).setUnlocalizedName("lotr:helmetNexFire").setTextureName("lotr:helmetNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bodyNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 1)).setUnlocalizedName("lotr:bodyNexFire").setTextureName("lotr:bodyNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE);
legsNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 2)).setUnlocalizedName("lotr:legsNexFire").setTextureName("lotr:legsNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bootsNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 3)).setUnlocalizedName("lotr:bootsNexFire").setTextureName("lotr:bootsNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE);
helmetNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 0)).setUnlocalizedName("lotr:helmetNexToxin").setTextureName("lotr:helmetNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bodyNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 1)).setUnlocalizedName("lotr:bodyNexToxin").setTextureName("lotr:bodyNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE);
legsNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 2)).setUnlocalizedName("lotr:legsNexToxin").setTextureName("lotr:legsNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bootsNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 3)).setUnlocalizedName("lotr:bootsNexToxin").setTextureName("lotr:bootsNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE);
helmetNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 0)).setUnlocalizedName("lotr:helmetNexShadow").setTextureName("lotr:helmetNexShadow").setCreativeTab(LoECreativeTabs.tabCombatLoE);
bodyNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 1)).setUnlocalizedName("lotr:bodyNexShadow").setTextureName("lotr:bodyNexShadow").setCreativeTab(LoECreativeTabs.tabCombatLoE);
legsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 2)).setUnlocalizedName("lotr:legsNexShadow").setTextureName("lotr:legsNexShadow").setCreativeTab(null);
bootsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 3)).setUnlocalizedName("lotr:bootsNexShadow").setTextureName("lotr:bootsNexShadow").setCreativeTab(LoECreativeTabs.tabCombatLoE);
firstAgeGlaive = (new FirstAgeGlaive()).setCreativeTab(LoECreativeTabs.tabCombatLoE);
helmetNexIce = (new LoEArmor(MATERIAL_NEX_ICE, 0, enchantedIce)).setUnlocalizedName("lotr:helmetNexIce").setTextureName("lotr:helmetNexIce");
bodyNexIce = (new LoEArmor(MATERIAL_NEX_ICE, 1, enchantedIce)).setUnlocalizedName("lotr:bodyNexIce").setTextureName("lotr:bodyNexIce");
legsNexIce = (new LoEArmor(MATERIAL_NEX_ICE, 2, enchantedIce)).setUnlocalizedName("lotr:legsNexIce").setTextureName("lotr:legsNexIce");
bootsNexIce = (new LoEArmor(MATERIAL_NEX_ICE, 3, enchantedIce)).setUnlocalizedName("lotr:bootsNexIce").setTextureName("lotr:bootsNexIce");
helmetNexFire = (new LoEArmor(MATERIAL_NEX_FIRE, 0, enchantedIce)).setUnlocalizedName("lotr:helmetNexFire").setTextureName("lotr:helmetNexFire");
bodyNexFire = (new LoEArmor(MATERIAL_NEX_FIRE, 1, enchantedIce)).setUnlocalizedName("lotr:bodyNexFire").setTextureName("lotr:bodyNexFire");
legsNexFire = (new LoEArmor(MATERIAL_NEX_FIRE, 2, enchantedIce)).setUnlocalizedName("lotr:legsNexFire").setTextureName("lotr:legsNexFire");
bootsNexFire = (new LoEArmor(MATERIAL_NEX_FIRE, 3, enchantedIce)).setUnlocalizedName("lotr:bootsNexFire").setTextureName("lotr:bootsNexFire");
helmetNexToxin = (new LoEArmor(MATERIAL_NEX_TOXIN, 0, enchantedIce)).setUnlocalizedName("lotr:helmetNexToxin").setTextureName("lotr:helmetNexToxin");
bodyNexToxin = (new LoEArmor(MATERIAL_NEX_TOXIN, 1, enchantedIce)).setUnlocalizedName("lotr:bodyNexToxin").setTextureName("lotr:bodyNexToxin");
legsNexToxin = (new LoEArmor(MATERIAL_NEX_TOXIN, 2, enchantedIce)).setUnlocalizedName("lotr:legsNexToxin").setTextureName("lotr:legsNexToxin");
bootsNexToxin = (new LoEArmor(MATERIAL_NEX_TOXIN, 3, enchantedIce)).setUnlocalizedName("lotr:bootsNexToxin").setTextureName("lotr:bootsNexToxin");
helmetNexShadow = (new LoEArmor(MATERIAL_NEX_SHADOW, 0, enchantedIce)).setUnlocalizedName("lotr:helmetNexShadow").setTextureName("lotr:helmetNexShadow");
bodyNexShadow = (new LoEArmor(MATERIAL_NEX_SHADOW, 1, enchantedIce)).setUnlocalizedName("lotr:bodyNexShadow").setTextureName("lotr:bodyNexShadow");
legsNexShadow = (new LoEArmor(MATERIAL_NEX_SHADOW, 2, enchantedIce)).setUnlocalizedName("lotr:legsNexShadow").setTextureName("lotr:legsNexShadow");
bootsNexShadow = (new LoEArmor(MATERIAL_NEX_SHADOW, 3, enchantedIce)).setUnlocalizedName("lotr:bootsNexShadow").setTextureName("lotr:bootsNexShadow");
celeiniss = (new Celeiniss());
blessedHammer = (new BlessedHammer());
nimveil = (new Nimveil());
nimveilPart = (new NimveilPart());
toxicCore = (new ToxicCore());
linkLOTRWeapon(firstAgeGlaive, "firstAgeGlaive");
ItemRegistration.registerItem(helmetNexIce,"helmetNexIce",99);
ItemRegistration.registerItem(bodyNexIce,"bodyNexIce",100);
ItemRegistration.registerItem(legsNexIce,"legsNexIce",101);
ItemRegistration.registerItem(bootsNexIce,"bootsNexIce",102);
ItemRegistration.registerItem(helmetNexFire,"helmetNexFire",103);
ItemRegistration.registerItem(bodyNexFire,"bodyNexFire",104);
ItemRegistration.registerItem(legsNexFire,"legsNexFire",105);
ItemRegistration.registerItem(bootsNexFire,"bootsNexFire",106);
ItemRegistration.registerItem(helmetNexToxin,"helmetNexToxin",107);
ItemRegistration.registerItem(bodyNexToxin,"bodyNexToxin",108);
ItemRegistration.registerItem(legsNexToxin,"legsNexToxin",109);
ItemRegistration.registerItem(bootsNexToxin,"bootsNexToxin",110);
ItemRegistration.registerItem(helmetNexShadow,"helmetNexShadow",111);
ItemRegistration.registerItem(bodyNexShadow,"bodyNexShadow",112);
ItemRegistration.registerItem(legsNexShadow,"legsNexShadow",113);
ItemRegistration.registerItem(bootsNexShadow,"bootsNexShadow",114);
ItemRegistration.registerItem(firstAgeGlaive, "firstAgeGlaive",115);
ItemRegistration.registerItem(toxicCore,"toxicCore",116);
iceThawer = (new IceThawer());
demonbloodVial = (new Item()).setUnlocalizedName("lotr:demonbloodVial").setCreativeTab(LoECreativeTabs.tabMiscLoE).setTextureName("lotr:demonbloodVial");
mugDemonicHealthPotion = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.field_76434_w.id, 28800).setUnlocalizedName("lotr:mugDemonicHealthPotion");
((LoEItemMug)mugDemonicHealthPotion).setTextureNameFromUnlocalizedName();
deceiverBlade = (new LoESword(LOTRMaterial.MORGUL, enchantedIce).setWeaponDamage(8.0F)).setUnlocalizedName("deceiver_blade").setTextureName("lotr:deceiver_blade").setMaxDamage(1000);
anaroreBow = (new LoEBow(MATERIAL_FROZEN, enchantedIce, 2.0D).setDrawTime(16)).setUnlocalizedName("anarore_bow").setTextureName("lotr:anarore_bow").setMaxDamage(1000);
trollChieftainClub = (new LoEHammer(MATERIAL_FROZEN, enchantedIce)).setUnlocalizedName("troll_chieftain_club").setTextureName("lotr:troll_chieftain_club").setMaxDamage(1000);
glaechirSpear = (new LoESpear(MATERIAL_FROZEN, enchantedIce)).setUnlocalizedName("glaechir_spear").setTextureName("lotr:glaechir_spear").setMaxDamage(1000);
weaponPart = (new WeaponPart());
linkLOTRWeapon(celeiniss, "celeiniss");
linkLOTRWeapon(nimveil, "nimveil");
ItemRegistration.register(helmetNexIce,"helmetNexIce",7200);
ItemRegistration.register(bodyNexIce,"bodyNexIce",7201);
ItemRegistration.register(legsNexIce,"legsNexIce",7202);
ItemRegistration.register(bootsNexIce,"bootsNexIce",7203);
ItemRegistration.register(helmetNexFire,"helmetNexFire",7204);
ItemRegistration.register(bodyNexFire,"bodyNexFire",7205);
ItemRegistration.register(legsNexFire,"legsNexFire",7206);
ItemRegistration.register(bootsNexFire,"bootsNexFire",7207);
ItemRegistration.register(helmetNexToxin,"helmetNexToxin",7208);
ItemRegistration.register(bodyNexToxin,"bodyNexToxin",7209);
ItemRegistration.register(legsNexToxin,"legsNexToxin",7210);
ItemRegistration.register(bootsNexToxin,"bootsNexToxin",7211);
ItemRegistration.register(helmetNexShadow,"helmetNexShadow",7212);
ItemRegistration.register(bodyNexShadow,"bodyNexShadow",7213);
ItemRegistration.register(legsNexShadow,"legsNexShadow",7214);
ItemRegistration.register(bootsNexShadow,"bootsNexShadow",7215);
ItemRegistration.register(celeiniss, "celeiniss",7220);
ItemRegistration.register(nimveil, "nimveil",7221);
ItemRegistration.register(nimveilPart, "nimveilPart",7222);
ItemRegistration.register(blessedHammer, "blessedHammer",7223);
ItemRegistration.register(deceiverBlade, "deceiverBlade",7224);
ItemRegistration.register(anaroreBow, "anaroreBow",7225);
ItemRegistration.register(trollChieftainClub, "trollChieftainClub",7226);
ItemRegistration.register(glaechirSpear, "glaechirSpear",7227);
ItemRegistration.register(weaponPart, "weaponPart", 7228);
ItemRegistration.register(toxicCore,"toxicCore",7229);
ItemRegistration.register(iceThawer, "iceThawer",7230);
ItemRegistration.register(demonbloodVial, "demonbloodVial",7231);
ItemRegistration.register(mugDemonicHealthPotion, "mugDemonicHealthPotion",7232);
ItemRegistration.registerItem(frostblade, "frostblade", 4);
ItemRegistration.registerItem(daggervoid, "daggerVoid", 65);
@ -963,10 +1008,9 @@ public class CinderLoE {
// RenderingRegistry.registerEntityRenderingHandler(HaradLevy.class, new LOTRRenderNearHaradrim());
// RenderingRegistry.registerEntityRenderingHandler(DwarfLevy.class, new LOTRRenderDwarf());
RenderingRegistry.registerBlockHandler(new RenderIceCage());
RenderingRegistry.registerBlockHandler(new RenderNexIceCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNexIceCrystal.class, new RenderNexIceCrystal());
RenderingRegistry.registerEntityRenderingHandler(EntityWarDart.class, new RenderWarDart());
RenderingRegistry.registerEntityRenderingHandler(NimveilLightningBolt.class, new RenderNimveilBolt());
RenderingRegistry.registerEntityRenderingHandler(BladorthinSmith.class, new LOTRRenderDorwinionElfVintner());
RenderingRegistry.registerEntityRenderingHandler(DarkSpider.class, new RenderDarkSpider());
RenderingRegistry.registerEntityRenderingHandler(CorruptDwarf.class, new RenderCorruptDwarf());
@ -1022,7 +1066,9 @@ public class CinderLoE {
RenderingRegistry.registerEntityRenderingHandler(NexIce.class, new RenderNexMiniboss());
RenderingRegistry.registerEntityRenderingHandler(NexFire.class, new RenderNexMiniboss());
RenderingRegistry.registerEntityRenderingHandler(NexToxin.class, new RenderNexMiniboss());
RenderingRegistry.registerEntityRenderingHandler(NexCloud.class, new RenderNexCloud());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMistBlock.class, (TileEntitySpecialRenderer)new LOTRRenderUtumnoPortal());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForgingStation.class, (TileEntitySpecialRenderer)new TileEntityForgingStationRenderer());
}
}

@ -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);
}
}

@ -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,16 @@ 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);
modifyMaterial("NEX_ICE",1500, 0.0F, 0.8F, 0, 9.0F, 10, Item.getItemFromBlock(CinderLoE.enchantedIce));
modifyMaterial("NEX_FIRE",1500, 0.0F, 0.8F, 0, 9.0F, 10, Item.getItemFromBlock(CinderLoE.enchantedIce));
modifyMaterial("NEX_TOXIN",1500, 0.0F, 0.8F, 0, 9.0F, 10, Item.getItemFromBlock(CinderLoE.enchantedIce));
modifyMaterial("NEX_SHADOW",1500, 0.0F, 0.8F, 0, 9.0F, 10, Item.getItemFromBlock(CinderLoE.enchantedIce));
modifyMaterial("NIMVEIL",300, 6.0F, 0.0F, 0, 0.0F, 10, Item.getItemFromBlock(CinderLoE.enchantedIce));
modifyMaterial("FROZEN",1000, 5.0F, 0.0F, 0, 0.0F, 10, Item.getItemFromBlock(CinderLoE.enchantedIce));
}
public static void modifyMaterial(String fieldName, int uses, float weapon_damage, float protection, int harvest_level, float speed, int enchantability, Item crafting_item) {

@ -0,0 +1,279 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.items.NimveilPart;
import com.zivilon.cinder_loe.items.Nimveil;
import com.zivilon.cinder_loe.recipe.ForgingRecipe;
import com.zivilon.cinder_loe.recipe.ForgingRecipes;
import com.zivilon.cinder_loe.tileentity.TileEntityForgingStation;
import lotr.common.item.LOTRItemHammer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ForgingStation extends BlockContainer {
public ForgingStation() {
super(Material.anvil);
setHardness(10.0F);
setResistance(10.0F);
setBlockName("forging_station");
setCreativeTab(LoECreativeTabs.tabDecoLoE);
setBlockBounds(0, 0, 0, 1, 1, 1); // Set the block bounds to cover 1x1x1 for each individual part
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return -1; // Use custom renderer
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityForgingStation();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) {
int direction = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
// Middle part (placed block)
world.setBlockMetadataWithNotify(x, y, z, (direction << 2) | 1, 2);
// Right and right parts based on orientation
if (direction == 0) { // South
world.setBlock(x - 1, y, z, this, (direction << 2) | 0, 2); // Right part
world.setBlock(x + 1, y, z, this, (direction << 2) | 2, 2); // Left part
} else if (direction == 1) { // West
world.setBlock(x, y, z - 1, this, (direction << 2) | 0, 2); // Right part
world.setBlock(x, y, z + 1, this, (direction << 2) | 2, 2); // Left part
} else if (direction == 2) { // North
world.setBlock(x + 1, y, z, this, (direction << 2) | 0, 2); // Right part
world.setBlock(x - 1, y, z, this, (direction << 2) | 2, 2); // Left part
} else if (direction == 3) { // East
world.setBlock(x, y, z + 1, this, (direction << 2) | 0, 2); // Right part
world.setBlock(x, y, z - 1, this, (direction << 2) | 2, 2); // Left part
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
int direction = meta >> 2;
int part = meta & 3;
if (direction == 0) { // South
if (part == 1) { // Middle
world.setBlockToAir(x - 1, y, z); // Right part
world.setBlockToAir(x + 1, y, z); // Left part
} else if (part == 0) { // Right
world.setBlockToAir(x + 1, y, z); // Middle part
world.setBlockToAir(x + 2, y, z); // Left part
} else if (part == 2) { // Left
world.setBlockToAir(x - 1, y, z); // Middle part
world.setBlockToAir(x - 2, y, z); // Right part
}
} else if (direction == 1) { // West
if (part == 1) { // Middle
world.setBlockToAir(x, y, z - 1); // Right part
world.setBlockToAir(x, y, z + 1); // Left part
} else if (part == 0) { // Right
world.setBlockToAir(x, y, z + 1); // Middle part
world.setBlockToAir(x, y, z + 2); // Left part
} else if (part == 2) { // Left
world.setBlockToAir(x, y, z - 1); // Middle part
world.setBlockToAir(x, y, z - 2); // Right part
}
} else if (direction == 2) { // North
if (part == 1) { // Middle
world.setBlockToAir(x + 1, y, z); // Right part
world.setBlockToAir(x - 1, y, z); // Left part
} else if (part == 0) { // Right
world.setBlockToAir(x - 1, y, z); // Middle part
world.setBlockToAir(x - 2, y, z); // Left part
} else if (part == 2) { // Left
world.setBlockToAir(x + 1, y, z); // Middle part
world.setBlockToAir(x + 2, y, z); // Right part
}
} else if (direction == 3) { // East
if (part == 1) { // Middle
world.setBlockToAir(x, y, z + 1); // Right part
world.setBlockToAir(x, y, z - 1); // Left part
} else if (part == 0) { // Right
world.setBlockToAir(x, y, z - 1); // Middle part
world.setBlockToAir(x, y, z - 2); // Left part
} else if (part == 2) { // Left
world.setBlockToAir(x, y, z + 1); // Middle part
world.setBlockToAir(x, y, z + 2); // Right part
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public TileEntityForgingStation getCentralTileEntity(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
int direction = meta >> 2; // Extract the direction
int part = meta & 3; // Extract the part (0, 1, 2)
int centralX = x, centralZ = z;
switch (direction) {
case 0: // South
if (part == 0) {
centralX = x + 1; // Right part, middle is to the left
} else if (part == 2) {
centralX = x - 1; // Left part, middle is to the right
}
break;
case 1: // West
if (part == 0) {
centralZ = z + 1; // Right part, middle is to the front
} else if (part == 2) {
centralZ = z - 1; // Left part, middle is to the back
}
break;
case 2: // North
if (part == 0) {
centralX = x - 1; // Right part, middle is to the right
} else if (part == 2) {
centralX = x + 1; // Left part, middle is to the left
}
break;
case 3: // East
if (part == 0) {
centralZ = z - 1; // Right part, middle is to the back
} else if (part == 2) {
centralZ = z + 1; // Left part, middle is to the front
}
break;
}
TileEntity tileEntity = world.getTileEntity(centralX, y, centralZ);
return (tileEntity instanceof TileEntityForgingStation) ? (TileEntityForgingStation) tileEntity : null;
}
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
ItemStack heldStack = player.getHeldItem();
if (heldStack == null) return;
boolean isBlessedHammer = heldStack.getItem() == CinderLoE.blessedHammer;
boolean isRegularHammer = heldStack.getItem() instanceof LOTRItemHammer;
if (!isBlessedHammer && !isRegularHammer) return;
TileEntityForgingStation tileentity = getCentralTileEntity(world, x, y, z);
if (tileentity == null) return;
ItemStack left = tileentity.getLeftItem();
ItemStack middle = tileentity.getMiddleItem();
ItemStack right = tileentity.getRightItem();
// Iterate through available recipes and find a match
for (ForgingRecipe recipe : ForgingRecipes.getAllRecipes()) {
if (recipe.matches(left, middle, right, isBlessedHammer)) {
// Clear the inputs if the recipe matches
tileentity.setLeftItem(null);
tileentity.setRightItem(null);
tileentity.setMiddleItem(recipe.getOutput());
// Damage the hammer by 1
if (heldStack.attemptDamageItem(1, player.getRNG())) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} else {
player.inventory.markDirty();
}
return;
}
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileEntityForgingStation tileentity = getCentralTileEntity(world, x, y, z);
if (tileentity == null) return true;
int meta = world.getBlockMetadata(x, y, z);
int part = meta & 3;
ItemStack stack = null;
if (part == 0) stack = tileentity.getRightItem();
else if (part == 1) stack = tileentity.getMiddleItem();
else if (part == 2) stack = tileentity.getLeftItem();
if (stack != null) {
// Try to pick up the item
boolean hasSpace = player.inventory.addItemStackToInventory(stack);
if (hasSpace) {
if (part == 0) tileentity.setRightItem(null);
else if (part == 1) tileentity.setMiddleItem(null);
else if (part == 2) tileentity.setLeftItem(null);
if (player instanceof EntityPlayerMP) {
((EntityPlayerMP) player).sendContainerToPlayer(player.inventoryContainer);
}
} else {
player.addChatMessage(new ChatComponentText("You need more inventory space"));
}
} else {
// Try to place an item
ItemStack heldStack = player.getHeldItem();
if (heldStack == null) return true;
boolean itemPlaced = false;
// Check all recipes to see if the held item matches any input slot
for (ForgingRecipe recipe : ForgingRecipes.getAllRecipes()) {
if (part == 0 && recipe.matchesItem(recipe.rightInput, heldStack)) {
tileentity.setRightItem(heldStack.splitStack(1));
itemPlaced = true;
} else if (part == 1 && recipe.matchesItem(recipe.middleInput, heldStack)) {
tileentity.setMiddleItem(heldStack.splitStack(1));
itemPlaced = true;
} else if (part == 2 && recipe.matchesItem(recipe.leftInput, heldStack)) {
tileentity.setLeftItem(heldStack.splitStack(1));
itemPlaced = true;
}
if (itemPlaced) {
tileentity.markDirty();
if (heldStack.stackSize <= 0) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
player.inventory.markDirty();
break;
}
}
if (!itemPlaced) {
player.addChatMessage(new ChatComponentText("This item does not fit here."));
}
}
}
return true;
}
}

@ -1,5 +1,7 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cinder_loe.client.render.block.RenderIceCage;
@ -38,6 +40,7 @@ public class IceCage extends Block {
setBlockName(Utilities.toSnakeCase("lotr:iceCage"));
setLightOpacity(5); // Semi-transparent
setCreativeTab(CreativeTabs.tabBlock);
setCreativeTab(LoECreativeTabs.tabDecoLoE);
}
@Override
@ -71,9 +74,9 @@ public class IceCage extends Block {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if ((meta == 0 && side == 1) || (meta == 1 && side == 0)) {
return this.emptyIcon;
}
/* if ((meta == 0 && side == 1) || (meta == 1 && side == 0)) {
return this.blockIcon;
}*/
return this.blockIcon;
}
@ -170,6 +173,24 @@ public class IceCage extends Block {
world.setBlock(x, y + 1, z, this, 1, 2); // Upper part
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (player.getHeldItem() != null && player.getHeldItem().getItem() == CinderLoE.iceThawer) {
if (!player.capabilities.isCreativeMode) {
player.getHeldItem().stackSize--;
if (player.getHeldItem().stackSize <= 0) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
world.func_147480_a(x, y, z, false);
return true;
}
return false;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
int meta = world.getBlockMetadata(x, y, z);

@ -1,51 +0,0 @@
package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.tileentity.TileEntityNexIceCrystal;
import com.zivilon.cinder_loe.util.Utilities;
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.tileentity.TileEntity;
import net.minecraft.world.World;
public class NexIceCrystal extends Block {
public NexIceCrystal() {
super(Material.ice); // Choose the appropriate material
// Set other properties like hardness, resistance, name, etc.
setCreativeTab(LoECreativeTabs.tabDecoLoE);
setHardness(100.0F);
setResistance(100.0F);
setBlockTextureName(Utilities.toSnakeCase("lotr:nexIceCrystal"));
setBlockName("lotr:NexIceCrystal");
}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileEntityNexIceCrystal();
}
@Override
public int getRenderType() {
return -1; // Custom render ID
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
}

@ -11,32 +11,59 @@ import net.minecraft.block.BlockPressurePlate;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.LoEDamage;
import com.zivilon.cinder_loe.tileentity.TileEntityShadowTile;
import java.lang.reflect.Field;
import java.util.Random;
public class ShadowTile extends BlockPressurePlate {
public int ticksLived = 0;
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();
}
this.setCreativeTab(LoECreativeTabs.tabMiscLoE);
setBlockTextureName("lotr:shadow_tile");
setBlockName("lotr:shadowTile");
this.isBlockContainer = true;
}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileEntityShadowTile();
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
// Manually create and initialize the tile entity
if (!world.isRemote) {
world.setTileEntity(x, y, z, createTileEntity(world, world.getBlockMetadata(x, y, z)));
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
super.breakBlock(world, x, y, z, block, meta);
world.removeTileEntity(x, y, z); // Clean up the tile entity
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (entity instanceof EntityPlayer) {
if (entity instanceof EntityPlayer && !world.isRemote) {
EntityPlayer player = (EntityPlayer)entity;
player.attackEntityFrom(new DamageSource("shadow"), 10.0F);
player.attackEntityFrom(LoEDamage.shadow, 10.0F);
player.addPotionEffect(new PotionEffect(15, 6*20, 0, false));
world.setBlockToAir(x, y, z);
}

@ -0,0 +1,72 @@
package com.zivilon.cinder_loe.client.model.blocks;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
/**
* forging_station - Shinare
* Created using Tabula 4.1.1
*/
public class ModelForgingStation extends ModelBase {
public ModelRenderer middle_block;
public ModelRenderer left_block;
public ModelRenderer right_block;
public ModelRenderer left_leg;
public ModelRenderer left_leg_top;
public ModelRenderer left_leg_base;
public ModelRenderer right_leg_front;
public ModelRenderer right_leg_back;
public ModelForgingStation() {
this.textureWidth = 128;
this.textureHeight = 64;
this.right_leg_back = new ModelRenderer(this, 0, 0);
this.right_leg_back.setRotationPoint(4.0F, 10.0F, 0.0F);
this.right_leg_back.addBox(0.0F, 0.0F, -2.0F, 2, 2, 16, 0.0F);
this.setRotateAngle(right_leg_back, 0.7853981633974483F, 0.0F, 0.0F);
this.left_leg = new ModelRenderer(this, 0, 32);
this.left_leg.setRotationPoint(6.0F, 2.0F, 6.0F);
this.left_leg.addBox(0.0F, 0.0F, 0.0F, 4, 14, 4, 0.0F);
this.left_leg_top = new ModelRenderer(this, 0, 32);
this.left_leg_top.setRotationPoint(-1.0F, 0.0F, -1.0F);
this.left_leg_top.addBox(0.0F, 0.0F, 0.0F, 6, 2, 6, 0.0F);
this.left_block = new ModelRenderer(this, 64, 32);
this.left_block.setRotationPoint(16.0F, 0.0F, 0.0F);
this.left_block.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
this.setRotateAngle(left_block, 0.0F, 3.141592653589793F, 0.0F);
this.right_leg_front = new ModelRenderer(this, 0, 0);
this.right_leg_front.setRotationPoint(11.0F, 10.0F, 0.0F);
this.right_leg_front.addBox(0.0F, 0.0F, -2.0F, 2, 2, 16, 0.0F);
this.setRotateAngle(right_leg_front, 0.7853981633974483F, 0.0F, 0.0F);
this.left_leg_base = new ModelRenderer(this, 0, 32);
this.left_leg_base.setRotationPoint(-1.0F, 12.0F, -1.0F);
this.left_leg_base.addBox(0.0F, 0.0F, 0.0F, 6, 2, 6, 0.0F);
this.right_block = new ModelRenderer(this, 64, 0);
this.right_block.setRotationPoint(0.0F, 0.0F, 16.0F);
this.right_block.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
this.middle_block = new ModelRenderer(this, 0, 0);
this.middle_block.setRotationPoint(-8.0F, 8.0F, -8.0F);
this.middle_block.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16, 0.0F);
this.right_block.addChild(this.right_leg_back);
this.left_block.addChild(this.left_leg);
this.left_leg.addChild(this.left_leg_top);
this.middle_block.addChild(this.left_block);
this.right_block.addChild(this.right_leg_front);
this.left_leg.addChild(this.left_leg_base);
this.middle_block.addChild(this.right_block);
}
public void render(float f5) {
this.middle_block.render(f5);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}

@ -1,9 +1,10 @@
package lotr.client.render.entity;
package com.zivilon.cinder_loe.client.render;
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 lotr.client.render.entity.LOTRRandomSkins;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderLiving;

@ -0,0 +1,50 @@
package com.zivilon.cinder_loe.client.render;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.zivilon.cinder_loe.entity.NexCloud;
public class RenderNexCloud extends Render {
public static ResourceLocation GREEN_PIXEL_TEXTURE = new ResourceLocation("cinder_loe:mob/green.png");
public ModelBase model = new ModelBase() {}; // Create an empty ModelBase instance
public ModelRenderer cube;
public RenderNexCloud() {
this.cube = new ModelRenderer(this.model, 0, 0);
this.cube.addBox(-8F, -8F, -8F, 16, 16, 16); // Define a cube of 16x16x16 pixels
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return GREEN_PIXEL_TEXTURE;
}
@Override
public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + entity.height / 2, (float) z);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_CULL_FACE); // Disable face culling
this.bindEntityTexture(entity); // Bind the single-pixel texture
NexCloud nexCloud = (NexCloud) entity;
GL11.glColor4f(1.0F, 1.0F, 1.0F, nexCloud.opacity); // Use the opacity from the entity
// Render the cube model
GL11.glScalef(entity.width, entity.height, entity.width);
this.cube.render(0.0625F); // Render the cube with a scaling factor
GL11.glEnable(GL11.GL_CULL_FACE); // Re-enable face culling
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}

@ -0,0 +1,136 @@
package com.zivilon.cinder_loe.client.render;
import com.zivilon.cinder_loe.entity.effect.NimveilLightningBolt;
import net.minecraft.client.renderer.entity.RenderLightningBolt;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class RenderNimveilBolt extends RenderLightningBolt {
public void doRender(NimveilLightningBolt p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
double[] adouble = new double[8];
double[] adouble1 = new double[8];
double d3 = 0.0D;
double d4 = 0.0D;
Random random = new Random(p_76986_1_.boltVertex);
for (int i = 7; i >= 0; --i) {
adouble[i] = d3;
adouble1[i] = d4;
d3 += (double)(random.nextInt(11) - 5);
d4 += (double)(random.nextInt(11) - 5);
}
for (int k1 = 0; k1 < 4; ++k1) {
Random random1 = new Random(p_76986_1_.boltVertex);
for (int j = 0; j < 3; ++j) {
int k = 7;
int l = 0;
if (j > 0) {
k = 7 - j;
}
if (j > 0) {
l = k - 2;
}
double d5 = adouble[k] - d3;
double d6 = adouble1[k] - d4;
for (int i1 = k; i1 >= l; --i1) {
double d7 = d5;
double d8 = d6;
if (j == 0) {
d5 += (double)(random1.nextInt(11) - 5);
d6 += (double)(random1.nextInt(11) - 5);
} else {
d5 += (double)(random1.nextInt(31) - 15);
d6 += (double)(random1.nextInt(31) - 15);
}
tessellator.startDrawing(5);
float f2 = 0.5F;
tessellator.setColorRGBA_F(0.9F * f2, 0.9F * f2, 1.0F * f2, 0.3F);
double d9 = 0.1D + (double)k1 * 0.2D;
if (j == 0) {
d9 *= (double)i1 * 0.1D + 1.0D;
}
double d10 = 0.1D + (double)k1 * 0.2D;
if (j == 0) {
d10 *= (double)(i1 - 1) * 0.1D + 1.0D;
}
for (int j1 = 0; j1 < 5; ++j1) {
double d11 = p_76986_2_ + 0.5D - d9;
double d12 = p_76986_6_ + 0.5D - d9;
if (j1 == 1 || j1 == 2) {
d11 += d9 * 2.0D;
}
if (j1 == 2 || j1 == 3) {
d12 += d9 * 2.0D;
}
double d13 = p_76986_2_ + 0.5D - d10;
double d14 = p_76986_6_ + 0.5D - d10;
if (j1 == 1 || j1 == 2) {
d13 += d10 * 2.0D;
}
if (j1 == 2 || j1 == 3) {
d14 += d10 * 2.0D;
}
tessellator.addVertex(d13 + d5, p_76986_4_ + (double)(i1 * 16), d14 + d6);
tessellator.addVertex(d11 + d7, p_76986_4_ + (double)((i1 + 1) * 16), d12 + d8);
}
tessellator.draw();
}
}
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
public ResourceLocation getEntityTexture(NimveilLightningBolt p_110775_1_) {
return null;
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
public ResourceLocation getEntityTexture(Entity p_110775_1_) {
return this.getEntityTexture((NimveilLightningBolt)p_110775_1_);
}
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((NimveilLightningBolt)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}

@ -29,10 +29,6 @@ public class RenderIceCage implements ISimpleBlockRenderingHandler {
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
@ -58,9 +54,6 @@ public class RenderIceCage implements ISimpleBlockRenderingHandler {
renderer.renderStandardBlock(block, x, y, z);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
return true;
}

@ -1,69 +0,0 @@
package com.zivilon.cinder_loe.client.render.block;
import com.zivilon.cinder_loe.client.model.ModelNexIceCrystal;
import com.zivilon.cinder_loe.tileentity.TileEntityNexIceCrystal;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
public class RenderNexIceCrystal extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
public static final int renderID = RenderingRegistry.getNextAvailableRenderId();
private static final ResourceLocation texture = new ResourceLocation("lotr:textures/blocks/nex_ice_crystal.png");
private final ModelNexIceCrystal model = new ModelNexIceCrystal();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
if (tileEntity instanceof TileEntityNexIceCrystal) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); // Center the model
GL11.glScalef(0.5F, 0.5F, 0.5F); // Scale down the model
this.bindTexture(texture);
this.model.render(null, 0, 0, 0, 0, 0, 0.0625F);
GL11.glPopMatrix();
}
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
if (modelId == renderID) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F); // Center the model in inventory
GL11.glScalef(0.5F, 0.5F, 0.5F); // Scale down the model
this.bindTexture(texture);
this.model.render(null, 0, 0, 0, 0, 0, 0.0625F);
GL11.glPopMatrix();
}
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
if (modelId == renderID) {
GL11.glPushMatrix();
GL11.glTranslatef(x + 0.5F, y + 0.5F, z + 0.5F); // Center the model in the world
GL11.glScalef(0.5F, 0.5F, 0.5F); // Scale down the model
this.bindTexture(texture);
this.model.render(null, 0, 0, 0, 0, 0, 0.0625F);
GL11.glPopMatrix();
return true;
}
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return renderID;
}
}

@ -0,0 +1,59 @@
package com.zivilon.cinder_loe.client.render.item;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
public class TrollClubRenderer implements IItemRenderer {
public static ResourceLocation texture = new ResourceLocation("lotr", "textures/items/troll_chieftain_club.png");
public ModelBase model;
/* public ModelTrollChieftainClub model;
public TrollClubRenderer(ModelTrollChieftainClub model) {
this.model = model;
}*/
public TrollClubRenderer() {
this.model = null;
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return false;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
// Position the model correctly
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
} else {
GL11.glTranslatef(0.7F, 0.4F, 0.5F);
}
// Rotate and scale the model as needed
GL11.glScalef(1.0F, 1.0F, 1.0F);
// Bind the texture
RenderManager.instance.renderEngine.bindTexture(texture);
// Render the model
model.render(null, 0, 0, 0, 0, 0, 0.0625F);
GL11.glPopMatrix();
}
}

@ -0,0 +1,113 @@
package com.zivilon.cinder_loe.client.render.tileentity;
import com.zivilon.cinder_loe.client.model.blocks.ModelForgingStation;
import com.zivilon.cinder_loe.tileentity.TileEntityForgingStation;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import net.minecraft.util.ChatComponentText;
public class TileEntityForgingStationRenderer extends TileEntitySpecialRenderer {
public ModelForgingStation model = new ModelForgingStation();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
if (tileEntity instanceof TileEntityForgingStation) {
TileEntityForgingStation tile = (TileEntityForgingStation) tileEntity;
// Get the metadata to determine if this is the middle part
int meta = tile.getBlockMetadata();
int direction = meta >> 2;
int part = meta & 3;
float rotation = 270F;
if (part != 1) return;
rotation = direction * 90F - 90F;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
GL11.glRotatef(rotation, 0F, 1F, 0F); // Adjust rotation as needed
bindTexture(new ResourceLocation("lotr:textures/blocks/forging_station.png"));
this.model.render(0.0625F); // Render the model
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
// Render the items above each part of the Forging Station
float offset = 0F;
switch (direction) {
case 1:
case 3:
offset -= 180F;
break;
}
renderStoredItems(tile, x, y, z, direction * 90F + offset);
}
}
public void renderStoredItems(TileEntityForgingStation tile, double x, double y, double z, float rotation) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.0F, (float) z + 0.5F); // Adjust the position
GL11.glRotatef(rotation, 0F, 1F, 0F); // Rotate to match the block's orientation
ItemStack left = tile.getLeftItem();
ItemStack middle = tile.getMiddleItem();
ItemStack right = tile.getRightItem();
// Render left item
if (left != null) {
renderItemInWorld(left, 1.0, 0.0, 0.0);
}
// Render middle item
if (middle != null) {
renderItemInWorld(middle, 0.0, 0.0, 0.0);
}
// Render right item
if (right != null) {
renderItemInWorld(right, -1.0, 0.0, 0.0);
}
GL11.glPopMatrix();
}
public void renderItemInWorld(ItemStack stack, double x, double y, double z) {
if (stack != null) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glScalef(1.0F, 1.0F, 1.0F); // Adjust the item size
// Bind the item texture
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationItemsTexture);
IIcon icon = stack.getIconIndex();
Tessellator tessellator = Tessellator.instance;
// Set up the item rendering parameters
float minU = icon.getMinU();
float maxU = icon.getMaxU();
float minV = icon.getMinV();
float maxV = icon.getMaxV();
// Render the item in 2D
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(-0.25F, -0.25F, 0.0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.customRenderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F, false);
GL11.glPopMatrix();
}
}
}

@ -71,6 +71,8 @@ public class LOTRMaterialTransformer implements IClassTransformer {
addMaterial("NEX_FIRE",classNode);
addMaterial("NEX_TOXIN",classNode);
addMaterial("NEX_SHADOW",classNode);
addMaterial("NIMVEIL",classNode);
addMaterial("FROZEN",classNode);
// Protection Conversion

@ -26,7 +26,7 @@ public class LOTRWeaponLinker implements IClassTransformer {
"swordBree",
"maceArnor",
"daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh",
"firstAgeGlaive");
"firstAgeGlaive", "nimveil");
}
return basicClass;
}

@ -1,16 +1,18 @@
package com.zivilon.cinder_loe.entity;
import java.util.UUID;
import lotr.common.LOTRDamage;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.fac.LOTRFaction;
import net.minecraft.block.Block;
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.player.EntityPlayerMP;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIWander;
@ -19,29 +21,73 @@ 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.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.entity.ai.LoEPreciseAttackOnCollide;
import com.zivilon.cinder_loe.util.BlockPos;
import com.zivilon.cinder_loe.util.Utilities;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class Nex extends LOTREntityNPC {
public EntityAIBase normal_attack_ai;
public EntityAIBase desperate_attack_ai;
public static double normal_attack_damage = 30.0D;
public static double desperate_attack_damage = 50.0D;
public static int normal_attack_speed = 20;
public static int desperate_attack_speed = 10;
public static List<WeakReference<Nex>> nex_instances = new ArrayList<>();
public AxisAlignedBB collisionBox;
public AxisAlignedBB hitbox;
public int phase = 1;
public int phase = 0;
public ChunkCoordinates currentFlightTarget;
public EntityPlayer playerTarget;
public int tickCounter = 0;
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));
normal_attack_ai = (EntityAIBase) new LoEPreciseAttackOnCollide(this, 1.3D, 3.0D, normal_attack_speed, false);
desperate_attack_ai = (EntityAIBase) new LoEPreciseAttackOnCollide(this, 1.3D, 3.0D, desperate_attack_speed, false);
((EntityLiving) this).tasks.addTask(2, normal_attack_ai);
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new EntityAIWander(this, 1.0D));
((EntityLiving) this).tasks.addTask(3, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
addTargetTasks(true);
store_nex_instance();
clear_shadow_tiles();
}
public void clear_shadow_tiles() {
if (!this.worldObj.isRemote) {
int xz_range = 100;
int y_range = 10;
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY);
int k = MathHelper.floor_double(this.posZ);
for (int i1 = i - xz_range; i1 <= i + xz_range; i1++) {
for (int j1 = j - y_range; j1 <= j + y_range; j1++) {
for (int k1 = k - xz_range; k1 <= k + xz_range; k1++) {
Block block = this.worldObj.getBlock(i1, j1, k1);
if (block == CinderLoE.shadowTile)
this.worldObj.setBlockToAir(i1, j1, k1);
}
}
}
}
}
protected void entityInit() {
@ -51,15 +97,45 @@ public class Nex extends LOTREntityNPC {
protected void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1000.0D);
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000.0D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
getEntityAttribute(npcAttackDamage).setBaseValue(normal_attack_damage);
}
public int getPhase() {
return this.dataWatcher.getWatchableObjectInt(31);
phase = this.dataWatcher.getWatchableObjectInt(31);
return phase;
}
public void setPhase(int i) {
this.dataWatcher.updateObject(31, Integer.valueOf(i));
phase = i;
this.dataWatcher.updateObject(31, Integer.valueOf(phase));
}
public void next_phase() {
Utilities.setInvulnerable((Entity)this, false);
phase = getPhase();
switch(phase) {
case 0: // Move to Toxic phase
clear_shadow_tiles();
setPhase(phase + 1);
return;
case 1: // Move to Ice phase
setPhase(phase + 1);
return;
case 2: // Move to Fire phase
setPhase(phase + 1);
return;
case 3: // Move to Desperation phase
setPhase(phase + 1);
this.tasks.removeTask(normal_attack_ai);
this.tasks.addTask(2, desperate_attack_ai);
getEntityAttribute(npcAttackDamage).setBaseValue(desperate_attack_damage);
return;
default:
System.out.println("[CinderLoE] Nex phase shift past phase 4???");
}
}
public LOTRFaction getFaction() {
@ -88,10 +164,183 @@ public class Nex extends LOTREntityNPC {
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);
// Phase 0 - Shadow
// Phase 1 - Toxin
// Phase 2 - Ice
// Phase 3 - Fire
// Phase 4 - Desperation
public void release_miniboss() {
Utilities.setInvulnerable((Entity)this, true);
System.out.println("Set Nex invulnerable: " + this.isEntityInvulnerable());
Class<?> phaseClass = null;
switch (phase) {
case 0:
phaseClass = NexShadow.class;
break;
case 1:
phaseClass = NexToxin.class;
break;
case 2:
phaseClass = NexIce.class;
break;
case 3:
phaseClass = NexFire.class;
break;
default:
this.setDead();
System.out.println("ERROR! Invalid Nex phase change: " + phase);
return;
}
System.out.println("Miniboss class: " + phaseClass.getSimpleName());
List<Entity> entityList = this.worldObj.getEntitiesWithinAABB(NexMiniboss.class, this.boundingBox.expand(100, 10, 100));
for (Entity entity : entityList) {
if (phaseClass.isInstance(entity)) {
System.out.println("Found correct miniboss class");
NexMiniboss miniboss = (NexMiniboss) entity;
miniboss.unbind();
return;
}
}
System.out.println("ERROR! Nex is missing miniboss of type " + phaseClass.getSimpleName());
}
@Override
public void onUpdate() {
super.onUpdate();
tickCounter++;
switch (phase) {
case 0:
runShadowTasks();
break;
case 1:
runToxinTasks();
break;
case 2:
runIceTasks();
break;
case 3:
runFireTasks();
break;
default:
break;
}
}
public void runShadowTasks() {
if (tickCounter >= 100) { // 5 seconds (100 ticks)
tickCounter = 0;
// Find air blocks with solid blocks underneath and place ShadowTile
placeShadowTiles();
}
}
public void runToxinTasks() {
if (tickCounter >= 200) {
tickCounter = 0;
spawnToxicCloud();
}
}
public void runIceTasks() {}
public void runFireTasks() {}
public List<BlockPos> getValidPositions() {
int radius = 64; // Radius to search for valid blocks
List<BlockPos> validPositions = new ArrayList<>();
// Iterate over blocks in a specific area
for (int x = -radius; x <= radius; x++) {
for (int y = -4; y <= 4; y++) {
for (int z = -radius; z <= radius; z++) {
BlockPos pos = new BlockPos(MathHelper.floor_double(this.posX) + x, MathHelper.floor_double(this.posY) + y, MathHelper.floor_double(this.posZ) + z);
BlockPos below = pos.down();
if (worldObj.isAirBlock(pos.x, pos.y, pos.z) && worldObj.getBlock(below.x, below.y, below.z).isOpaqueCube()) {
validPositions.add(pos);
}
}
}
}
return validPositions;
}
public void spawnToxicCloud() {
if (this.worldObj.isRemote) return;
int toxicCloudsToPlace = 4;
if (countToxicClouds() >= toxicCloudsToPlace) return;
List<BlockPos> validPositions = getValidPositions();
// Place NexCloud in 2 random valid positions
for (int i = 0; i < toxicCloudsToPlace && !validPositions.isEmpty(); i++) {
int randomIndex = worldObj.rand.nextInt(validPositions.size());
BlockPos pos = validPositions.remove(randomIndex);
NexCloud cloud = new NexCloud(this.worldObj);
cloud.setPosition(pos.x + 0.5, pos.y + 1.5, pos.z + 0.5);
this.worldObj.spawnEntityInWorld(cloud);
}
}
public boolean attackEntityAsMob(Entity entity) {
if (super.attackEntityAsMob(entity)) {
if (entity instanceof EntityPlayerMP)
LOTRDamage.doFrostDamage((EntityPlayerMP)entity);
if (entity instanceof EntityLivingBase) {
int difficulty = this.worldObj.difficultySetting.getDifficultyId();
int duration = difficulty * (difficulty + 5) / 2;
if (duration > 0)
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration * 20, 0));
}
return true;
}
return false;
}
public int countToxicClouds() {
List<NexCloud> clouds = worldObj.getEntitiesWithinAABB(NexCloud.class, this.boundingBox.expand(100.0, 10.0, 100.0));
return clouds.size();
}
public void placeShadowTiles() {
if (this.worldObj.isRemote) return;
int shadowTilesToPlace = 8; // Number of shadow tiles to place
List<BlockPos> validPositions = getValidPositions();
// Place ShadowTile in 4 random valid positions
for (int i = 0; i < shadowTilesToPlace && !validPositions.isEmpty(); i++) {
int randomIndex = worldObj.rand.nextInt(validPositions.size());
BlockPos pos = validPositions.remove(randomIndex);
worldObj.setBlock(pos.x, pos.y, pos.z, CinderLoE.shadowTile);
}
}
@Override
public boolean attackEntityFrom(DamageSource source, float dmg) {
super.attackEntityFrom(source, dmg);
int current_phase = (int) (this.getHealth() + dmg) / 1000;
int new_phase = (int) this.getHealth() / 1000;
System.out.println("Damage received: " + dmg + "while at health " + this.getHealth());
if (phase == 3) {
if (source instanceof EntityDamageSource) {
Entity attacker = ((EntityDamageSource)source).getEntity();
if (Utilities.has_fire_weapon(attacker)) {
attacker.attackEntityFrom(DamageSource.causeMobDamage(this), dmg);
attacker.setFire(10);
return false;
}
}
}
if (current_phase != new_phase && current_phase != 5) {
System.out.println("New phase should occur. Current phase health: " + current_phase + " and new phase health: " + new_phase);
if (phase != 4)
release_miniboss();
}
return true;
}
protected void dropFewItems(boolean flag, int i) {
@ -106,12 +355,59 @@ public class Nex extends LOTREntityNPC {
return "lotr:wight.death";
}
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
// Do nothing
}
@Override
public void heal(float amount) {}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return null;
}
// Scripting data methods, VT hooks into these. See util.VT_additions
public void store_nex_instance() {
cleanup_instances();
nex_instances.add(new WeakReference<>(this));
}
public static Nex get_nex_instance() {
cleanup_instances();
if (!nex_instances.isEmpty()) {
return nex_instances.get(0).get();
}
return null; // or handle this scenario accordingly
}
public static int get_nex_phase() {
Nex nex = get_nex_instance();
if (nex == null) {
return -404;
}
return nex.phase;
}
public static int get_nex_health() {
Nex nex = get_nex_instance();
if (nex == null) {
return -404;
}
return (int)nex.getHealth();
}
public static void cleanup_instances() {
for (int i = nex_instances.size() - 1; i >= 0; i--) {
WeakReference<Nex> weakRef = nex_instances.get(i);
Nex listed_instance = weakRef.get();
if (listed_instance == null || !listed_instance.isEntityAlive()) {
nex_instances.remove(i);
}
}
}
public static boolean is_nex_fire_phase_nearby(EntityLivingBase entity) {
List<Nex> entityList = entity.worldObj.getEntitiesWithinAABB(Nex.class, entity.boundingBox.expand(100, 10, 100));
for (Nex nex : entityList) { // We don't actually need to iterate, checking the first object is enough
if (nex.phase == 3) return true;
return false;
}
return false;
}
}

@ -0,0 +1,180 @@
package com.zivilon.cinder_loe.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.fac.LOTRFaction;
import net.minecraft.util.AxisAlignedBB;
import java.util.List;
public class NexCloud extends Entity {
public int tickCounter = 0;
public float opacity = 0.0F;
public boolean unbound = false;
public NexCloud(World world) {
super(world);
this.setSize(5.0F, 3.0F); // Set the size of the cloud
this.noClip = true; // Disable hitbox
}
@Override
protected void entityInit() {
this.dataWatcher.addObject(20, 0.0F); // Index 20, initial opacity
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbt) {
// Load entity data from NBT
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbt) {
// Save entity data to NBT
}
public void syncOpacityToClient() {
this.dataWatcher.updateObject(20, this.opacity);
}
@Override
public void onUpdate() {
super.onUpdate();
this.noClip = true;
if (worldObj.isRemote) {
this.opacity = this.dataWatcher.getWatchableObjectFloat(20);
// Update the client's position to match the server's position
this.setPosition(this.posX, this.posY, this.posZ);
return;
}
syncOpacityToClient();
tickCounter++;
if (tickCounter <= 100) {
// Increase opacity from 0.0F to 0.5F over the first 100 ticks
opacity = 0.5F * (tickCounter / 100.0F);
} else if (tickCounter <= 200) {
// Maintain opacity at 0.5F for the next 100 ticks
opacity = 0.5F;
}
if (unbound) {
followNearestPlayer();
// Apply the motion to the entity's position
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
this.setPosition(this.posX, this.posY, this.posZ); // Update the entity's position
}
if (tickCounter % 10 == 0) {
if (tickCounter > 60 && tickCounter < 240)
applyPoisonEffect();
unbound = isMinibossUnbound();
/* if (unbound && tickCounter > 100) {
tickCounter = 100;
return;
}*/
}
/* if (unbound) {
return;
}*/
if (tickCounter <= 300 && tickCounter > 200) {
// Decrease opacity from 0.5F to 0.0F over the next 100 ticks
opacity = 0.5F * ((300 - tickCounter) / 100.0F);
return;
}
if (tickCounter > 300) {
// Set the entity as dead after 300 ticks
System.out.println("Setting cloud dead. Ticks: " + tickCounter + " and unbound state: " + unbound);
this.setDead();
return;
}
}
@Override
public void moveEntity(double x, double y, double z) {
if (this.noClip) {
this.setPosition(this.posX + x, this.posY + y, this.posZ + z);
} else {
super.moveEntity(x, y, z);
}
}
public boolean isMinibossUnbound() {
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, this.boundingBox.expand(100.0, 10.0, 100.0));
for (Entity entity : entities) {
if (entity instanceof NexToxin) {
NexToxin miniboss = (NexToxin) entity;
// System.out.println("Found miniboss. Is unbound: " + !miniboss.bound);
return !miniboss.bound;
}
}
// System.out.println("Miniboss not found");
return false;
}
public void applyPoisonEffect() {
List<Entity> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox);
for (Entity entity : entities) {
if (entity != this && !(entity instanceof LOTREntityNPC && ((LOTREntityNPC) entity).getFaction() == LOTRFaction.UTUMNO)) {
if (entity instanceof EntityLivingBase) {
EntityLivingBase livingEntity = (EntityLivingBase) entity;
livingEntity.attackEntityFrom(DamageSource.magic, 2.0F);
livingEntity.addPotionEffect(new PotionEffect(Potion.poison.id, 200, 1)); // 10 seconds of poison (200 ticks)
}
}
}
}
@Override
public AxisAlignedBB getBoundingBox() {
return null;
}
public void followNearestPlayer() {
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100.0, 4.0, 100.0));
if (!players.isEmpty()) {
EntityPlayer nearestPlayer = players.get(0);
double minDistance = this.getDistanceToEntity(nearestPlayer);
for (EntityPlayer player : players) {
double distance = this.getDistanceToEntity(player);
if (distance < minDistance) {
nearestPlayer = player;
minDistance = distance;
}
}
double speed = 0.01;
this.motionX = (nearestPlayer.posX - this.posX) * speed;
this.motionY = (nearestPlayer.posY - this.posY) * speed;
this.motionZ = (nearestPlayer.posZ - this.posZ) * speed;
} else {
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
}
}
@Override
public boolean canBeCollidedWith() {
return false;
}
@Override
public boolean canBePushed() {
return false;
}
}

@ -1,15 +1,48 @@
package com.zivilon.cinder_loe.entity;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.util.Utilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.enchant.LOTREnchantment;
import net.minecraft.item.ItemStack;
public class NexFire extends NexShadow {
public class NexFire extends NexMiniboss {
public String entity_name = "§4Naira";
public NexFire(World world) {
super(world);
}
@Override
public void setupEquipment() {
ItemStack weapon = new ItemStack(LOTRMod.hammerUtumno, 0);
ItemStack boots = new ItemStack(CinderLoE.bootsNexFire, 0);
ItemStack legs = new ItemStack(CinderLoE.legsNexFire, 0);
ItemStack body = new ItemStack(CinderLoE.bodyNexFire, 0);
ItemStack helmet = new ItemStack(CinderLoE.helmetNexFire, 0);
Utilities.setAppliedRandomEnchants(weapon);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong2);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.fire);
this.npcItemsInv.setIdleItem(weapon);
this.npcItemsInv.setMeleeWeapon(weapon);
setCurrentItemOrArmor(0, weapon);
setCurrentItemOrArmor(1, boots);
setCurrentItemOrArmor(2, legs);
setCurrentItemOrArmor(3, body);
setCurrentItemOrArmor(4, helmet);
}
@Override
public String getNPCName() {
return entity_name;
@ -23,4 +56,12 @@ public class NexFire extends NexShadow {
public String getSpeechBank(EntityPlayer entityplayer) {
return "nex/fire";
}
@Override
public void onBoundUpdate(int x, int y, int z) {
}
@Override
public void onUnboundUpdate() {
}
}

@ -1,15 +1,49 @@
package com.zivilon.cinder_loe.entity;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.util.Utilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.enchant.LOTREnchantment;
import net.minecraft.item.ItemStack;
public class NexIce extends NexShadow {
public class NexIce extends NexMiniboss {
public String entity_name = "§bNinquë";
public NexIce(World world) {
super(world);
}
@Override
public void setupEquipment() {
ItemStack weapon = new ItemStack(LOTRMod.spearUtumno, 0);
ItemStack boots = new ItemStack(CinderLoE.bootsNexIce, 0);
ItemStack legs = new ItemStack(CinderLoE.legsNexIce, 0);
ItemStack body = new ItemStack(CinderLoE.bodyNexIce, 0);
ItemStack helmet = new ItemStack(CinderLoE.helmetNexIce, 0);
Utilities.setAppliedRandomEnchants(weapon);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong3);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.chill);
this.npcItemsInv.setIdleItem(weapon);
this.npcItemsInv.setMeleeWeapon(weapon);
setCurrentItemOrArmor(0, weapon);
setCurrentItemOrArmor(1, boots);
setCurrentItemOrArmor(2, legs);
setCurrentItemOrArmor(3, body);
setCurrentItemOrArmor(4, helmet);
}
@Override
public String getNPCName() {
return entity_name;
@ -23,4 +57,12 @@ public class NexIce extends NexShadow {
public String getSpeechBank(EntityPlayer entityplayer) {
return "nex/ice";
}
@Override
public void onBoundUpdate(int x, int y, int z) {
}
@Override
public void onUnboundUpdate() {
}
}

@ -0,0 +1,152 @@
package com.zivilon.cinder_loe.entity;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cinder_loe.entity.Nex;
import com.zivilon.cinder_loe.entity.ai.LoEPreciseAttackOnCollide;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import lotr.common.entity.npc.LOTREntityMan;
import lotr.common.fac.LOTRFaction;
import java.util.List;
public abstract class NexMiniboss extends LOTREntityMan {
public String entity_name = "UNDEFINED";
public boolean bound = true;
public NexMiniboss(World world) {
super(world);
setSize(0.6F, 1.8F);
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LoEPreciseAttackOnCollide(this, 1.3D, 1.0D, 40, false));
((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, Nex.class, 8.0F, 0.02F));
addTargetTasks(true);
setupEquipment();
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.225D);
getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
}
@Override
public LOTRFaction getFaction() {
return LOTRFaction.UTUMNO;
}
@Override
protected boolean canDespawn() {
return false;
}
@Override
public String getNPCName() {
return entity_name;
}
@Override
public String getNPCFormattedName(String npcName, String entityName) {
return entity_name;
}
@Override
protected void dropFewItems(boolean flag, int i) {
}
@Override
public boolean getCanSpawnHere() {
return false;
}
@Override
public String getSpeechBank(EntityPlayer entityplayer) {
return "nex/undefined";
}
@Override
public void setupNPCName() {
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return null;
}
@Override
public void onDeath(DamageSource source) {
List<Nex> entityList = this.worldObj.getEntitiesWithinAABB(Nex.class, this.boundingBox.expand(100, 10, 100));
for (Nex nex : entityList) {
nex.next_phase();
return;
}
}
public void unbind() {
System.out.println("Unbinding " + this.getClass().getSimpleName());
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.posY);
int z = MathHelper.floor_double(this.posZ);
Block blockAtFeet = this.worldObj.getBlock(x, y, z);
Block blockAtHead = this.worldObj.getBlock(x, y + 1, z);
if (blockAtFeet == CinderLoE.iceCage) {
this.worldObj.setBlock(x, y, z, Blocks.air);
}
if (blockAtHead == CinderLoE.iceCage) {
this.worldObj.setBlock(x, y, z, Blocks.air);
}
bound = false;
}
@Override
public void onUpdate() {
super.onUpdate();
checkInsideIceCage();
}
public void checkInsideIceCage() {
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.posY);
int z = MathHelper.floor_double(this.posZ);
Block blockAtFeet = this.worldObj.getBlock(x, y, z);
Block blockAtHead = this.worldObj.getBlock(x, y + 1, z);
if (blockAtFeet == CinderLoE.iceCage || blockAtHead == CinderLoE.iceCage) {
onBoundUpdate(x, y, z);
Utilities.setInvulnerable((Entity)this, true);
// System.out.println("Nex Miniboss vulnerable: " + this.isEntityInvulnerable());
} else {
onUnboundUpdate();
Utilities.setInvulnerable((Entity)this, false);
// System.out.println("Nex Miniboss vulnerable: " + this.isEntityInvulnerable());
}
}
public abstract void onBoundUpdate(int x, int y, int z);
public abstract void onUnboundUpdate();
public abstract void setupEquipment();
}

@ -2,53 +2,49 @@ package com.zivilon.cinder_loe.entity;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cinder_loe.entity.Nex;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.enchant.LOTREnchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityMan;
import lotr.common.fac.LOTRFaction;
import java.util.List;
public class NexShadow extends LOTREntityMan {
public class NexShadow extends NexMiniboss {
public 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(8, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, Nex.class, 8.0F, 0.02F));
addTargetTasks(true);
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
}
@Override
public LOTRFaction getFaction() {
return LOTRFaction.UTUMNO;
public void setupEquipment() {
ItemStack weapon = new ItemStack(LOTRMod.swordUtumno, 0);
ItemStack boots = new ItemStack(CinderLoE.bootsNexShadow, 0);
ItemStack legs = new ItemStack(CinderLoE.legsNexShadow, 0);
ItemStack body = new ItemStack(CinderLoE.bodyNexShadow, 0);
ItemStack helmet = new ItemStack(CinderLoE.helmetNexShadow, 0);
Utilities.setAppliedRandomEnchants(weapon);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
this.npcItemsInv.setIdleItem(weapon);
this.npcItemsInv.setMeleeWeapon(weapon);
setCurrentItemOrArmor(0, weapon);
setCurrentItemOrArmor(1, boots);
setCurrentItemOrArmor(2, legs);
setCurrentItemOrArmor(3, body);
setCurrentItemOrArmor(4, helmet);
}
@Override
@ -60,54 +56,12 @@ public class NexShadow extends LOTREntityMan {
return entity_name;
}
@Override
protected void dropFewItems(boolean flag, int i) {
}
@Override
public boolean getCanSpawnHere() {
return false;
}
@Override
public String getSpeechBank(EntityPlayer entityplayer) {
return "nex/shadow";
}
@Override
public void setupNPCName() {
}
@Override
public ItemStack getPickedResult(MovingObjectPosition target) {
return null;
}
@Override
public void onUpdate() {
super.onUpdate();
checkInsideIceCage();
}
public void checkInsideIceCage() {
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.posY);
int z = MathHelper.floor_double(this.posZ);
Block blockAtFeet = this.worldObj.getBlock(x, y, z);
Block blockAtHead = this.worldObj.getBlock(x, y + 1, z);
if (blockAtFeet == CinderLoE.iceCage || blockAtHead == CinderLoE.iceCage) {
onBoundUpdate(x, y, z);
Utilities.setEntityInvulnerable(this, true);
System.out.println("Nex Shadow vulnerable: " + this.isEntityInvulnerable());
} else {
onUnboundUpdate();
Utilities.setEntityInvulnerable(this, false);
System.out.println("Nex Shadow vulnerable: " + this.isEntityInvulnerable());
}
}
public void onBoundUpdate(int x, int y, int z) {
this.motionX = 0;
this.motionY = 0;
@ -115,6 +69,7 @@ public class NexShadow extends LOTREntityMan {
this.setPosition(x + 0.5, y, z + 0.5);
}
@Override
public void onUnboundUpdate() {
List<EntityPlayer> players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100.0D, 100.0D, 100.0D));

@ -1,15 +1,54 @@
package com.zivilon.cinder_loe.entity;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.util.Utilities;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.enchant.LOTREnchantment;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class NexToxin extends NexShadow {
public class NexToxin extends NexMiniboss {
public String entity_name = "§2Hloirë";
public NexToxin(World world) {
super(world);
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
}
@Override
public void setupEquipment() {
ItemStack weapon = new ItemStack(LOTRMod.daggerUtumnoPoisoned, 0);
ItemStack boots = new ItemStack(CinderLoE.bootsNexToxin, 0);
ItemStack legs = new ItemStack(CinderLoE.legsNexToxin, 0);
ItemStack body = new ItemStack(CinderLoE.bodyNexToxin, 0);
ItemStack helmet = new ItemStack(CinderLoE.helmetNexToxin, 0);
Utilities.setAppliedRandomEnchants(weapon);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong4);
Utilities.setLOTREnchant(weapon, LOTREnchantment.strong1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeReach1);
Utilities.setLOTREnchant(weapon, LOTREnchantment.meleeSpeed1);
this.npcItemsInv.setIdleItem(weapon);
this.npcItemsInv.setMeleeWeapon(weapon);
setCurrentItemOrArmor(0, weapon);
setCurrentItemOrArmor(1, boots);
setCurrentItemOrArmor(2, legs);
setCurrentItemOrArmor(3, body);
setCurrentItemOrArmor(4, helmet);
}
@Override
public String getNPCName() {
return entity_name;
@ -23,4 +62,12 @@ public class NexToxin extends NexShadow {
public String getSpeechBank(EntityPlayer entityplayer) {
return "nex/toxin";
}
@Override
public void onBoundUpdate(int x, int y, int z) {
}
@Override
public void onUnboundUpdate() {
}
}

@ -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);
}
}

@ -0,0 +1,84 @@
package com.zivilon.cinder_loe.entity.effect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityWeatherEffect;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import java.util.List;
public class NimveilLightningBolt extends EntityWeatherEffect {
/** Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. */
public int lightningState;
/** A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt */
public long boltVertex;
/** Determines the time before the NimveilLightningBolt is destroyed. It is a random integer decremented over time. */
public int boltLivingTime;
public NimveilLightningBolt(World world, double x, double y, double z) {
super(world);
this.setLocationAndAngles(x, y, z, 0.0F, 0.0F);
this.lightningState = 2;
this.boltVertex = this.rand.nextLong();
this.boltLivingTime = this.rand.nextInt(3) + 1;
}
public NimveilLightningBolt(World world) {
this(world, 0, 0, 0);// Summon line of custom lightning bolts
// Must not place fire or affect any non-EntityLivingBase targets
// Probably the most work of all of these
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate() {
super.onUpdate();
if (this.lightningState == 2) {
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 2.0F, 0.5F + this.rand.nextFloat() * 0.2F);
}
--this.lightningState;
if (this.lightningState < 0) {
if (this.boltLivingTime == 0) {
this.setDead();
} else if (this.lightningState < -this.rand.nextInt(10)) {
--this.boltLivingTime;
this.lightningState = 1;
this.boltVertex = this.rand.nextLong();
}
}
if (this.lightningState >= 0) {
if (this.worldObj.isRemote) {
this.worldObj.lastLightningBolt = 2;
} else {
double d0 = 3.0D;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0));
list.removeIf(entity -> !(entity instanceof EntityLivingBase));
list.removeIf(entity -> (entity instanceof EntityPig));
list.removeIf(entity -> (entity instanceof EntityCreeper));
for (int l = 0; l < list.size(); ++l) {
Entity entity = (Entity)list.get(l);
if (entity.isImmuneToFire() == false) {
entity.attackEntityFrom(DamageSource.inFire, 20.0F);
entity.setFire(8);
}
System.out.println("Striking " + entity.getCommandSenderName());
}
}
}
}
public void entityInit() {}
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {}
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {}
}

@ -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 {
@ -34,6 +36,7 @@ public class EntityWarDart extends LOTREntityProjectileBase {
public ItemStack item;
public int 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,6 +108,15 @@ 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;
@ -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
}
}

@ -0,0 +1,26 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.CinderLoE;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import java.util.List;
public class BlessedHammer extends LoEHammer {
public BlessedHammer() {
super(CinderLoE.MATERIAL_NIMVEIL, CinderLoE.enchantedIce);
this.setTextureName("lotr:blessed_hammer");
}
@Override
public String getUnlocalizedName(ItemStack item) {
return "item.blessed_hammer";
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(EnumChatFormatting.GRAY + "This blacksmith hammer is brimming with power");
}
}

@ -0,0 +1,26 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import lotr.common.item.LOTRItemPolearm;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class Celeiniss extends LOTRItemPolearm {
public Celeiniss() {
super(CinderLoE.MATERIAL_NEX_ICE);
this.lotrWeaponDamage = 11.5F;
this.setUnlocalizedName("lotr:firstAgeGlaive");
this.setTextureName("lotr:firstAgeGlaive");
this.setCreativeTab(LoECreativeTabs.tabCombatLoE);
LOTRWeaponStats.registerMeleeReach(Celeiniss.class, 1.8F);
LOTRWeaponStats.registerMeleeSpeed(Celeiniss.class, 1.0F);
}
public boolean getIsRepairable(ItemStack itemstack, ItemStack repairItem) {
return (repairItem.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce));
}
}

@ -120,7 +120,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) {
@ -128,7 +127,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,27 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List;
public class IceThawer extends Item {
public IceThawer() {
this.setUnlocalizedName("ice_thawer");
this.setTextureName("lotr:ice_thawer");
setCreativeTab(LoECreativeTabs.tabMiscLoE);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(EnumChatFormatting.DARK_PURPLE + "You feel like if you held this");
list.add(EnumChatFormatting.DARK_PURPLE + "against a frozen body, it might melt.");
list.add(EnumChatFormatting.DARK_PURPLE + "But why would you need such thing?");
}
}

@ -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;
}
}

@ -0,0 +1,458 @@
package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.LoECreativeTabs;
import com.zivilon.cinder_loe.entity.effect.NimveilLightningBolt;
import com.zivilon.cinder_loe.potion.LoEPotions;
import com.zivilon.cinder_loe.util.Utilities;
import lotr.common.LOTRLevelData;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.fac.LOTRFaction;
import lotr.common.item.LOTRItemSword;
import lotr.common.item.LOTRMaterial;
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.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class Nimveil extends LOTRItemSword {
public static String NBT_STATE = "NimveilState";
public static String NBT_VARIANT = "NimveilVariant";
public static String NBT_TICK = "Tick";
public IIcon[] icons;
public Nimveil() {
super(CinderLoE.MATERIAL_NIMVEIL);
this.setHasSubtypes(true);
this.canRepair = false;
this.setMaxDamage(300);
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
public boolean getIsRepairable(ItemStack nimveil, ItemStack repair_material) {
if (repair_material.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce))
return true;
return false;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return true; // Always show the durability bar
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
int state = get_state(stack);
// No charges found, show recharge meter
if (state == 0) {
double damage = ((double) stack.getItemDamage() / (double) stack.getMaxDamage());
return damage;
}
// The only variant where state is > 1 is "ancient". So we skip an NBT read here.
if (state > 1) {
double ancient_charges = 1.0D - (10.0D - (double)state) / 10.0D;
return 1.0D - ancient_charges;
}
// If variant is not "ancient", then it can't have more than 1 charge. We already checked that there is charge, so it's at max
String variant = get_variant(stack);
if (!variant.equals("ancient"))
return 0.0D;
// If variant is "ancient" and state is 1, we know the bar is at 0.9.
return 0.9D;
}
/**
* Nimveil state handling
*/
public static byte get_state(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound();
return tag.getByte(NBT_STATE);
}
return 0;
}
public static void set_state(ItemStack stack, byte state) {
NBTTagCompound tag = stack.getTagCompound();
if (tag == null) {
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
tag.setByte(NBT_STATE, state);
}
public static boolean decrement_state(ItemStack stack) {
NBTTagCompound tag = stack.getTagCompound();
if (tag == null) {
return false;
}
byte state = tag.getByte(NBT_STATE);
if (state > 0) {
if (state == 1)
stack.setItemDamage(300);
tag.setByte(NBT_STATE, --state);
return true;
}
return false;
}
public static int tick(ItemStack stack) {
NBTTagCompound tag = stack.getTagCompound();
if (tag == null) {
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
int tick = tag.getInteger(NBT_TICK);
if (tick >= 20) {
tick = 0;
} else {
tick++;
}
tag.setInteger(NBT_TICK, tick);
return tick;
}
/**
* Methods to put all variants under one item type
*/
public IIcon getIconIndex(ItemStack stack)
{
int icon_index = 0;
if (get_state(stack) != 0)
icon_index += 5;
switch(get_variant(stack)) {
case "valar":
break;
case "mortals":
icon_index += 1;
break;
case "udun":
icon_index += 2;
break;
case "sauron":
icon_index += 3;
break;
case "ancient":
icon_index += 4;
break;
default:
break;
}
return icons[icon_index];
}
@Override
public void registerIcons(IIconRegister iconRegister) {
this.icons = new IIcon[10];
this.icons[0] = iconRegister.registerIcon("lotr:nimveil_valar");
this.icons[1] = iconRegister.registerIcon("lotr:nimveil_mortals");
this.icons[2] = iconRegister.registerIcon("lotr:nimveil_udun");
this.icons[3] = iconRegister.registerIcon("lotr:nimveil_sauron");
this.icons[4] = iconRegister.registerIcon("lotr:nimveil_ancient");
this.icons[5] = iconRegister.registerIcon("lotr:nimveil_valar_glow");
this.icons[6] = iconRegister.registerIcon("lotr:nimveil_mortals_glow");
this.icons[7] = iconRegister.registerIcon("lotr:nimveil_udun_glow");
this.icons[8] = iconRegister.registerIcon("lotr:nimveil_sauron_glow");
this.icons[9] = iconRegister.registerIcon("lotr:nimveil_ancient_glow");
}
@Override
public String getUnlocalizedName(ItemStack item) {
// return "item.nimveil_" + get_variant(item);
return "lotr:nimveil";
}
public static String get_variant(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound();
return tag.getString(NBT_VARIANT);
}
return "invalid";
}
public static ItemStack init_variant(ItemStack stack, String variant) {
NBTTagCompound tag = stack.getTagCompound();
if (tag == null) {
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
tag.setString(NBT_VARIANT, variant);
tag.setByte(NBT_STATE, (byte)0);
return stack;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
switch(get_variant(stack)) {
case "valar":
list.add(EnumChatFormatting.AQUA + "Valar");
list.add("");
list.add(EnumChatFormatting.GOLD + "Special Attack:");
list.add(EnumChatFormatting.YELLOW + " Cast a line of lightning strikes");
return;
case "mortals":
list.add(EnumChatFormatting.DARK_GREEN + "Mortals");
list.add("");
list.add(EnumChatFormatting.GOLD + "Special Attack:");
list.add(EnumChatFormatting.YELLOW + " Deal 25% of your missing health as damage");
return;
case "udun":
list.add(EnumChatFormatting.DARK_RED + "Udûn");
list.add("");
list.add(EnumChatFormatting.GOLD + "Special Attack:");
list.add(EnumChatFormatting.YELLOW + " +20% Attack Damage");
list.add(EnumChatFormatting.YELLOW + " Reverse Knockback");
return;
case "sauron":
list.add(EnumChatFormatting.DARK_PURPLE + "Sauron");
list.add(EnumChatFormatting.GOLD + "Special Attack:");
list.add(EnumChatFormatting.YELLOW + " Apply Corrupting effect for 60 seconds");
list.add(EnumChatFormatting.YELLOW + " Causes all NPCs to be hostile");
return;
case "ancient":
list.add(EnumChatFormatting.DARK_AQUA + "Ancient");
list.add(EnumChatFormatting.GOLD + "Special Attack:");
list.add(EnumChatFormatting.YELLOW + " For each outnumbering non-allied NPC nearby");
list.add(EnumChatFormatting.YELLOW + " +5% damage vs NPCs");
list.add(EnumChatFormatting.YELLOW + " +1.25% damage vs players");
return;
default:
list.add(EnumChatFormatting.GRAY + "Invalid");
return;
}
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(init_variant(new ItemStack(item, 1), "ancient"));
list.add(init_variant(new ItemStack(item, 1), "valar"));
list.add(init_variant(new ItemStack(item, 1), "mortals"));
list.add(init_variant(new ItemStack(item, 1), "udun"));
list.add(init_variant(new ItemStack(item, 1), "sauron"));
}
/**
* Modify sword mechanics to those unique to Nimveil
*/
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
if (attacker.worldObj.isRemote) return false;
if (stack.getItemDamage() != 0) return false;
if (decrement_state(stack)) {
special_damage(stack, target, attacker);
}
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (world.isRemote) return stack;
if (stack.getItemDamage() != 0) return stack;
byte state = get_state(stack);
if (state == 0) {
special_action(stack, world, player);
}
return stack;
}
/**
* Unused but here to remind they exist for later
*/
@Override
public EnumAction getItemUseAction(ItemStack p_77661_1_) {
return EnumAction.none; // might be modified later, it's here so I remember it exists,
}
/**
* Recharging durability (special attack) bar
*/
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
super.onUpdate(stack, world, entity, itemSlot, isSelected);
// Only run on the server-side to prevent conflicts with client-side rendering
if (!world.isRemote && get_state(stack) == 0) {
int tick = tick(stack);
if (tick == 20 && stack.getItemDamage() > 0) {
stack.setItemDamage(stack.getItemDamage() - 1);
}
}
}
/**
* Generic redirects for Nimveil special actions
*/
public void special_action(ItemStack stack, World world, EntityPlayer player) {
String variant = get_variant(stack);
switch(variant) {
case "valar":
special_action_valar(stack, world, player);
return;
case "mortals":
special_action_mortals(stack, world, player);
return;
case "udun":
special_action_udun(stack, world, player);
return;
case "sauron":
special_action_sauron(stack, world, player);
return;
case "ancient":
special_action_ancient(stack, world, player);
return;
default:
return;
}
}
public void special_damage(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
String variant = get_variant(stack);
switch(variant) {
case "mortals":
special_damage_mortals(stack, target, attacker);
return;
case "udun":
special_damage_udun(stack, target, attacker);
return;
case "sauron":
special_damage_sauron(stack, target, attacker);
return;
case "ancient":
special_damage_ancient(stack, target, attacker);
return;
case "valar":
special_damage_valar(stack, target, attacker);
return;
default:
return;
}
}
/**
* Valar Nimveil special actions
*/
public void special_action_valar(ItemStack stack, World world, EntityPlayer player) {
// No charges because this triggers immediately. Set damage to max
stack.setItemDamage(stack.getMaxDamage());
System.out.println("Triggering Valar action. Also max damage is " + stack.getMaxDamage());
summon_lightning_line(world, player);
}
public void special_damage_valar(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
// Do nothing, this method should never run but exists for consistency and extensibility
}
public void summon_lightning_line(World world, EntityPlayer player) {
// Get the player's facing direction
float yaw = player.rotationYaw;
// Calculate the initial position, 4 blocks in front
double x = player.posX - Math.sin(Math.toRadians(yaw)) * 7;
double z = player.posZ + Math.cos(Math.toRadians(yaw)) * 7;
double y = player.posY;
// Summon the first lightning bolt
world.spawnEntityInWorld(new NimveilLightningBolt(world, x, y, z));
// Summon 6 more lightning bolts, each 3 blocks apart
for (int i = 1; i < 7; i++) {
x -= Math.sin(Math.toRadians(yaw)) * 5;
z += Math.cos(Math.toRadians(yaw)) * 5;
world.spawnEntityInWorld(new NimveilLightningBolt(world, x, y, z));
}
}
/**
* Udûn Nimveil special actions
*/
public void special_action_udun(ItemStack stack, World world, EntityPlayer player) {
// Set 1 charge
set_state(stack, (byte)1);
}
public void special_damage_udun(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
double damage = Utilities.calculate_melee_damage_on_entity(target, attacker);
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), 0.2F * (float)damage);
Utilities.knockback(target, attacker, -3.0D);
target.worldObj.playSoundAtEntity(target, "lotr:item.maceSauron", 1.0F, 1.3F);
}
/**
* Mortals Nimveil special actions
*/
public void special_action_mortals(ItemStack stack, World world, EntityPlayer player) {
// Set 1 charge
set_state(stack, (byte)1);
}
public void special_damage_mortals(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
// Set 1 charge
float max_health = attacker.getMaxHealth();
float current_health = attacker.getHealth();
target.attackEntityFrom(DamageSource.causeMobDamage(attacker).setDamageBypassesArmor(), 0.25F * (max_health - current_health));
}
/**
* Sauron Nimveil special actions
*/
public void special_action_sauron(ItemStack stack, World world, EntityPlayer player) {
// Set 1 charge
set_state(stack, (byte)1);
}
public void special_damage_sauron(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
// Check if the target is an instance of EntityPlayer
if (target instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) target;
// Apply the Corrupting potion effect
player.addPotionEffect(new PotionEffect(LoEPotions.corrupting.id, 1200, 0)); // 60 seconds duration (20 ticks per second)
}
}
/**
* Ancient Nimveil special actions
*/
public void special_action_ancient(ItemStack stack, World world, EntityPlayer player) {
// Set 10 charges
this.set_state(stack, ((byte)10));
}
public void special_damage_ancient(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
if (!(attacker instanceof EntityPlayer)) return;
LOTRFaction pledged_faction = LOTRLevelData.getData(((EntityPlayer)attacker)).getPledgeFaction();
if (pledged_faction == null) {
((EntityPlayer)attacker).addChatMessage(new ChatComponentText("You need to be pledged to a faction to use this"));
return;
}
List<LOTREntityNPC> entity_list = attacker.worldObj.getEntitiesWithinAABB(LOTREntityNPC.class, attacker.boundingBox.expand(100, 10, 100));
int friendly_count = 0;
int total_count = entity_list.size();
double damage = 0.0D;
for (LOTREntityNPC npc : entity_list) {
if (npc.getFaction().isGoodRelation(pledged_faction))
friendly_count++;
}
int outnumber_count = Math.min(total_count - friendly_count * 2, 20);
if (outnumber_count > 0)
damage = Utilities.calculate_melee_damage_on_entity(target, attacker);
float final_damage = 0.0F;
if (!(target instanceof EntityPlayer)) {
final_damage = 0.05F * (float)outnumber_count * (float)damage;
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), final_damage);
return;
}
final_damage = 0.0125F * ((float)outnumber_count) * ((float)damage);
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), final_damage);
return;
}
}

@ -0,0 +1,128 @@
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;
import lotr.common.entity.projectile.LOTREntityThrowingAxe;
import lotr.common.item.LOTRMaterial;
import lotr.common.recipe.LOTRRecipes;
import net.minecraft.block.BlockDispenser;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.creativetab.CreativeTabs;
import java.util.List;
public class NimveilPart extends Item {
public IIcon[] icons;
public NimveilPart() {
this.setHasSubtypes(true);
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[7];
this.icons[0] = iconRegister.registerIcon("lotr:nimveil_hilt");
this.icons[1] = iconRegister.registerIcon("lotr:nimveil_blade");
this.icons[2] = iconRegister.registerIcon("lotr:nimveil_gem_valar");
this.icons[3] = iconRegister.registerIcon("lotr:nimveil_gem_mortals");
this.icons[4] = iconRegister.registerIcon("lotr:nimveil_gem_udun");
this.icons[5] = iconRegister.registerIcon("lotr:nimveil_gem_sauron");
this.icons[6] = iconRegister.registerIcon("lotr:nimveil_gem_ancient");
}
public static String get_part_type(ItemStack item) {
switch(item.getItemDamage()) {
case 0:
return "hilt";
case 1:
return "blade";
case 2:
case 3:
case 4:
case 5:
case 6:
return "gem";
default:
return "hilt";
}
}
public static String get_gem_type(ItemStack item) {
switch(item.getItemDamage()) {
case 0:
case 1:
return "invalid";
case 2:
return "valar";
case 3:
return "mortals";
case 4:
return "udun";
case 5:
return "sauron";
case 6:
return "ancient";
default:
return "invalid";
}
}
@Override
public String getUnlocalizedName(ItemStack item) {
return "item.nimveil_" + get_part_type(item);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
switch(get_gem_type(stack)) {
case "valar":
list.add(EnumChatFormatting.AQUA + "Valar");
return;
case "mortals":
list.add(EnumChatFormatting.DARK_GREEN + "Mortals");
return;
case "udun":
list.add(EnumChatFormatting.DARK_RED + "Udûn");
return;
case "sauron":
list.add(EnumChatFormatting.DARK_PURPLE + "Sauron");
return;
case "ancient":
list.add(EnumChatFormatting.DARK_AQUA + "Ancient");
return;
default:
return;
}
}
@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));
}
}
}

@ -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";
}
@ -137,6 +140,7 @@ public class WarDart extends Item {
case 11: return 6; // Red Dwarven
case 12: return 10; // Mithril
case 13: return 12; // Ancient
case 14: return 6; // Morgul
default: return 0;
}
}

@ -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,127 @@
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;
import lotr.common.entity.projectile.LOTREntityThrowingAxe;
import lotr.common.item.LOTRMaterial;
import lotr.common.recipe.LOTRRecipes;
import net.minecraft.block.BlockDispenser;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.creativetab.CreativeTabs;
import java.util.List;
public class WeaponPart extends Item {
public IIcon[] icons;
public WeaponPart() {
this.setHasSubtypes(true);
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[12];
this.icons[0] = iconRegister.registerIcon("lotr:deceiver_blade_blade");
this.icons[1] = iconRegister.registerIcon("lotr:deceiver_blade_guard");
this.icons[2] = iconRegister.registerIcon("lotr:deceiver_blade_hilt");
this.icons[3] = iconRegister.registerIcon("lotr:anarore_bow_top");
this.icons[4] = iconRegister.registerIcon("lotr:anarore_bow_bottom");
this.icons[5] = iconRegister.registerIcon("lotr:anarore_bow_bowstring");
this.icons[6] = iconRegister.registerIcon("lotr:chieftain_club_???");
this.icons[7] = iconRegister.registerIcon("lotr:chieftain_club_???");
this.icons[8] = iconRegister.registerIcon("lotr:chieftain_club_???");
this.icons[9] = iconRegister.registerIcon("lotr:glaechir_spear_tip");
this.icons[10] = iconRegister.registerIcon("lotr:glaechir_spear_shaft");
this.icons[11] = iconRegister.registerIcon("lotr:glaechir_spear_???");
}
public static String get_part(ItemStack item) {
switch(item.getItemDamage()) {
case 0:
return "blade";
case 1:
return "guard";
case 2:
return "hilt";
case 3:
return "top";
case 4:
return "bottom";
case 5:
return "bowstring";
case 6:
return "club";
case 7:
return "spikes";
case 8:
return "???";
case 9:
return "tip";
case 10:
return "shaft";
case 11:
return "???";
default:
return "invalid";
}
}
public static String get_weapon(ItemStack item) {
switch(item.getItemDamage()) {
case 0:
case 1:
case 2:
return "deceiver_blade";
case 3:
case 4:
case 5:
return "anarore_bow";
case 6:
case 7:
case 8:
return "troll_chieftain_club";
case 9:
case 10:
case 11:
return "glaechir_spear";
default:
return "invalid";
}
}
@Override
public String getUnlocalizedName(ItemStack item) {
return "item." + get_weapon(item) + "_" + get_part(item);
}
@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,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();
}
}
}

@ -0,0 +1,202 @@
package com.zivilon.cinder_loe.mixins;
import com.zivilon.cinder_loe.entity.Nex;
import com.zivilon.cinder_loe.entity.NexMiniboss;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Overwrite;
import net.minecraft.potion.Potion;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraftforge.common.ForgeHooks;
import java.util.List;
@Mixin(EntityLivingBase.class)
public abstract class MixinEntityLivingBase extends Entity {
@Shadow
protected int entityAge;
@Shadow
public int maxHurtTime;
@Shadow
public float attackedAtYaw;
@Shadow
protected EntityPlayer attackingPlayer;
@Shadow
protected int recentlyHit;
@Shadow
public int hurtTime;
@Shadow
public float prevHealth;
@Shadow
protected float lastDamage;
@Shadow
public int maxHurtResistantTime;
@Shadow
public float limbSwingAmount;
@Shadow
protected abstract float getSoundPitch();
@Shadow
protected abstract float getSoundVolume();
@Shadow
protected abstract String getHurtSound();
@Shadow
public abstract void onDeath(DamageSource p_70645_1_);
@Shadow
protected abstract String getDeathSound();
@Shadow
public abstract float getHealth();
@Shadow
public abstract void knockBack(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_);
@Shadow
public abstract void setRevengeTarget(EntityLivingBase p_70604_1_);
@Shadow
protected abstract void damageEntity(DamageSource p_70665_1_, float p_70665_2_);
@Shadow
public abstract ItemStack getEquipmentInSlot(int p_71124_1_);
@Shadow
public abstract boolean isPotionActive(int p_82165_1_);
@Shadow
public abstract boolean isPotionActive(Potion p_70644_1_);
public MixinEntityLivingBase(World world) {
super(world);
}
/**
* @author Shinare
* @reason Adding Nex fire damage modifiers
*/
@Overwrite
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
System.out.println(this.getCommandSenderName() + " received " + p_70097_2_ + " damage");
if (ForgeHooks.onLivingAttack((EntityLivingBase)(Object)this, p_70097_1_, p_70097_2_)) return false;
if (this.isEntityInvulnerable()) {
return false;
} else if (this.worldObj.isRemote) {
return false;
} else {
this.entityAge = 0;
if (this.getHealth() <= 0.0F) {
return false;
} else if (p_70097_1_.isFireDamage()) {
if ((EntityLivingBase)(Object)this instanceof Nex || (EntityLivingBase)(Object)this instanceof NexMiniboss) return false;
boolean fire_phase = Nex.is_nex_fire_phase_nearby((EntityLivingBase)(Object)this);
if (this.isPotionActive(Potion.fireResistance)) {
if (!fire_phase) return false;
p_70097_2_ *= 0.5F;
}
if (fire_phase) {
p_70097_2_ *= 3.0F;
List<EntityLivingBase> list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(5, 5, 5));
for (EntityLivingBase entity : list) {
if (!(entity instanceof Nex || entity instanceof NexMiniboss)) {
entity.setFire(10);
}
}
}
}
if ((p_70097_1_ == DamageSource.anvil || p_70097_1_ == DamageSource.fallingBlock) && this.getEquipmentInSlot(4) != null) {
this.getEquipmentInSlot(4).damageItem((int)(p_70097_2_ * 4.0F + this.rand.nextFloat() * p_70097_2_ * 2.0F), (EntityLivingBase)(Object)this);
p_70097_2_ *= 0.75F;
}
this.limbSwingAmount = 1.5F;
boolean flag = true;
if ((float)this.hurtResistantTime > (float)this.maxHurtResistantTime / 2.0F) {
if (p_70097_2_ <= this.lastDamage) {
return false;
}
this.damageEntity(p_70097_1_, p_70097_2_ - this.lastDamage);
this.lastDamage = p_70097_2_;
flag = false;
} else {
this.lastDamage = p_70097_2_;
this.prevHealth = this.getHealth();
this.hurtResistantTime = this.maxHurtResistantTime;
this.damageEntity(p_70097_1_, p_70097_2_);
this.hurtTime = this.maxHurtTime = 10;
}
this.attackedAtYaw = 0.0F;
Entity entity = p_70097_1_.getEntity();
if (entity != null) {
if (entity instanceof EntityLivingBase) {
this.setRevengeTarget((EntityLivingBase)entity);
}
if (entity instanceof EntityPlayer) {
this.recentlyHit = 100;
this.attackingPlayer = (EntityPlayer)entity;
} else if (entity instanceof net.minecraft.entity.passive.EntityTameable) {
net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity;
if (entitywolf.isTamed()) {
this.recentlyHit = 100;
this.attackingPlayer = null;
}
}
}
if (flag) {
this.worldObj.setEntityState(this, (byte)2);
if (p_70097_1_ != DamageSource.drown) {
this.setBeenAttacked();
}
if (entity != null) {
double d1 = entity.posX - this.posX;
double d0;
for (d0 = entity.posZ - this.posZ; d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) {
d1 = (Math.random() - Math.random()) * 0.01D;
}
this.attackedAtYaw = (float)(Math.atan2(d0, d1) * 180.0D / Math.PI) - this.rotationYaw;
this.knockBack(entity, p_70097_2_, d1, d0);
} else {
this.attackedAtYaw = (float)((int)(Math.random() * 2.0D) * 180);
}
}
String s;
if (this.getHealth() <= 0.0F) {
s = this.getDeathSound();
if (flag && s != null) {
this.playSound(s, this.getSoundVolume(), this.getSoundPitch());
}
this.onDeath(p_70097_1_);
} else {
s = this.getHurtSound();
if (flag && s != null) {
this.playSound(s, this.getSoundVolume(), this.getSoundPitch());
}
}
return true;
}
}
public void onStruckByLightning(EntityLightningBolt lightning) {
super.onStruckByLightning(lightning);
System.out.println(this.getCommandSenderName() + " was struck by lightning!");
}
}

@ -1,39 +0,0 @@
package com.zivilon.cinder_loe.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@Mixin(ItemBlock.class)
public abstract class MixinItemBlock {
@Shadow
public final Block field_150939_a;
public MixinItemBlock(Block block) {
this.field_150939_a = block;
}
@Overwrite(remap = false)
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
System.out.println("Placing block with metadata " + metadata);
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
return false;
}
if (world.getBlock(x, y, z) == field_150939_a) {
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
}
return true;
}
}

@ -1,11 +1,14 @@
package com.zivilon.cinder_loe.mixins;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.CinderLoE_Config;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cinder_loe.CinderLoE_Config;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@ -62,13 +65,26 @@ public abstract class MixinItemRenderer {
@Shadow
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
@Shadow
private ItemStack itemToRender;
@Shadow
private float equippedProgress;
@Shadow
private float prevEquippedProgress;
@Shadow
private RenderBlocks renderBlocksIr;
@Shadow
private Minecraft mc;
/**
* Reimplements the default behavior of the renderItem method.
*
* @author Shinare
* @reason Added support for semi-transparent item textures
* @param p_78443_1_ Don't ask me it's default parameter
* @param p_78443_2_ Don't ask me it's default parameter
* @param type Don't ask me it's default parameter
*/
@Overwrite(remap = false)
public void renderItem(EntityLivingBase p_78443_1_, ItemStack p_78443_2_, int p_78443_3_, ItemRenderType type) {
GL11.glPushMatrix();
@ -256,20 +272,29 @@ public abstract class MixinItemRenderer {
if (!enchant) GL11.glPopMatrix(); // Restore the saved OpenGL state
}
/**
* @author Shinare
* @reason Failsafe in case some @Redirect fails
*/
@Overwrite
public static void renderItemIn2D(Tessellator p_78439_0_, float p_78439_1_, float p_78439_2_, float p_78439_3_, float p_78439_4_, int p_78439_5_, int p_78439_6_, float p_78439_7_) {
// Redirect to new custom renderer. This should not be necessary but works as failsafe
RenderHelper.customRenderItemIn2D(p_78439_0_, p_78439_1_, p_78439_2_, p_78439_3_, p_78439_4_, p_78439_5_, p_78439_6_, p_78439_7_, false);
}
/* DEBUG
System.out.println("Printing stacktrace from original render method");
Utilities.writeLog("Printing stacktrace from original render method");
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
for (StackTraceElement element : stackTraceElements) {
Utilities.writeLog(element.toString());
/**
* Making recharging Nimveil not be constantly in the item change animation
*/
@Inject(method = "renderItemInFirstPerson", at = @At("HEAD"), cancellable = true)
public void inject(float f, CallbackInfo ci) {
if (itemToRender != null && itemToRender.getItem() == CinderLoE.nimveil) {
EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer;
ItemStack itemstack = entityclientplayermp.inventory.getCurrentItem();
equippedProgress = 1.0F;
prevEquippedProgress = 1.0F;
itemToRender = itemstack;
}
Utilities.writeLog("");
*/
}
}

@ -47,10 +47,10 @@ import net.minecraft.item.Item;
@Mixin(LOTRArmorModels.class)
public class MixinLOTRArmorModels {
@Shadow
@Shadow(remap = false)
private Map<ModelBiped, Map<Item, ModelBiped>> specialArmorModels;
@Shadow
@Shadow(remap = false)
public void copyModelRotations(ModelBiped target, ModelBiped src) {
}

@ -0,0 +1,15 @@
package com.zivilon.cinder_loe.mixins;
import lotr.common.recipe.LOTRBrewingRecipes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import net.minecraft.item.ItemStack;
@Mixin(LOTRBrewingRecipes.class)
public interface MixinLOTRBrewingRecipes {
@Invoker(value = "addBrewingRecipe", remap = false)
static void addRecipe(ItemStack result, Object... ingredients) {
throw new UnsupportedOperationException(); // This is just to satisfy the compiler; it won't be used.
}
}

@ -18,9 +18,13 @@ import net.minecraft.util.ResourceLocation;
@Mixin(LOTRClientProxy.class)
public abstract class MixinLOTRClientProxy {
@Shadow
@Shadow(remap = false)
public static final ResourceLocation enchantmentTexture = new ResourceLocation("textures/misc/enchanted_item_glint.png");
/**
* @author Shinare
* @reason Added support for semi-transparent item textures
*/
@Overwrite(remap = false)
public static void renderEnchantmentEffect() {
Tessellator tessellator = Tessellator.instance;

@ -0,0 +1,35 @@
package com.zivilon.cinder_loe.mixins;
import com.zivilon.cinder_loe.potion.LoEPotions; // Needs to be implemented
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.entity.ai.LOTREntityAINearestAttackableTargetBasic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.ai.EntityAITarget;
import net.minecraft.entity.player.EntityPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(LOTREntityAINearestAttackableTargetBasic.class)
public abstract class MixinLOTREntityAINearestAttackableTargetBasic extends EntityAITarget {
public MixinLOTREntityAINearestAttackableTargetBasic(EntityCreature p_i1669_1_, boolean p_i1669_2_) {
super(p_i1669_1_, p_i1669_2_);
}
/**
* @author Shinare
* @reason Added corrupting potion effect that makes all NPCs hostile
*/
@Overwrite(remap = false)
protected boolean isPlayerSuitableAlignmentTarget(EntityPlayer entityplayer) {
float alignment = LOTRLevelData.getData(entityplayer).getAlignment(LOTRMod.getNPCFaction((Entity)this.taskOwner));
if (entityplayer == null || LoEPotions.corrupting == null) return alignment < 0.0F;
boolean corrupting = entityplayer.isPotionActive(LoEPotions.corrupting); // Needs to be implemented
return (alignment < 0.0F || corrupting);
}
}

@ -0,0 +1,259 @@
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 lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.entity.projectile.LOTREntityProjectileBase;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
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.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
@Mixin(LOTREntityProjectileBase.class)
public abstract class MixinLOTREntityProjectileBase extends Entity {
public MixinLOTREntityProjectileBase(World world) {
super(world);
}
@Shadow(remap = false)
public abstract void setIsCritical(boolean p_70243_1_);
@Shadow(remap = false)
public abstract boolean getIsCritical();
@Shadow(remap = false)
public abstract float getSpeedReduction();
@Shadow(remap = false)
public abstract String getImpactSound();
@Shadow(remap = false)
protected abstract void onCollideWithTarget(Entity entity);
@Shadow(remap = false)
protected abstract float getKnockbackFactor();
@Shadow(remap = false)
public abstract ItemStack getProjectileItem();
@Shadow(remap = false)
public abstract DamageSource getDamageSource();
@Shadow(remap = false)
public abstract int maxTicksInGround();
@Shadow(remap = false)
public abstract float getBaseImpactDamage(Entity paramEntity, ItemStack paramItemStack);
@Shadow(remap = false)
private int xTile = -1;
@Shadow(remap = false)
private int yTile = -1;
@Shadow(remap = false)
private int zTile = -1;
@Shadow(remap = false)
private Block inTile;
@Shadow(remap = false)
private int inData;
@Shadow(remap = false)
private boolean inGround;
@Shadow(remap = false)
public int shake;
@Shadow(remap = false)
public Entity shootingEntity;
@Shadow(remap = false)
private int ticksInGround;
@Shadow(remap = false)
private int ticksInAir;
@Shadow(remap = false)
private int knockbackStrength;
/**
* @author Shinare
* @reason Having full knockbackResistance attribute now negates bonus knockback as well
*/
@Overwrite(remap = false)
public void func_70071_h_() {
super.onUpdate();
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, f) * 180.0D / Math.PI);
}
Block block = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
if (block != Blocks.air) {
block.setBlockBoundsBasedOnState((IBlockAccess)this.worldObj, this.xTile, this.yTile, this.zTile);
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
this.inGround = true;
}
if (this.shake > 0)
this.shake--;
if (this.inGround) {
Block j = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
if (j == this.inTile && k == this.inData) {
this.ticksInGround++;
if (this.ticksInGround >= maxTicksInGround())
setDead();
} else {
this.inGround = false;
this.motionX *= (this.rand.nextFloat() * 0.2F);
this.motionY *= (this.rand.nextFloat() * 0.2F);
this.motionZ *= (this.rand.nextFloat() * 0.2F);
this.ticksInGround = 0;
this.ticksInAir = 0;
}
} else {
this.ticksInAir++;
Vec3 vec3d = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3d1 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3d, vec3d1, false, true, false);
vec3d = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3d1 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
vec3d1 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
Entity entity = null;
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d = 0.0D;
int l;
for (l = 0; l < list.size(); l++) {
Entity entity1 = list.get(l);
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
float f5 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f5, f5, f5);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3d, vec3d1);
if (movingobjectposition1 != null) {
double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);
if (d1 < d || d == 0.0D) {
entity = entity1;
d = d1;
}
}
}
}
if (entity != null)
movingobjectposition = new MovingObjectPosition(entity);
if (movingobjectposition != 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;
}
if (movingobjectposition != null) {
Entity hitEntity = movingobjectposition.entityHit;
if (hitEntity != null) {
ItemStack itemstack = getProjectileItem();
int damageInt = MathHelper.ceiling_double_int(getBaseImpactDamage(hitEntity, itemstack));
int fireAspect = 0;
if (itemstack != null)
if (this.shootingEntity instanceof EntityLivingBase && hitEntity instanceof EntityLivingBase) {
this.knockbackStrength += EnchantmentHelper.getKnockbackModifier((EntityLivingBase)this.shootingEntity, (EntityLivingBase)hitEntity);
} else {
this.knockbackStrength += LOTRWeaponStats.getTotalKnockback(itemstack);
}
if (getIsCritical())
damageInt += this.rand.nextInt(damageInt / 2 + 2);
double[] prevMotion = { hitEntity.motionX, hitEntity.motionY, hitEntity.motionZ };
DamageSource damagesource = getDamageSource();
if (hitEntity.attackEntityFrom(damagesource, damageInt)) {
double[] newMotion = { hitEntity.motionX, hitEntity.motionY, hitEntity.motionZ };
float kbf = getKnockbackFactor();
hitEntity.motionX = prevMotion[0] + (newMotion[0] - prevMotion[0]) * kbf;
hitEntity.motionY = prevMotion[1] + (newMotion[1] - prevMotion[1]) * kbf;
hitEntity.motionZ = prevMotion[2] + (newMotion[2] - prevMotion[2]) * kbf;
if (isBurning())
hitEntity.setFire(5);
if (hitEntity instanceof EntityLivingBase) {
EntityLivingBase hitEntityLiving = (EntityLivingBase)hitEntity;
double knockback_resistance = hitEntityLiving.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
if (this.knockbackStrength > 0 && knockback_resistance < 1.0D) {
float knockback = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (knockback > 0.0F)
hitEntityLiving.addVelocity(this.motionX * this.knockbackStrength * 0.6D / knockback, 0.1D, this.motionZ * this.knockbackStrength * 0.6D / knockback);
}
if (fireAspect > 0)
hitEntityLiving.setFire(fireAspect * 4);
if (this.shootingEntity instanceof EntityLivingBase) {
EnchantmentHelper.func_151384_a(hitEntityLiving, this.shootingEntity);
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, (Entity)hitEntityLiving);
}
if (this.shootingEntity instanceof EntityPlayerMP && hitEntityLiving instanceof EntityPlayer)
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket((Packet)new S2BPacketChangeGameState(6, 0.0F));
}
this.worldObj.playSoundAtEntity(this, getImpactSound(), 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
onCollideWithTarget(hitEntity);
} else {
this.motionX *= -0.1D;
this.motionY *= -0.1D;
this.motionZ *= -0.1D;
this.rotationYaw += 180.0F;
this.prevRotationYaw += 180.0F;
this.ticksInAir = 0;
}
} else {
this.xTile = movingobjectposition.blockX;
this.yTile = movingobjectposition.blockY;
this.zTile = movingobjectposition.blockZ;
this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
this.motionX = (float)(movingobjectposition.hitVec.xCoord - this.posX);
this.motionY = (float)(movingobjectposition.hitVec.yCoord - this.posY);
this.motionZ = (float)(movingobjectposition.hitVec.zCoord - this.posZ);
float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.posX -= this.motionX / f2 * 0.05D;
this.posY -= this.motionY / f2 * 0.05D;
this.posZ -= this.motionZ / f2 * 0.05D;
this.worldObj.playSoundAtEntity(this, getImpactSound(), 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.shake = 7;
setIsCritical(false);
if (this.inTile.getMaterial() != Material.air)
this.inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);
}
}
if (getIsCritical())
for (l = 0; l < 4; l++)
this.worldObj.spawnParticle("crit", this.posX + this.motionX * l / 4.0D, this.posY + this.motionY * l / 4.0D, this.posZ + this.motionZ * l / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ);
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
for (this.rotationPitch = (float)(Math.atan2(this.motionY, f3) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F);
for (; this.rotationPitch - this.prevRotationPitch >= 180.0F; this.prevRotationPitch += 360.0F);
for (; this.rotationYaw - this.prevRotationYaw < -180.0F; this.prevRotationYaw -= 360.0F);
for (; this.rotationYaw - this.prevRotationYaw >= 180.0F; this.prevRotationYaw += 360.0F);
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
float f4 = getSpeedReduction();
if (isInWater()) {
for (int k1 = 0; k1 < 4; k1++) {
float f7 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f7, this.posY - this.motionY * f7, this.posZ - this.motionZ * f7, this.motionX, this.motionY, this.motionZ);
}
f4 = 0.8F;
}
this.motionX *= f4;
this.motionY *= f4;
this.motionZ *= f4;
this.motionY -= 0.05000000074505806D;
setPosition(this.posX, this.posY, this.posZ);
func_145775_I();
}
}
}

@ -11,21 +11,25 @@ import java.util.List;
@Mixin(LOTRIntCache.class)
public abstract class MixinLOTRIntCache {
@Shadow
@Shadow(remap = false)
private static LOTRIntCache SERVER;
@Shadow
@Shadow(remap = false)
private static LOTRIntCache CLIENT;
@Shadow
@Shadow(remap = false)
private int intCacheSize = 256;
@Shadow
@Shadow(remap = false)
private List<int[]> freeSmallArrays;
@Shadow
@Shadow(remap = false)
private List<int[]> inUseSmallArrays;
@Shadow
@Shadow(remap = false)
private List<int[]> freeLargeArrays;
@Shadow
@Shadow(remap = false)
private List<int[]> inUseLargeArrays;
/**
* @author Shinare
* @reason Unsuccessfully trying to patch a crash bug
*/
@Overwrite(remap = false)
public int[] getIntArray(int size) {
try {

@ -1,22 +1,28 @@
package com.zivilon.cinder_loe.mixins;
import lotr.client.LOTRItemRendererManager;
import lotr.client.render.item.LOTRRenderLargeItem;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.item.Item;
import java.lang.reflect.Field;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import com.zivilon.cinder_loe.items.Nimveil;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import lotr.client.render.item.LOTRRenderLargeItem;
import lotr.client.LOTRItemRendererManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StringUtils;
import net.minecraftforge.client.IItemRenderer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.lang.reflect.Field;
@ -48,43 +54,24 @@ import net.minecraftforge.common.MinecraftForge;
@Mixin(LOTRItemRendererManager.class)
public abstract class MixinLOTRItemRendererManager {
/* @Inject(method = "func_110549_a(Lnet/minecraft/client/resources/IResourceManager;)V",
at = @At(value = "JUMP", opcode = Opcodes.IFEQ, ordinal = 0, shift = At.Shift.BEFORE),
locals = LocalCapture.CAPTURE_FAILSOFT,
remap = false)
private void afterIsLargeSet(IResourceManager resourceManager, CallbackInfo ci, int i, Field[] fields, Field field, Item item, LOTRRenderLargeItem largeItemRenderer, boolean isLarge) {
System.out.println("\u001B[35mVerifying item in renderer manager...");
System.out.println("Name of item is " + item.getUnlocalizedName());
System.out.println("Is crossbow: " + (item instanceof lotr.common.item.LOTRItemCrossbow));
System.out.println("Is bow: " + (item instanceof lotr.common.item.LOTRItemBow));
System.out.println("Is sword: " + (item instanceof lotr.common.item.LOTRItemSword));
System.out.println("Is large: " + isLarge);
}*/
@Shadow
@Shadow(remap = false)
private static List<LOTRRenderLargeItem> largeItemRenderers;
@Overwrite
public void onResourceManagerReload(IResourceManager resourceManager) {
/**
* @author Shinare
* @reason testing
*/
@Overwrite(remap = false)
public void func_110549_a(IResourceManager resourceManager) {
largeItemRenderers.clear();
try {
for (Field field : LOTRMod.class.getFields()) {
System.out.println("Found field " + field.getName() + " of type " + field.getType().getName());
if (field.getName().equals("spearRedDwarf")) {
System.out.println("Found spearRedDwarf");
System.out.println("Is type Item: " + (field.get(null) instanceof Item));
}
if (field.get(null) instanceof Item) {
Item item = (Item)field.get(null);
if (item instanceof Nimveil) System.out.println("Processing Nimveil!");
MinecraftForgeClient.registerItemRenderer(item, null);
LOTRRenderLargeItem largeItemRenderer = LOTRRenderLargeItem.getRendererIfLarge(item);
boolean isLarge = (largeItemRenderer != null);
System.out.println("\u001B[35mVerifying item in renderer manager...");
System.out.println("Name of item is " + item.getUnlocalizedName());
System.out.println("Is crossbow: " + (item instanceof lotr.common.item.LOTRItemCrossbow));
System.out.println("Is bow: " + (item instanceof lotr.common.item.LOTRItemBow));
System.out.println("Is sword: " + (item instanceof lotr.common.item.LOTRItemSword));
System.out.println("Is large: " + isLarge);
if (item instanceof lotr.common.item.LOTRItemCrossbow) {
MinecraftForgeClient.registerItemRenderer(item, (IItemRenderer)new LOTRRenderCrossbow());
} else if (item instanceof lotr.common.item.LOTRItemBow) {
@ -95,11 +82,15 @@ public abstract class MixinLOTRItemRendererManager {
d = 40.0D;
MinecraftForgeClient.registerItemRenderer(item, (IItemRenderer)new LOTRRenderElvenBlade(d, largeItemRenderer));
} else if (isLarge) {
if (item instanceof Nimveil) System.out.println("Nimveil is large!");
MinecraftForgeClient.registerItemRenderer(item, (IItemRenderer)largeItemRenderer);
}
if (largeItemRenderer != null)
if (largeItemRenderer != null) {
if (item instanceof Nimveil) System.out.println("Adding Nimveil large renderer!");
largeItemRenderers.add(largeItemRenderer);
}
if (item instanceof Nimveil) System.out.println("Nimveil processing ending!");
}
}
} catch (Exception e) {
e.printStackTrace();

@ -29,24 +29,28 @@ import net.minecraftforge.client.ForgeHooksClient;
@Mixin(LOTRRenderArmorStand.class)
public abstract class MixinLOTRRenderArmorStand extends TileEntitySpecialRenderer {
@Shadow
@Shadow(remap = false)
private static ModelBase standModel;
@Shadow
@Shadow(remap = false)
private static ResourceLocation standTexture;
@Shadow
@Shadow(remap = false)
private static ModelBiped modelBipedMain;
@Shadow
@Shadow(remap = false)
private static ModelBiped modelBiped1;
@Shadow
@Shadow(remap = false)
private static ModelBiped modelBiped2;
@Shadow
@Shadow(remap = false)
private static float BIPED_ARM_ROTATION;
@Shadow
@Shadow(remap = false)
private static float BIPED_TICKS_EXISTED;
/**
* @author Shinare
* @reason Added support configurable enchantment colour
*/
@Overwrite(remap = false)
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
public void func_147500_a(TileEntity tileentity, double d, double d1, double d2, float f) {
LOTRTileEntityArmorStand armorStand = (LOTRTileEntityArmorStand)tileentity;
FakeArmorStandEntity fakeArmorStandEntity = FakeArmorStandEntity.INSTANCE;
GL11.glPushMatrix();

@ -1,21 +1,200 @@
package com.zivilon.cinder_loe.mixins;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import com.zivilon.cinder_loe.items.Nimveil;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import lotr.client.render.item.LOTRRenderLargeItem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.resources.IResource;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraftforge.client.IItemRenderer;
import java.io.IOException;
import java.util.Map;
@Mixin(LOTRRenderLargeItem.class)
public abstract class MixinLOTRRenderLargeItem {
private static IIcon[] nimveil_icons;
@Shadow(remap = false)
private Item theItem;
@Shadow(remap = false)
private IIcon largeIcon;
@Shadow(remap = false)
private String folderName;
@Shadow(remap = false)
private static Map<String, Float> sizeFolders;
@Shadow(remap = false)
private static ResourceLocation getLargeTexturePath(Item item, String folder) {
return null;
};
/**
* @author Shinare
* @reason Added support for transparent textures
*/
@Redirect(method = "renderLargeItem(Lnet/minecraft/util/IIcon;)V", remap = false,
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ItemRenderer;func_78439_a(Lnet/minecraft/client/renderer/Tessellator;FFFFIIF)V"))
private void onRenderItemIn2D(Tessellator tessellator, float f1, float f2, float f, float f3, int width, int height, float thickness) {
RenderHelper.customRenderItemIn2D(tessellator, f1, f2, f, f3, width, height, thickness, false);
}
/*
@Inject(method = "registerLargeIcon", at = @At("HEAD"), cancellable = true, remap = false)
public void temp(IIconRegister register, String extra, CallbackInfoReturnable<IIcon> ci) {
System.out.println("Registering icon with folder " + this.folderName);
}*/
/**
* @author Shinare
* @reason Added support for NBT based subtyping for Nimveil
*/
@Overwrite(remap = false)
private IIcon registerLargeIcon(IIconRegister register, String extra) {
String prefix = "lotr:";
if (this.theItem instanceof Nimveil) {
String itemName = "lotr:nimveil";
itemName = itemName.substring(itemName.indexOf(prefix) + prefix.length());
String path = prefix + this.folderName + "/" + itemName;
nimveil_icons = new IIcon[10];
nimveil_icons[0] = register.registerIcon(path + "_valar");
nimveil_icons[1] = register.registerIcon(path + "_mortals");
nimveil_icons[2] = register.registerIcon(path + "_udun");
nimveil_icons[3] = register.registerIcon(path + "_sauron");
nimveil_icons[4] = register.registerIcon(path + "_ancient");
nimveil_icons[5] = register.registerIcon(path + "_valar_glow");
nimveil_icons[6] = register.registerIcon(path + "_mortals_glow");
nimveil_icons[7] = register.registerIcon(path + "_udun_glow");
nimveil_icons[8] = register.registerIcon(path + "_sauron_glow");
nimveil_icons[9] = register.registerIcon(path + "_ancient_glow");
System.out.println("Registering large icon for " + this.theItem.getClass().getSimpleName() + " at " + path);
return nimveil_icons[0];
} else {
String itemName = this.theItem.getUnlocalizedName();
itemName = itemName.substring(itemName.indexOf(prefix) + prefix.length());
String path = prefix + this.folderName + "/" + itemName;
if (!StringUtils.isNullOrEmpty(extra))
path = path + "_" + extra;
System.out.println("Registering large icon for " + this.theItem.getClass().getSimpleName() + " at " + path);
return register.registerIcon(path);
}
}
/**
* @author Shinare
* @reason Added support for NBT based subtyping for Nimveil
*/
@Overwrite(remap = false)
public static LOTRRenderLargeItem getRendererIfLarge(Item item) {
if (item instanceof Nimveil)
return new LOTRRenderLargeItem(item, "large", 2.0F);
for (String folder : sizeFolders.keySet()) {
float iconScale = ((Float)sizeFolders.get(folder)).floatValue();
try {
ResourceLocation resLoc = getLargeTexturePath(item, folder);
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resLoc);
if (res != null)
return new LOTRRenderLargeItem(item, folder, iconScale);
} catch (IOException iOException) {}
}
return null;
}
/**
* @author Shinare
* @reason Added support for NBT based subtyping for Nimveil
*/
@Inject(method = "renderItem",
at = @At(value = "HEAD"),
cancellable = true, remap = false)
public void getNimveilIcon(IItemRenderer.ItemRenderType type, ItemStack itemstack, Object[] data, CallbackInfo ci) {
if (itemstack.getItem() instanceof Nimveil) {
int icon_index = 0;
if (Nimveil.get_state(itemstack) != 0)
icon_index += 5;
switch(Nimveil.get_variant(itemstack)) {
case "valar":
break;
case "mortals":
icon_index += 1;
break;
case "udun":
icon_index += 2;
break;
case "sauron":
icon_index += 3;
break;
case "ancient":
icon_index += 4;
break;
default:
this.largeIcon = nimveil_icons[0];
break;
}
this.largeIcon = nimveil_icons[icon_index];
}
}
}
/*
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack itemstack, Object... data) {
GL11.glPushMatrix();
Entity holder = (Entity)data[1];
boolean isFirstPerson = (holder == (Minecraft.getMinecraft()).thePlayer && (Minecraft.getMinecraft()).gameSettings.thirdPersonView == 0);
Item item = itemstack.getItem();
if (item instanceof lotr.common.item.LOTRItemSpear && holder instanceof EntityPlayer && ((EntityPlayer)holder).getItemInUse() == itemstack) {
GL11.glRotatef(260.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
}
if (item instanceof lotr.common.item.LOTRItemPike && holder instanceof EntityLivingBase) {
EntityLivingBase entityliving = (EntityLivingBase)holder;
if (entityliving.getHeldItem() == itemstack && entityliving.swingProgress <= 0.0F)
if (entityliving.isSneaking()) {
if (isFirstPerson) {
GL11.glRotatef(270.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
} else {
GL11.glTranslatef(0.0F, -0.1F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}
} else if (!isFirstPerson) {
GL11.glTranslatef(0.0F, -0.3F, 0.0F);
GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
}
}
if (item instanceof lotr.common.item.LOTRItemLance && holder instanceof EntityLivingBase) {
EntityLivingBase entityliving = (EntityLivingBase)holder;
if (entityliving.getHeldItem() == itemstack)
if (isFirstPerson) {
GL11.glRotatef(260.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
} else {
GL11.glTranslatef(0.7F, 0.0F, 0.0F);
GL11.glRotatef(-30.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
}
}
renderLargeItem();
if (itemstack != null && itemstack.hasEffect(0))
LOTRClientProxy.renderEnchantmentEffect();
GL11.glPopMatrix();
}*/

@ -38,13 +38,12 @@ public abstract class MixinLOTRTileEntityDwarvenForge {
protected boolean isCoal(ItemStack itemstack) {
return (itemstack.getItem() == Items.coal);
}
@Unique
protected boolean cinderLoE_Git$isMithril(ItemStack itemstack) {
protected boolean isMithril(ItemStack itemstack) {
return itemstack.getItem() == Item.getItemFromBlock(LOTRMod.oreMithril) || itemstack.getItem() == LOTRMod.mithril;
}
@Unique
protected boolean cinderLoE_Git$isCoalBlock(ItemStack itemstack) {
protected boolean isCoalBlock(ItemStack itemstack) {
return itemstack.getItem() == Item.getItemFromBlock(Blocks.coal_block);
}
@ -52,6 +51,10 @@ public abstract class MixinLOTRTileEntityDwarvenForge {
return (itemstack.getItem() == Items.gold_nugget);
}
/**
* @author Shinare
* @reason Added recipe for CinderLoE.ingotAsh and CinderLoE.redDwarfSteel
*/
@Overwrite(remap = false)
protected ItemStack getAlloySmeltingResult(ItemStack itemstack, ItemStack alloyItem) {
if (isIron(itemstack) && isCoal(alloyItem))
@ -64,7 +67,7 @@ public abstract class MixinLOTRTileEntityDwarvenForge {
return new ItemStack(CinderLoE.redDwarfSteel);
if ((isCopper(itemstack) && isTin(alloyItem)) || (isTin(itemstack) && isCopper(alloyItem)))
return new ItemStack(LOTRMod.bronze, 2);
if (this.cinderLoE_Git$isMithril(itemstack) && this.cinderLoE_Git$isCoalBlock(alloyItem))
if (this.isMithril(itemstack) && this.isCoalBlock(alloyItem))
return new ItemStack(CinderLoE.ingotAsh, 1);
return null;
}

@ -9,6 +9,6 @@ import lotr.common.LOTRFoods;
@Mixin(LOTRTradeEntries.class)
public interface MixinLOTRTradeEntries {
@Invoker("setVessels")
@Invoker(value = "setVessels", remap = false)
public abstract LOTRTradeEntries vessels(LOTRFoods foods);
}

@ -15,12 +15,16 @@ import com.zivilon.cinder_loe.CinderLoE;
@Mixin(LOTRWorldGenMumakSkeleton.class)
public class MixinLOTRWorldGenMumakSkeleton {
@Shadow
@Shadow(remap = false)
protected Block boneBlock;
@Shadow
@Shadow(remap = false)
protected int boneMeta;
/**
* @author Shinare
* @reason Replaces bone blocks with ivory blocks to make these structures unique
*/
@Overwrite(remap = false)
protected void setupRandomBlocks(Random random) {
this.boneBlock = CinderLoE.ivoryBlock;

@ -57,17 +57,17 @@ public abstract class MixinRenderItem extends Render {
@Shadow
public static boolean renderInFrame;
@Shadow
@Shadow(remap = false)
public byte getMiniBlockCount(ItemStack stack, byte original) {
return 0;
}
@Shadow
@Shadow(remap = false)
public byte getMiniItemCount(ItemStack stack, byte original) {
return 0;
}
@Shadow
@Shadow(remap = false)
public boolean shouldSpreadItems() {
return false;
}
@ -75,6 +75,20 @@ public abstract class MixinRenderItem extends Render {
@Shadow
private void renderGlint(int p_77018_1_, int p_77018_2_, int p_77018_3_, int p_77018_4_, int p_77018_5_) {}
/**
* Reimplements the default behavior of the renderDroppedItem method.
*
* @author Shinare
* @reason Added support for semi-transparent item textures
* @param p_77020_1_ Don't ask me it's default parameter
* @param p_77020_2_ Don't ask me it's default parameter
* @param p_77020_3_ Don't ask me it's default parameter
* @param p_77020_4_ Don't ask me it's default parameter
* @param p_77020_5_ Don't ask me it's default parameter
* @param p_77020_6_ Don't ask me it's default parameter
* @param p_77020_7_ Don't ask me it's default parameter
* @param pass Don't ask me it's default parameter
*/
@Overwrite(remap = false)
private void renderDroppedItem(EntityItem p_77020_1_, IIcon p_77020_2_, int p_77020_3_, float p_77020_4_, float p_77020_5_, float p_77020_6_, float p_77020_7_, int pass) {
Tessellator tessellator = Tessellator.instance;
@ -209,6 +223,10 @@ public abstract class MixinRenderItem extends Render {
}
}
/**
* @author Shinare
* @reason Added support for semi-transparent item textures
*/
@Overwrite(remap = false)
public void renderEffect(TextureManager manager, int x, int y) {
GL11.glDepthFunc(GL11.GL_EQUAL);

@ -85,6 +85,10 @@ public abstract class MixinRendererLivingEntity extends Render {
return 0.0F;
}
/**
* @author Shinare
* @reason Added support for configurable enchantment colour
*/
@Overwrite
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{

@ -30,6 +30,11 @@ public abstract class MixinSlotCrafting {
craftMatrix = null;
}
/**
* @author Shinare
* @reason Added support for crafting with item durability. To register items for durability crafting, refer to com.zivilon.cinder_loe.util.DurableItemCrafter
*/
@Overwrite
public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) {
FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, craftMatrix);

@ -46,11 +46,11 @@ public abstract class MixinLOTRItemEntDraught {
/**
* @author
* @reason
* @author KeyLime17
* @reason ???
*/
@Overwrite
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
@Overwrite(remap = false)
public ItemStack func_77654_b(ItemStack itemstack, World world, EntityPlayer entityplayer) {
final Random rand = new Random();
int chance = rand.nextInt(100);
@ -83,11 +83,11 @@ public abstract class MixinLOTRItemEntDraught {
}
/**
* @author
* @reason
* @author KeyLime17
* @reason ???
*/
@Overwrite
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float f, float f1, float f2) {
@Overwrite(remap = false)
public boolean func_77648_a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float f, float f1, float f2) {
if (this.getDraughtInfo((ItemStack)itemstack).name.equals("gold")) {
if (LOTRLevelData.getData(entityplayer).getAlignment(LOTRFaction.FANGORN) < 500.0f) {
if (!world.isRemote) {

@ -0,0 +1,28 @@
package com.zivilon.cinder_loe.potion;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.entity.EntityLivingBase;
public class LoEPotions {
public static Potion corrupting;
public static void registerPotions() {
corrupting = new PotionCorrupting(31, false, 0x7F0000).setPotionName("potion.corrupting");
}
}
class PotionCorrupting extends Potion {
public PotionCorrupting(int id, boolean isBadEffect, int liquidColor) {
super(id, isBadEffect, liquidColor);
}
@Override
public void performEffect(EntityLivingBase entity, int amplifier) {
}
@Override
public boolean isReady(int duration, int amplifier) {
return false;
}
}

@ -0,0 +1,57 @@
package com.zivilon.cinder_loe.recipe;
import net.minecraft.item.ItemStack;
public class ForgingRecipe {
public boolean isBlessed;
public ItemStack leftInput;
public ItemStack middleInput;
public ItemStack rightInput;
public ItemStack output;
public ForgingRecipe(ItemStack leftInput, ItemStack middleInput, ItemStack rightInput, ItemStack output, boolean isBlessed) {
this.leftInput = leftInput;
this.middleInput = middleInput;
this.rightInput = rightInput;
this.output = output;
this.isBlessed = isBlessed;
}
public boolean matches(ItemStack left, ItemStack middle, ItemStack right, boolean isBlessedHammer) {
if (this.isBlessed && !isBlessedHammer) {
return false;
}
return matchesItem(leftInput, left) &&
matchesItem(middleInput, middle) &&
matchesItem(rightInput, right);
}
public boolean matchesItem(ItemStack recipeInput, ItemStack stationInput) {
if (recipeInput == null && stationInput == null) {
return true;
}
if (recipeInput == null || stationInput == null) {
return false;
}
return recipeInput.getItem() == stationInput.getItem() &&
recipeInput.getItemDamage() == stationInput.getItemDamage();
}
public ItemStack getOutput() {
return output.copy();
}
public static String getSafeName(ItemStack stack) {
if (stack == null) return "null";
return stack.getUnlocalizedName();
}
public static void printRecipeDetails(ForgingRecipe recipe) {
System.out.println("Left: " + getSafeName(recipe.leftInput));
System.out.println("Middle: " + getSafeName(recipe.middleInput));
System.out.println("Right: " + getSafeName(recipe.rightInput));
}
}

@ -0,0 +1,85 @@
package com.zivilon.cinder_loe.recipe;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.items.Nimveil;
import com.zivilon.cinder_loe.util.Utilities;
import lotr.common.enchant.LOTREnchantment;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class ForgingRecipes {
public static List<ForgingRecipe> recipes = new ArrayList();
public static void register_recipe(ForgingRecipe recipe) {
recipes.add(recipe);
}
public static void register_recipes() {
register_recipe(new ForgingRecipe(
new ItemStack(CinderLoE.nimveilPart, 1, 2),
new ItemStack(CinderLoE.nimveilPart, 1, 1),
new ItemStack(CinderLoE.nimveilPart, 1, 0),
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "valar"),
true
));
register_recipe(new ForgingRecipe(
new ItemStack(CinderLoE.nimveilPart, 1, 3),
new ItemStack(CinderLoE.nimveilPart, 1, 1),
new ItemStack(CinderLoE.nimveilPart, 1, 0),
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "mortals"),
true
));
register_recipe(new ForgingRecipe(
new ItemStack(CinderLoE.nimveilPart, 1, 4),
new ItemStack(CinderLoE.nimveilPart, 1, 1),
new ItemStack(CinderLoE.nimveilPart, 1, 0),
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "udun"),
true
));
register_recipe(new ForgingRecipe(
new ItemStack(CinderLoE.nimveilPart, 1, 5),
new ItemStack(CinderLoE.nimveilPart, 1, 1),
new ItemStack(CinderLoE.nimveilPart, 1, 0),
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "sauron"),
true
));
register_recipe(new ForgingRecipe(
new ItemStack(CinderLoE.nimveilPart, 1, 6),
new ItemStack(CinderLoE.nimveilPart, 1, 1),
new ItemStack(CinderLoE.nimveilPart, 1, 0),
Nimveil.init_variant(new ItemStack(CinderLoE.nimveil, 1), "ancient"),
true
));
register_recipe(new ForgingRecipe(
null,
new ItemStack(CinderLoE.nimveil, 1),
null,
new ItemStack(CinderLoE.nimveilPart, 1, 1),
true
));
register_recipe(new ForgingRecipe(
new ItemStack(CinderLoE.weaponPart, 1, 0),
new ItemStack(CinderLoE.weaponPart, 1, 1),
new ItemStack(CinderLoE.weaponPart, 1, 2),
deceiver_blade(),
false
));
}
public static ItemStack deceiver_blade() {
ItemStack blade = new ItemStack(CinderLoE.deceiverBlade, 1);
Utilities.setAppliedRandomEnchants(blade);
Utilities.setLOTREnchant(blade, LOTREnchantment.strong4);
Utilities.setLOTREnchant(blade, LOTREnchantment.meleeSpeed1);
Utilities.setLOTREnchant(blade, LOTREnchantment.meleeReach1);
return blade;
}
public static List<ForgingRecipe> getAllRecipes() {
return recipes;
}
}

@ -6,6 +6,7 @@ import lotr.common.recipe.LOTRRecipePoisonWeapon;
import lotr.common.recipe.LOTRRecipes;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.recipe.*;
import com.zivilon.cinder_loe.mixins.MixinLOTRBrewingRecipes;
import lotr.common.item.LOTRItemFood;
import net.minecraft.init.Blocks;
@ -30,6 +31,8 @@ public class recipes {
registerBreeRecipes();
registerArnorRecipes();
registerAngmarRecipes();
ForgingRecipes.register_recipes();
registerBrewingRecipes();
}
public static void registerGeneralRecipes() {
@ -104,6 +107,7 @@ public class recipes {
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 11), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 11)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 12), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 12)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 13), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 13)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 14), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 14)));
OreDictionary.registerOre("vegetable1", CinderLoE.onion);
OreDictionary.registerOre("vegetable1", LOTRMod.leek);
@ -319,4 +323,7 @@ public class recipes {
LOTRRecipes.rangerRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.maceArnor), " XX", " XX", "Y ",
Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), "stickWood"));
}
public static void registerBrewingRecipes() {
MixinLOTRBrewingRecipes.addRecipe(new ItemStack(CinderLoE.mugDemonicHealthPotion, 2), new Object[] { CinderLoE.demonbloodVial, new ItemStack(LOTRMod.tallGrass, 1, 4), new ItemStack(LOTRMod.tallGrass, 1, 4), new ItemStack(LOTRMod.tallGrass, 1, 4), CinderLoE.chocolatebar, CinderLoE.chocolatebar });
}
}

@ -0,0 +1,127 @@
package com.zivilon.cinder_loe.tileentity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityForgingStation extends TileEntity {
public ItemStack leftItem;
public ItemStack middleItem;
public ItemStack rightItem;
@Override
public AxisAlignedBB getRenderBoundingBox() {
return AxisAlignedBB.getBoundingBox(
xCoord - 1, yCoord, zCoord - 1,
xCoord + 2, yCoord + 1, zCoord + 2
);
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
// Getters and Setters for the items
public ItemStack getLeftItem() {
return leftItem;
}
public void setLeftItem(ItemStack leftItem) {
this.leftItem = leftItem;
markDirty(); // Mark the tile entity as dirty to ensure the world saves the changes
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public ItemStack getMiddleItem() {
return middleItem;
}
public void setMiddleItem(ItemStack middleItem) {
this.middleItem = middleItem;
markDirty(); // Mark the tile entity as dirty to ensure the world saves the changes
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public ItemStack getRightItem() {
return rightItem;
}
public void setRightItem(ItemStack rightItem) {
this.rightItem = rightItem;
markDirty(); // Mark the tile entity as dirty to ensure the world saves the changes
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
// Method to write data to NBT
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
if (leftItem != null) {
NBTTagCompound leftTag = new NBTTagCompound();
leftItem.writeToNBT(leftTag);
compound.setTag("LeftItem", leftTag);
} else {
compound.removeTag("LeftItem");
}
if (middleItem != null) {
NBTTagCompound middleTag = new NBTTagCompound();
middleItem.writeToNBT(middleTag);
compound.setTag("MiddleItem", middleTag);
} else {
compound.removeTag("MiddleItem");
}
if (rightItem != null) {
NBTTagCompound rightTag = new NBTTagCompound();
rightItem.writeToNBT(rightTag);
compound.setTag("RightItem", rightTag);
} else {
compound.removeTag("RightItem");
}
}
// Method to read data from NBT
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
if (compound.hasKey("LeftItem")) {
NBTTagCompound leftTag = compound.getCompoundTag("LeftItem");
leftItem = ItemStack.loadItemStackFromNBT(leftTag);
} else {
leftItem = null;
}
if (compound.hasKey("MiddleItem")) {
NBTTagCompound middleTag = compound.getCompoundTag("MiddleItem");
middleItem = ItemStack.loadItemStackFromNBT(middleTag);
} else {
middleItem = null;
}
if (compound.hasKey("RightItem")) {
NBTTagCompound rightTag = compound.getCompoundTag("RightItem");
rightItem = ItemStack.loadItemStackFromNBT(rightTag);
} else {
rightItem = null;
}
}
}

@ -1,7 +0,0 @@
package com.zivilon.cinder_loe.tileentity;
import net.minecraft.tileentity.TileEntity;
public class TileEntityNexIceCrystal extends TileEntity {
// Add any data or logic specific to the tile entity here
}

@ -0,0 +1,37 @@
package com.zivilon.cinder_loe.tileentity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityShadowTile extends TileEntity {
public long spawnTime;
public static long REMOVAL_DELAY_MS = 15000;
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
if (spawnTime == 0) {
spawnTime = System.currentTimeMillis();
}
long currentTime = System.currentTimeMillis();
if (currentTime >= spawnTime + REMOVAL_DELAY_MS) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); // Force the client to update
worldObj.removeTileEntity(xCoord, yCoord, zCoord); // Clean up the tile entity
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("spawnTime", spawnTime);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
spawnTime = nbt.getLong("spawnTime");
}
}

@ -17,6 +17,10 @@ public class BlockPos {
this.z = z;
}
public BlockPos down() {
return new BlockPos(x, y - 1, z);
}
public static BlockPos findSafeSpawnLocation(World world, EntityPlayer entityPlayer) {
Random rand = new Random();
ArrayList<BlockPos> validPositions = new ArrayList<BlockPos>();

@ -10,6 +10,6 @@ import com.zivilon.cinder_loe.CinderLoE;
public class LOTREnchantmentExclusions {
public static List<Item> exclusions = new ArrayList<>();
static {
exclusions.add(CinderLoE.firstAgeGlaive);
exclusions.add(CinderLoE.celeiniss);
}
}

@ -1,7 +1,8 @@
package com.zivilon.cinder_loe.util;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import com.zivilon.cinder_loe.mixins.MixinEntity;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
@ -23,13 +24,24 @@ import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
public class Utilities {
public static int[] LOTRIntCache = null;
@ -162,6 +174,12 @@ public class Utilities {
return has_fire;
}
public static boolean has_fire_weapon(Entity entity) {
if (!(entity instanceof EntityLivingBase)) return false;
ItemStack held_item = ((EntityLivingBase)entity).getHeldItem();
return LOTREnchantmentHelper.hasEnchant(held_item, LOTREnchantment.fire);
}
public static int[] countNexArmour(String player_name) {
EntityPlayer player = getPlayerByName(player_name);
int[] nexPieces = new int[4];
@ -194,6 +212,26 @@ public class Utilities {
return nexPieces;
}
public static double calculate_melee_damage_on_entity(EntityLivingBase target, EntityLivingBase attacker) {
if (attacker == null) return 0.0D;
if (attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage) == null) return 0.0D;
double attribute = attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
double enchantments = EnchantmentHelper.getEnchantmentModifierLiving(attacker, target);
boolean is_critical = !attacker.onGround && attacker.motionY < 0.0D && !attacker.isInWater() && !attacker.isRiding();
double critical = 0.0D;
if (is_critical) {
PotionEffect strength_effect = attacker.getActivePotionEffect(Potion.damageBoost);
if (strength_effect == null) {
critical = Math.min((attribute + enchantments) * 1.5D, 7.0D);
} else {
int level = strength_effect.getAmplifier() + 1;
critical = Math.min((attribute + enchantments) * 1.5D, 7.0D * (1.0D + 0.5D * level));
}
}
return attribute + enchantments + critical;
}
public static boolean isArrayEmpty(int[] array) {
for (int value : array) {
if (value != 0) return false;
@ -201,10 +239,57 @@ public class Utilities {
return true;
}
public static void setEntityInvulnerable(EntityLiving entity, boolean invulnerable) {
NBTTagCompound nbt = new NBTTagCompound();
entity.writeToNBT(nbt);
nbt.setBoolean("Invulnerable", invulnerable);
entity.readFromNBT(nbt);
public static void setInvulnerable(Entity entity, boolean invulnerable) {
((MixinEntity)entity).setInvulnerable(invulnerable);
}
public static void setLOTREnchant(ItemStack itemstack, LOTREnchantment ench) {
NBTTagList tags = getItemEnchantTags(itemstack, true);
if (tags != null) {
String enchName = ench.enchantName;
tags.appendTag((NBTBase)new NBTTagString(enchName));
}
}
public static NBTTagList getItemEnchantTags(ItemStack itemstack, boolean create) {
NBTTagCompound itemData = itemstack.getTagCompound();
NBTTagList tags = null;
if (itemData != null && itemData.hasKey("LOTREnch")) {
tags = itemData.getTagList("LOTREnch", 8);
} else if (create) {
if (itemData == null) {
itemData = new NBTTagCompound();
itemstack.setTagCompound(itemData);
}
tags = new NBTTagList();
itemData.setTag("LOTREnch", (NBTBase)tags);
}
return tags;
}
public static void setAppliedRandomEnchants(ItemStack itemstack) {
if (!itemstack.hasTagCompound())
itemstack.setTagCompound(new NBTTagCompound());
itemstack.getTagCompound().setBoolean("LOTRRandomEnch", true);
}
public static void knockback(EntityLivingBase target, EntityLivingBase attacker, double knockback_strength) {
// Calculate direction of knockback
double dx = attacker.posX - target.posX;
double dz = attacker.posZ - target.posZ;
// Normalize the direction vector
double distance = Math.sqrt(dx * dx + dz * dz);
if (distance != 0) {
dx /= distance;
dz /= distance;
}
// Apply knockback manually
target.motionX -= dx * knockback_strength;
target.motionZ -= dz * knockback_strength;
// Ensure the motion is applied
target.velocityChanged = true;
}
}

@ -0,0 +1,11 @@
package com.zivilon.cinder_loe.util;
import com.zivilon.cinder_loe.entity.Nex;
public class VT_additions {
public static String applyCustomPlaceholders(String scriptLine) {
scriptLine = scriptLine.replace("<nexphase>", String.valueOf(Nex.get_nex_phase()));
scriptLine = scriptLine.replace("<nexhealth>", String.valueOf(Nex.get_nex_health()));
return scriptLine;
}
}

@ -19,6 +19,9 @@ tile.lotr:plaster.name=Plaster
tile.lotr:voidblock.name=Void
tile.lotr:cindercobble.0.name=Cobbled Drystone
tile.lotr:cindercobble.1.name=Cobbled Mordor Rock
tile.lotr:enchantedIce.name=Enchanted Ice
tile.lotr:iceCage.name=Ice Cage
tile.forging_station.name=Forging Station
item.lotr:spearUnnamed.name=Drannach Oriour
item.lotr:frostblade.name=Frostblade
@ -114,6 +117,7 @@ item.war_dart_gilded_iron.name=Gilded Iron Dart
item.war_dart_red_dwarven.name=Red Dwarven Dart
item.war_dart_mithril.name=Mithril Dart
item.war_dart_ancient.name=Ancient Dart
item.war_dart_morgul.name=Morgul Dart
item.war_dart_heads_headless.name=??? Dart Heads
item.war_dart_heads_copper.name=Copper Dart Heads
@ -129,6 +133,49 @@ item.war_dart_heads_gilded_iron.name=Gilded Iron Dart Heads
item.war_dart_heads_red_dwarven.name=Red Dwarven Dart Heads
item.war_dart_heads_mithril.name=Mithril Dart Heads
item.war_dart_heads_ancient.name=Ancient Dart Heads
item.war_dart_heads_morgul.name=Morgul Dart Heads
item.lotr.toxicCore.name=Toxic Core
item.lotr:celeiniss.name=Celeiniss
lotr:nimveil.name=Nimveil
item.nimveil_gem.name=Nimveil Gem
item.nimveil_blade.name=Nimveil Blade
item.nimveil_hilt.name=Nimveil Hilt
item.blessed_hammer.name=Hammer of Aulendur
item.ice_thawer.name=Ice Thawer
item.deceiver_blade.name=Deceiver's Blade
item.anarore_bow.name=Anarórë's Bow
item.troll_chieftain_club.name=Troll Chieftain Club
item.glaechir_spear.name=Glaechír's Spear
item.deceiver_blade_blade.name=Cursed Blade
item.deceiver_blade_guard.name=Deceiver's Guard
item.deceiver_blade_hilt.name=Dark Hilt
item.anarore_bow_top.name=Anarórë's Bow Top
item.anarore_bow_bottom.name=Anarórë's Bow Bottom
item.anarore_bow_bowstring.name=Blessed Bowstring
item.troll_chieftain_club_club.name=Troll Club
item.troll_chieftain_club_spikes.name=Serrated Spikes
item.troll_chieftain_club_???.name=???
item.glaechir_spear_tip.name=Fine Bronze Spear Tip
item.glaechir_spear_shaft.name=Heraldic Spear Shaft
item.glaechir_spear_???.name=???
item.lotr:helmetNexShadow=Ancient Shadow Hood
item.lotr:bodyNexShadow=Ancient Shadow Robe Top
item.lotr:legsNexShadow=Ancient Shadow Robe Bottom
item.lotr:bootsNexShadow=Ancient Shadow Boots
item.lotr:helmetNexToxic=Ancient Toxic Hood
item.lotr:bodyNexToxic=Ancient Toxic Robe Top
item.lotr:legsNexToxic=Ancient Toxic Robe Bottom
item.lotr:bootsNexToxic=Ancient Toxic Boots
item.lotr:helmetNexFire=Ancient Fire Hood
item.lotr:bodyNexFire=Ancient Fire Robe Top
item.lotr:legsNexFire=Ancient Fire Robe Bottom
item.lotr:bootsNexFire=Ancient Fire Boots
item.lotr:helmetNexIce=Ancient Ice Hood
item.lotr:bodyNexIce=Ancient Ice Robe Top
item.lotr:legsNexIce=Ancient Ice Robe Bottom
item.lotr:bootsNexIce=Ancient Ice Boots
item.spawn_egg_FangornAuroch.name=Spawn Fangorn Auroch
item.spawn_egg_FangornBear.name=Spawn Fangorn Bear

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

@ -0,0 +1,30 @@
{
"animation": {
"frames": [
0,
0,
0,
0,
1,
1,
1,
1,
2,
2,
2,
2,
3,
3,
3,
3,
4,
4,
4,
4,
5,
5,
5,
5
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

@ -0,0 +1,76 @@
{
"animation": {
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
12,
12,
13,
13,
13,
14,
14,
14,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

@ -0,0 +1,76 @@
{
"animation": {
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
12,
12,
13,
13,
13,
14,
14,
14,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

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

Loading…
Cancel
Save