diff --git a/.gitignore b/.gitignore index 91ea741..12ddda9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build .gradle +.idea diff --git a/diffs b/diffs new file mode 100644 index 0000000..39598da --- /dev/null +++ b/diffs @@ -0,0 +1,5 @@ +Files src/main/java/com/zivilon/cinder_loe/CinderLoE.java and ../CinderLoE-Nex/src/main/java/com/zivilon/cinder_loe/CinderLoE.java differ + +Files src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java and ../CinderLoE-Nex/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java differ +Files src/main/resources/assets/cinder_loe/lang/en_US.lang and ../CinderLoE-Nex/src/main/resources/assets/cinder_loe/lang/en_US.lang differ + diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 9e42c5c..f127abe 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -4,18 +4,21 @@ import com.zivilon.cinder_loe.blocks.*; 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.corrupt.*; +import com.zivilon.cinder_loe.client.render.effect.*; +import com.zivilon.cinder_loe.client.render.entity.*; 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.corrupt.*; +import com.zivilon.cinder_loe.entity.effect.*; import com.zivilon.cinder_loe.entity.npc.*; -import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfArbalest; -import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfBannerBearer; -import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfCommander; -import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfWarrior; -import com.zivilon.cinder_loe.entity.npc.elf.Sirrandrai; +import com.zivilon.cinder_loe.entity.npc.dwarf.*; +import com.zivilon.cinder_loe.entity.npc.elf.*; import com.zivilon.cinder_loe.entity.npc.evil_human.*; +import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.*; import com.zivilon.cinder_loe.entity.npc.good_human.*; import com.zivilon.cinder_loe.entity.npc.orc.MorgulOrc; import com.zivilon.cinder_loe.entity.npc.orc.NorthernOrc; @@ -73,6 +76,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; @@ -116,9 +120,15 @@ public class CinderLoE { public static LOTRMaterial MATERIAL_USURPER; public static LOTRMaterial MATERIAL_WARLORD; public static LOTRMaterial MATERIAL_JADE; + public static LOTRMaterial MATERIAL_NEX_ICE; + 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 - // public static Block barricade; + //public static Block barricade; public static Block cinderBlock; public static Block ivoryBlock; public static Block blockRedDwarfSteel; @@ -129,7 +139,7 @@ public class CinderLoE { public static Block reedBale; public static Block dwarvenBrickRuned; public static Block fishBarrel; - ///public static Block rustedsword; + //public static Block rustedsword; public static Block mistBlock; public static Block cutDrystone; public static Block cindercobble; @@ -148,14 +158,20 @@ public class CinderLoE { //public static Block verticalWeaponRack; - //Gates + // Frozen Dungeon Blocks + public static Block shadowTile; + public static Block iceCage; + public static Block enchantedIce; + public static Block forgingStation; + + // Gates //public static Block gatecharredportcullis; - //Food Crop blocks + // Food Crop blocks public static Block onionCrop; public static Block cabbageCrop; - //Food! Yum :P + // Food! Yum :P public static Item onion; public static Item cabbage; public static Item pelmen; @@ -193,6 +209,37 @@ public class CinderLoE { public static Item legsJade; public static Item bootsJade; + // Frozen Dungeon + public static Item helmetNexIce; + public static Item bodyNexIce; + public static Item legsNexIce; + public static Item bootsNexIce; + public static Item helmetNexFire; + public static Item bodyNexFire; + public static Item legsNexFire; + public static Item bootsNexFire; + public static Item helmetNexToxin; + public static Item bodyNexToxin; + public static Item legsNexToxin; + public static Item bootsNexToxin; + public static Item helmetNexShadow; + public static Item bodyNexShadow; + public static Item legsNexShadow; + public static Item bootsNexShadow; + public static Item celeiniss; + public static Item nimveil; + public static Item nimveilPart; + public static Item aulendurHammer; + 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 public static Item forgingKit; public static Item cinderFurItem; @@ -333,10 +380,15 @@ public class CinderLoE { Utilities.initialize_reflects(); recipes.registerRecipes(); setupTradeEntries(); - LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F); + setWeaponStats(); LoECreativeTabs.setupIcons(); } + public void setWeaponStats() { + LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F); + LOTRWeaponStats.registerMeleeReach(Celeiniss.class, 1.8F); + LOTRWeaponStats.registerMeleeSpeed(Celeiniss.class, 1.0F); + } @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { @@ -347,6 +399,8 @@ public class CinderLoE { public void registerEntities() { // Last ID added: 58 ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock"); ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword"); + GameRegistry.registerTileEntity(TileEntityShadowTile.class, "TileEntityShadowTile"); + GameRegistry.registerTileEntity(TileEntityForgingStation.class, "TileEntityForgingStation"); int entityID = 7320; // Always increment entityID by 1 over the last entity to ensure unique IDs @@ -415,6 +469,14 @@ public class CinderLoE { EntityRegistry.registerModEntity(TauredainTrueBlood.class, "TauredainTrueBlood", (entityID + 57), this, 64, 1, true); EntityRegistry.registerModEntity(Sirrandrai.class, "Sirrandrai", (entityID + 58), this, 64, 1, true); + // Frozen Dungeon + EntityRegistry.registerModEntity(Nex.class, "Nex", (entityID + 45), this, 64, 1, true); + EntityRegistry.registerModEntity(NexShadow.class, "NexShadow", (entityID + 46), this, 64, 1, true); + 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() { @@ -486,6 +548,16 @@ public class CinderLoE { entityBarrier = (new EntityBarrier()); GameRegistry.registerBlock(entityBarrier, "entity_barrier"); + // Frozen Dungeon + shadowTile = (new ShadowTile()); + GameRegistry.registerBlock(shadowTile, "shadow_tile"); + iceCage = (new IceCage()); + GameRegistry.registerBlock(iceCage, "ice_cage"); + enchantedIce = (new EnchantedIce()); + GameRegistry.registerBlock(enchantedIce, "enchanted_ice"); + forgingStation = (new ForgingStation()); + GameRegistry.registerBlock(forgingStation, "forging_station"); + // Building Blocks cutDrystone = (new cutDrystone()); GameRegistry.registerBlock(cutDrystone, "cutDrystone"); @@ -919,6 +991,78 @@ public class CinderLoE { System.err.println("Failed to find ARNOR material for armor initialization."); } linkLOTRWeapon(maceArnor, "maceArnor"); + + // Frozen Dungeon + MATERIAL_NEX_ICE = getLOTRMaterialByName("NEX_ICE"); + 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"); + if (MATERIAL_NEX_ICE != null && MATERIAL_NEX_FIRE != null && MATERIAL_NEX_TOXIN != null && MATERIAL_NEX_SHADOW != null && MATERIAL_NIMVEIL != null && MATERIAL_FROZEN != null) { + 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()); + aulendurHammer = (new AulendurHammer()); + nimveil = (new Nimveil()); + nimveilPart = (new NimveilPart()); + toxicCore = (new ToxicCore()); + 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(aulendurHammer, "aulendurHammer",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); + } } public static ModContainer getModContainer() { @@ -1006,6 +1150,15 @@ public class CinderLoE { RenderingRegistry.registerEntityRenderingHandler(EsgarothSoldier.class, new LOTRRenderDaleMan()); RenderingRegistry.registerEntityRenderingHandler(MorgulOrc.class, new LOTRRenderOrc()); RenderingRegistry.registerEntityRenderingHandler(NorthernOrc.class, new LOTRRenderOrc()); + + RenderingRegistry.registerEntityRenderingHandler(NexCloud.class, new RenderNexCloud()); + RenderingRegistry.registerEntityRenderingHandler(NexFire.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(NexIce.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(NexShadow.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(NexToxin.class, new RenderNexMiniboss()); + RenderingRegistry.registerEntityRenderingHandler(Nex.class, new RenderNex()); + RenderingRegistry.registerEntityRenderingHandler(NimveilLightningBolt.class, new RenderNimveilBolt()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForgingStation.class, (TileEntitySpecialRenderer)new TileEntityForgingStationRenderer()); } } diff --git a/src/main/java/com/zivilon/cinder_loe/Materials.java b/src/main/java/com/zivilon/cinder_loe/Materials.java index 1c6d44f..8cc5e7a 100644 --- a/src/main/java/com/zivilon/cinder_loe/Materials.java +++ b/src/main/java/com/zivilon/cinder_loe/Materials.java @@ -25,6 +25,12 @@ public class Materials { modifyMaterial("USURPER",650, 2.0F, 0.6F, 2, 6.0F, 10, Items.iron_ingot); modifyMaterial("WARLORD", 650, 2.0F, 0.6F, 2, 6.0F, 10, LOTRMod.bronze); modifyMaterial("JADE",2400, 5.0F, 0.8F, 0, 9.0F, 10, LOTRMod.emerald); + modifyMaterial("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) { diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java b/src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java new file mode 100644 index 0000000..4ee562f --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java @@ -0,0 +1,47 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.LoECreativeTabs; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockIce; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import java.lang.reflect.Field; +import java.util.Random; + +public class EnchantedIce extends BlockIce { + public IIcon baseIcon; + + public EnchantedIce() { + super(); + this.setTickRandomly(false); + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); + setBlockTextureName("minecraft:ice"); + setBlockName("lotr:enchantedIce"); + setLightLevel(0.25F); + } + + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + this.baseIcon = iconRegister.registerIcon(this.getTextureName()); + } + + @Override + public IIcon getIcon(int side, int meta) { + return this.baseIcon; + } + + public IIcon getBaseIcon() { + return this.baseIcon; + } + + @Override + public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {} +} diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/ForgingStation.java b/src/main/java/com/zivilon/cinder_loe/blocks/ForgingStation.java new file mode 100644 index 0000000..f39e06a --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/ForgingStation.java @@ -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.aulendurHammer; + 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; + } + +} diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/IceCage.java b/src/main/java/com/zivilon/cinder_loe/blocks/IceCage.java new file mode 100644 index 0000000..75a2bf5 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/IceCage.java @@ -0,0 +1,221 @@ +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; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +import java.util.List; +import java.util.Random; + +public class IceCage extends Block { + @SideOnly(Side.CLIENT) + private IIcon blockIcon; + @SideOnly(Side.CLIENT) + private IIcon emptyIcon; + + public IceCage() { + super(Material.ice); + setHardness(2.0F); + setResistance(1.0F); + setStepSound(soundTypeGlass); + setBlockTextureName(Utilities.toSnakeCase("lotr:iceCage")); + setBlockName(Utilities.toSnakeCase("lotr:iceCage")); + setLightOpacity(5); // Semi-transparent + setCreativeTab(CreativeTabs.tabBlock); + setCreativeTab(LoECreativeTabs.tabDecoLoE); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public int getRenderType() { + return RenderIceCage.RENDER_ID; // Use the custom render type + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.blockIcon = iconRegister.registerIcon("lotr:ice_cage"); + this.emptyIcon = iconRegister.registerIcon("lotr:invisible"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { +/* if ((meta == 0 && side == 1) || (meta == 1 && side == 0)) { + return this.blockIcon; + }*/ + return this.blockIcon; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + return AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F); + } + + @Override + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { // Lower part + float thickness = 0.0625F; // 1/16th of a block thickness + + AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{ + AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall + AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall + AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall + AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F) // Back wall + }; + + for (AxisAlignedBB boundingBox : boundingBoxes) { + if (boundingBox != null && aabb.intersectsWith(boundingBox)) { + list.add(boundingBox); + } + } + } else if (meta == 1) { // Upper partplayer.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III + float thickness = 0.0625F; // 1/16th of a block thickness + + AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{ + AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall + AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall + AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall + AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F), // Back wall + AxisAlignedBB.getBoundingBox(x, y + 1.0F - thickness, z, x + 1.0F, y + 1.0F, z + 1.0F) // Ceiling + }; + + for (AxisAlignedBB boundingBox : boundingBoxes) { + if (boundingBox != null && aabb.intersectsWith(boundingBox)) { + list.add(boundingBox); + } + } + } + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if (entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + AxisAlignedBB blockBounds = AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F); + if (blockBounds != null && blockBounds.intersectsWith(player.boundingBox)) { + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III + } + } + } + + @Override + public void updateTick(World world, int x, int y, int z, Random random) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { // Lower part + List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 2.0F, z + 1.0F)); + for (EntityPlayer player : players) { + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III + } + } + world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world)); + } + + @Override + public int tickRate(World world) { + return 1; // Adjust the tick rate as needed + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + return true; + } + + @Override + public boolean canPlaceBlockAt(World world, int x, int y, int z) { + return world.isAirBlock(x, y, z) && world.isAirBlock(x, y + 1, z); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); // Lower part + world.setBlock(x, y + 1, z, this, 1, 2); // Upper part + } + + @Override + public 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); + if (meta == 0) { // Lower part + if (world.getBlock(x, y + 1, z) != this) { + world.setBlockToAir(x, y, z); + } + } else if (meta == 1) { // Upper part + if (world.getBlock(x, y - 1, z) != this) { + world.setBlockToAir(x, y, z); + } + } + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + if (meta == 0) { // Lower part + if (world.getBlock(x, y + 1, z) == this) { + world.setBlockToAir(x, y + 1, z); + } + } else if (meta == 1) { // Upper part + if (world.getBlock(x, y - 1, z) == this) { + world.setBlockToAir(x, y - 1, z); + } + } + super.breakBlock(world, x, y, z, block, meta); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/ShadowTile.java b/src/main/java/com/zivilon/cinder_loe/blocks/ShadowTile.java new file mode 100644 index 0000000..9ada9e9 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/ShadowTile.java @@ -0,0 +1,71 @@ +package com.zivilon.cinder_loe.blocks; + +import lotr.common.LOTRCreativeTabs; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import net.minecraft.block.BlockPressurePlate; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.entity.player.EntityPlayer; +import 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); + 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 && !world.isRemote) { + EntityPlayer player = (EntityPlayer)entity; + player.attackEntityFrom(LoEDamage.shadow, 10.0F); + player.addPotionEffect(new PotionEffect(15, 6*20, 0, false)); + world.setBlockToAir(x, y, z); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelBodyJade.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBodyJade.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelBodyJade.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBodyJade.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelBodySerpent.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBodySerpent.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelBodySerpent.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBodySerpent.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelBreeKettleHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBreeKettleHelmet.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelBreeKettleHelmet.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBreeKettleHelmet.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelBrokenHalo.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBrokenHalo.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelBrokenHalo.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelBrokenHalo.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelJadeHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelJadeHelmet.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelJadeHelmet.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelJadeHelmet.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelLegsJade.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelLegsJade.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelLegsJade.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelLegsJade.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelNexFireChestplate.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelNexFireChestplate.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelNexFireChestplate.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelNexFireChestplate.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelNexIceChestplate.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelNexIceChestplate.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelNexIceChestplate.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelNexIceChestplate.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelNexToxinChestplate.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelNexToxinChestplate.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelNexToxinChestplate.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelNexToxinChestplate.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelRedDwarfHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelRedDwarfHelmet.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelRedDwarfHelmet.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelRedDwarfHelmet.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelRhudaurHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelRhudaurHelmet.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelRhudaurHelmet.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelRhudaurHelmet.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelUsurperHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelUsurperHelmet.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelUsurperHelmet.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelUsurperHelmet.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelWarlordHelmet.java b/src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelWarlordHelmet.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelWarlordHelmet.java rename to src/main/java/com/zivilon/cinder_loe/client/model/armor/ModelWarlordHelmet.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/block/ModelForgingStation.java b/src/main/java/com/zivilon/cinder_loe/client/model/block/ModelForgingStation.java new file mode 100644 index 0000000..98afa2d --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/model/block/ModelForgingStation.java @@ -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; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/Modelverticalweaponrack.java b/src/main/java/com/zivilon/cinder_loe/client/model/block/Modelverticalweaponrack.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/Modelverticalweaponrack.java rename to src/main/java/com/zivilon/cinder_loe/client/model/block/Modelverticalweaponrack.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/barricade_post.java b/src/main/java/com/zivilon/cinder_loe/client/model/block/barricade_post.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/barricade_post.java rename to src/main/java/com/zivilon/cinder_loe/client/model/block/barricade_post.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelFangornAuroch.java b/src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelFangornAuroch.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelFangornAuroch.java rename to src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelFangornAuroch.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelFangornElk.java b/src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelFangornElk.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelFangornElk.java rename to src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelFangornElk.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelFangornWolf.java b/src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelFangornWolf.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/model/ModelFangornWolf.java rename to src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelFangornWolf.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelNex.java b/src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelNex.java new file mode 100644 index 0000000..2c5d794 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/model/entity/ModelNex.java @@ -0,0 +1,200 @@ +package com.zivilon.cinder_loe.client.model; + +import lotr.common.LOTRConfig; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelNex extends ModelBase { + public ModelRenderer body; + + public ModelRenderer neck; + + public ModelRenderer head; + + public ModelRenderer rightArm; + + public ModelRenderer leftArm; + + public ModelRenderer rightLeg; + + public ModelRenderer leftLeg; + + public ModelRenderer tail; + + public ModelRenderer rightWing; + + public ModelRenderer leftWing; + + private boolean isFireModel; + + public int heldItemRight; + + public ModelNex() { + this(0.0F); + } + + public ModelNex(float f) { + this.textureWidth = 128; + this.textureHeight = 256; + this.body = new ModelRenderer(this, 0, 38); + this.body.setRotationPoint(0.0F, 7.0F, 3.0F); + this.body.addBox(-8.0F, -15.0F, -6.0F, 16, 18, 12, f); + this.body.setTextureOffset(0, 207); + this.body.addBox(-9.0F, -6.5F, -7.0F, 7, 1, 14, f); + this.body.addBox(-9.0F, -9.5F, -7.0F, 7, 1, 14, f); + this.body.addBox(-9.0F, -12.5F, -7.0F, 7, 1, 14, f); + this.body.mirror = true; + this.body.addBox(2.0F, -6.5F, -7.0F, 7, 1, 14, f); + this.body.addBox(2.0F, -9.5F, -7.0F, 7, 1, 14, f); + this.body.addBox(2.0F, -12.5F, -7.0F, 7, 1, 14, f); + this.body.mirror = false; + this.body.setTextureOffset(0, 0).addBox(-9.0F, -29.0F, -7.0F, 18, 14, 15, f); + this.body.setTextureOffset(81, 163).addBox(-2.0F, -21.0F, 5.5F, 4, 25, 2, f); + this.neck = new ModelRenderer(this, 76, 0); + this.neck.setRotationPoint(0.0F, -25.0F, -3.0F); + this.neck.addBox(-6.0F, -5.0F, -10.0F, 12, 12, 14, f); + this.body.addChild(this.neck); + this.head = new ModelRenderer(this, 92, 48); + this.head.setRotationPoint(0.0F, 0.0F, -10.0F); + this.head.addBox(-4.0F, -6.0F, -6.0F, 8, 10, 7, f); + this.head.setTextureOffset(57, 58).addBox(-6.0F, -7.0F, -4.0F, 12, 4, 4, f); + this.head.rotateAngleX = (float)Math.toRadians(10.0D); + this.neck.addChild(this.head); + ModelRenderer rightHorn1 = new ModelRenderer(this, 57, 47); + rightHorn1.setRotationPoint(-6.0F, -5.0F, -2.0F); + rightHorn1.addBox(-7.0F, -1.5F, -1.5F, 8, 3, 3, f); + rightHorn1.rotateAngleY = (float)Math.toRadians(-35.0D); + this.head.addChild(rightHorn1); + ModelRenderer rightHorn2 = new ModelRenderer(this, 57, 35); + rightHorn2.setRotationPoint(-7.0F, 0.0F, 0.0F); + rightHorn2.addBox(-1.0F, -1.0F, -6.0F, 2, 2, 6, f); + rightHorn2.rotateAngleY = (float)Math.toRadians(45.0D); + rightHorn1.addChild(rightHorn2); + ModelRenderer leftHorn1 = new ModelRenderer(this, 57, 47); + leftHorn1.setRotationPoint(6.0F, -5.0F, -2.0F); + leftHorn1.mirror = true; + leftHorn1.addBox(-1.0F, -1.5F, -1.5F, 8, 3, 3, f); + leftHorn1.rotateAngleY = (float)Math.toRadians(35.0D); + this.head.addChild(leftHorn1); + ModelRenderer leftHorn2 = new ModelRenderer(this, 57, 35); + leftHorn2.setRotationPoint(7.0F, 0.0F, 0.0F); + leftHorn2.mirror = true; + leftHorn2.addBox(-1.0F, -1.0F, -6.0F, 2, 2, 6, f); + leftHorn2.rotateAngleY = (float)Math.toRadians(-45.0D); + leftHorn1.addChild(leftHorn2); + this.rightArm = new ModelRenderer(this, 59, 136); + this.rightArm.setRotationPoint(-9.0F, -25.0F, 0.0F); + this.rightArm.addBox(-7.0F, -2.0F, -4.0F, 7, 10, 8, f); + this.rightArm.setTextureOffset(93, 136).addBox(-6.5F, 8.0F, -3.0F, 6, 16, 6, f); + this.body.addChild(this.rightArm); + this.leftArm = new ModelRenderer(this, 59, 136); + this.leftArm.setRotationPoint(9.0F, -25.0F, 0.0F); + this.leftArm.mirror = true; + this.leftArm.addBox(0.0F, -2.0F, -4.0F, 7, 10, 8, f); + this.leftArm.setTextureOffset(93, 136).addBox(0.5F, 8.0F, -3.0F, 6, 16, 6, f); + this.body.addChild(this.leftArm); + this.rightLeg = new ModelRenderer(this, 46, 230); + this.rightLeg.setRotationPoint(-6.0F, 6.0F, 3.0F); + this.rightLeg.addBox(-7.0F, -2.0F, -4.0F, 7, 9, 8, f); + this.rightLeg.setTextureOffset(46, 208).addBox(-6.5F, 2.0F, 4.0F, 6, 13, 5, f); + ModelRenderer rightFoot = new ModelRenderer(this, 0, 243); + rightFoot.setRotationPoint(0.0F, 0.0F, 0.0F); + rightFoot.addBox(-7.0F, 15.0F, -6.0F, 7, 3, 9, f); + rightFoot.rotateAngleX = (float)Math.toRadians(25.0D); + this.rightLeg.addChild(rightFoot); + this.leftLeg = new ModelRenderer(this, 46, 230); + this.leftLeg.setRotationPoint(6.0F, 6.0F, 3.0F); + this.leftLeg.mirror = true; + this.leftLeg.addBox(0.0F, -2.0F, -4.0F, 7, 9, 8, f); + this.leftLeg.setTextureOffset(46, 208).addBox(0.5F, 2.0F, 4.0F, 6, 13, 5, f); + ModelRenderer leftFoot = new ModelRenderer(this, 0, 243); + leftFoot.setRotationPoint(0.0F, 0.0F, 0.0F); + leftFoot.mirror = true; + leftFoot.addBox(0.0F, 15.0F, -6.0F, 7, 3, 9, f); + leftFoot.rotateAngleX = (float)Math.toRadians(25.0D); + this.leftLeg.addChild(leftFoot); + this.tail = new ModelRenderer(this, 79, 200); + this.tail.setRotationPoint(0.0F, -3.0F, 3.0F); + this.tail.addBox(-3.5F, -3.0F, 2.0F, 7, 7, 10, f); + this.tail.setTextureOffset(80, 225).addBox(-2.5F, -2.5F, 11.0F, 5, 5, 14, f); + this.tail.setTextureOffset(96, 175).addBox(-1.5F, -2.0F, 24.0F, 3, 3, 12, f); + this.body.addChild(this.tail); + this.rightWing = new ModelRenderer(this, 0, 137); + this.rightWing.setRotationPoint(-6.0F, -27.0F, 4.0F); + this.rightWing.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 25, f); + this.rightWing.setTextureOffset(0, 167).addBox(-1.0F, -2.0F, 25.0F, 2, 24, 2, f); + this.rightWing.setTextureOffset(0, 30).addBox(-0.5F, -7.0F, 25.5F, 1, 5, 1, f); + this.rightWing.setTextureOffset(0, 69).addBox(0.0F, 0.0F, 0.0F, 0, 35, 25, f); + this.body.addChild(this.rightWing); + this.leftWing = new ModelRenderer(this, 0, 137); + this.leftWing.setRotationPoint(6.0F, -27.0F, 4.0F); + this.leftWing.mirror = true; + this.leftWing.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 25, f); + this.leftWing.setTextureOffset(0, 167).addBox(-1.0F, -2.0F, 25.0F, 2, 24, 2, f); + this.leftWing.setTextureOffset(0, 30).addBox(-0.5F, -7.0F, 25.5F, 1, 5, 1, f); + this.leftWing.setTextureOffset(0, 69).addBox(0.0F, 0.0F, 0.0F, 0, 35, 25, f); + this.body.addChild(this.leftWing); + } + + public void setFireModel() { + this.isFireModel = true; + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.rightWing.showModel = true; + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.body.render(f5); + this.rightLeg.render(f5); + this.leftLeg.render(f5); + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + this.neck.rotateAngleX = (float)Math.toRadians(-10.0D); + this.neck.rotateAngleY = 0.0F; + this.neck.rotateAngleX += f4 / (float)Math.toDegrees(1.0D); + this.neck.rotateAngleY += f3 / (float)Math.toDegrees(1.0D); + this.body.rotateAngleX = (float)Math.toRadians(10.0D); + this.body.rotateAngleX += MathHelper.cos(f2 * 0.03F) * 0.15F; + this.rightArm.rotateAngleX = 0.0F; + this.leftArm.rotateAngleX = 0.0F; + this.rightArm.rotateAngleZ = 0.0F; + this.leftArm.rotateAngleZ = 0.0F; + this.rightArm.rotateAngleX += MathHelper.cos(f * 0.4F + 3.1415927F) * 0.8F * f1; + this.leftArm.rotateAngleX += MathHelper.cos(f * 0.4F) * 0.8F * f1; + this.rightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; + this.leftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; + if (this.onGround > -9990.0F) { + float f6 = this.onGround; + this.rightArm.rotateAngleY += this.body.rotateAngleY; + this.leftArm.rotateAngleY += this.body.rotateAngleY; + this.leftArm.rotateAngleX += this.body.rotateAngleY; + f6 = 1.0F - this.onGround; + f6 *= f6; + f6 *= f6; + f6 = 1.0F - f6; + float f7 = MathHelper.sin(f6 * 3.1415927F); + float f8 = MathHelper.sin(this.onGround * 3.1415927F) * -(this.head.rotateAngleX - 0.7F) * 0.75F; + this.rightArm.rotateAngleX = (float)(this.rightArm.rotateAngleX - f7 * 1.2D + f8); + this.rightArm.rotateAngleY += this.body.rotateAngleY * 2.0F; + this.rightArm.rotateAngleZ = MathHelper.sin(this.onGround * 3.1415927F) * -0.4F; + } + if (this.heldItemRight != 0) + this.rightArm.rotateAngleX = this.rightArm.rotateAngleX * 0.5F - 0.31415927F * this.heldItemRight; + this.rightLeg.rotateAngleX = (float)Math.toRadians(-25.0D); + this.leftLeg.rotateAngleX = (float)Math.toRadians(-25.0D); + this.rightLeg.rotateAngleX += MathHelper.sin(f * 0.4F) * 1.2F * f1; + this.leftLeg.rotateAngleX += MathHelper.sin(f * 0.4F + 3.1415927F) * 1.2F * f1; + this.rightWing.rotateAngleX = (float)Math.toRadians(40.0D); + this.leftWing.rotateAngleX = (float)Math.toRadians(40.0D); + this.rightWing.rotateAngleY = (float)Math.toRadians(-40.0D); + this.leftWing.rotateAngleY = (float)Math.toRadians(40.0D); + this.rightWing.rotateAngleY += MathHelper.cos(f2 * 0.04F) * 0.5F; + this.leftWing.rotateAngleY -= MathHelper.cos(f2 * 0.04F) * 0.5F; + this.tail.rotateAngleX = (float)Math.toRadians(-40.0D); + this.tail.rotateAngleY = 0.0F; + this.tail.rotateAngleY += MathHelper.cos(f2 * 0.05F) * 0.15F; + this.tail.rotateAngleY += MathHelper.sin(f * 0.1F) * 0.6F * f1; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderIceCage.java b/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderIceCage.java new file mode 100644 index 0000000..bfb8b72 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderIceCage.java @@ -0,0 +1,69 @@ +package com.zivilon.cinder_loe.client.render.block; + +import com.zivilon.cinder_loe.blocks.IceCage; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderIceCage implements ISimpleBlockRenderingHandler { + + public static final int RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (modelID != RENDER_ID) return; + + // Render inventory block as flat texture icon + renderer.renderBlockAsItem(block, metadata, 1.0F); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + if (!(block instanceof IceCage) || modelId != RENDER_ID) { + return false; + } + + int meta = world.getBlockMetadata(x, y, z); + float thickness = 0.0625F; // 1/16th of a block thickness + + // Render the bounding boxes as defined in the block class + if (meta == 0) { // Lower part + renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 0, 1, thickness, 1); // Floor + renderer.renderStandardBlock(block, x, y, z); + } else if (meta == 1) { // Upper part + renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 1, 0, 1, 1 + thickness, 1); // Ceiling + renderer.renderStandardBlock(block, x, y, z); + } + + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return false; // Do not render as 3D in inventory + } + + @Override + public int getRenderId() { + return RENDER_ID; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/effect/RenderNimveilBolt.java b/src/main/java/com/zivilon/cinder_loe/client/render/effect/RenderNimveilBolt.java new file mode 100644 index 0000000..908fb5d --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/effect/RenderNimveilBolt.java @@ -0,0 +1,136 @@ +package com.zivilon.cinder_loe.client.render.effect; + +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_); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderBattleNun.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderBattleNun.java similarity index 96% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderBattleNun.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderBattleNun.java index bb0cfae..334e75c 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderBattleNun.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderBattleNun.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import com.zivilon.cinder_loe.entity.npc.good_human.BattleNun; import lotr.client.model.LOTRModelHuman; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderDarkSpider.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderDarkSpider.java similarity index 89% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderDarkSpider.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderDarkSpider.java index 0dbe36d..673df6f 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderDarkSpider.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderDarkSpider.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.render.entity.LOTRRenderSpiderBase; import lotr.client.render.entity.LOTRRenderUtumnoIceSpider; @@ -11,4 +11,4 @@ public class RenderDarkSpider extends LOTRRenderUtumnoIceSpider { protected ResourceLocation getEntityTexture(Entity entity) { return spiderSkin; } -} \ No newline at end of file +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornAuroch.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornAuroch.java similarity index 94% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornAuroch.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornAuroch.java index 8378879..11922b2 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornAuroch.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornAuroch.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.render.entity.LOTRRandomSkins; import lotr.common.entity.LOTRRandomSkinEntity; @@ -23,4 +23,4 @@ public class RenderFangornAuroch extends RenderLiving { ResourceLocation skin = aurochsSkins.getRandomSkin((LOTRRandomSkinEntity)aurochs); return skin; } -} \ No newline at end of file +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornBear.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornBear.java similarity index 96% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornBear.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornBear.java index 332c86f..0e4a67b 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornBear.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornBear.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import com.zivilon.cinder_loe.entity.npc.radagast.FangornBear; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornElk.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornElk.java similarity index 94% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornElk.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornElk.java index a34b632..f952b96 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornElk.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornElk.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.common.entity.LOTRRandomSkinEntity; import lotr.client.render.entity.LOTRRandomSkins; @@ -26,4 +26,4 @@ public class RenderFangornElk extends RenderLiving { ResourceLocation elkSkin = elkSkins.getRandomSkin((LOTRRandomSkinEntity)elk); return elkSkin; } -} \ No newline at end of file +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornWildBoar.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornWildBoar.java similarity index 92% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornWildBoar.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornWildBoar.java index b6dd3e0..890974a 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornWildBoar.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornWildBoar.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.model.LOTRModelBoar; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornWolf.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornWolf.java similarity index 92% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornWolf.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornWolf.java index 454233e..762a7b1 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderFangornWolf.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderFangornWolf.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderLimwaith.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderLimwaith.java similarity index 96% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderLimwaith.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderLimwaith.java index df82b8e..f759d9a 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderLimwaith.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderLimwaith.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.model.LOTRModelHuman; import lotr.client.render.entity.LOTRRenderBiped; @@ -38,4 +38,4 @@ public class RenderLimwaith extends LOTRRenderBiped { Limwaith limwaith = (Limwaith)entity; return super.shouldRenderPass((EntityLiving)limwaith, pass, f); } -} \ No newline at end of file +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderLimwaithShaman.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderLimwaithShaman.java similarity index 94% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderLimwaithShaman.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderLimwaithShaman.java index 7b92011..be35147 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderLimwaithShaman.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderLimwaithShaman.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import com.zivilon.cinder_loe.entity.npc.evil_human.Limwaith; import lotr.client.render.entity.LOTRRandomSkins; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNex.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNex.java new file mode 100644 index 0000000..11bd230 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNex.java @@ -0,0 +1,136 @@ +package com.zivilon.cinder_loe.client.render.entity; + +import com.zivilon.cinder_loe.client.model.ModelNex; +import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.Nex; +import lotr.client.render.entity.LOTRRandomSkins; +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; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderNex extends RenderLiving { + private static LOTRRandomSkins balrogSkins; + + private static LOTRRandomSkins balrogSkinsBright; + + private static final ResourceLocation fireTexture = new ResourceLocation("lotr:mob/balrog/fire.png"); + + private ModelNex balrogModel; + + private ModelNex balrogModelBright; + + private ModelNex fireModel; + + public RenderNex() { + super((ModelBase)new ModelNex(), 0.5F); + this.balrogModel = (ModelNex)this.mainModel; + this.balrogModelBright = new ModelNex(0.05F); + this.fireModel = new ModelNex(0.0F); + this.fireModel.setFireModel(); + balrogSkins = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog"); + balrogSkinsBright = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog_bright"); + } + + protected ResourceLocation getEntityTexture(Entity entity) { + return balrogSkins.getRandomSkin((LOTRRandomSkinEntity)entity); + } + + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + Nex balrog = (Nex)entity; + ItemStack heldItem = balrog.getHeldItem(); + this.fireModel.heldItemRight = (heldItem == null) ? 0 : 2; + doRender((EntityLiving)balrog, d, d1, d2, f, f1); + } + + protected void preRenderCallback(EntityLivingBase entity, float f) { + Nex balrog = (Nex)entity; + float scale = 2.0F; + GL11.glScalef(scale, scale, scale); + } + + private void setupFullBright() { + int light = 15728880; + int lx = light % 65536; + int ly = light / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lx / 1.0F, ly / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + protected int shouldRenderPass(EntityLivingBase entity, int pass, float f) { + Nex balrog = (Nex)entity; + if (pass == 1) { + float alpha; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); + GL11.glMatrixMode(5890); + GL11.glLoadIdentity(); + float f1 = balrog.ticksExisted + f; + float f2 = f1 * 0.01F; + float f3 = f1 * 0.01F; + GL11.glTranslatef(f2, f3, 0.0F); + GL11.glMatrixMode(5888); + GL11.glAlphaFunc(516, 0.01F); + GL11.glEnable(3042); + GL11.glBlendFunc(1, 1); + alpha = 0.3F + MathHelper.sin(f1 * 0.05F) * 0.15F; + GL11.glColor4f(alpha, alpha, alpha, 1.0F); + GL11.glDisable(2896); + GL11.glDepthMask(false); + setRenderPassModel((ModelBase)this.fireModel); + bindTexture(fireTexture); + return 1; + } + if (pass == 2) { + GL11.glMatrixMode(5890); + GL11.glLoadIdentity(); + GL11.glMatrixMode(5888); + GL11.glAlphaFunc(516, 0.1F); + GL11.glDisable(3042); + GL11.glEnable(2896); + GL11.glDepthMask(true); + GL11.glDisable(2896); + setupFullBright(); + setRenderPassModel((ModelBase)this.balrogModelBright); + bindTexture(balrogSkinsBright.getRandomSkin((LOTRRandomSkinEntity)balrog)); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + return 1; + } + if (pass == 3) { + GL11.glEnable(2896); + GL11.glDisable(3042); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + return -1; + } + + protected void renderEquippedItems(EntityLivingBase entity, float f) { + GL11.glColor3f(1.0F, 1.0F, 1.0F); + ItemStack heldItem = entity.getHeldItem(); + if (heldItem != null) { + GL11.glPushMatrix(); + this.balrogModel.body.postRender(0.0625F); + this.balrogModel.rightArm.postRender(0.0625F); + GL11.glTranslatef(-0.25F, 1.5F, -0.125F); + float scale = 1.25F; + GL11.glScalef(scale, -scale, scale); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + this.renderManager.itemRenderer.renderItem(entity, heldItem, 0); + if (heldItem.getItem().requiresMultipleRenderPasses()) + for (int x = 1; x < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); x++) + this.renderManager.itemRenderer.renderItem(entity, heldItem, x); + GL11.glPopMatrix(); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNexCloud.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNexCloud.java new file mode 100644 index 0000000..01df339 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNexCloud.java @@ -0,0 +1,50 @@ +package com.zivilon.cinder_loe.client.render.entity; + +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.npc.frozen_dungeon.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(); + } + +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNexMiniboss.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNexMiniboss.java new file mode 100644 index 0000000..6c47914 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderNexMiniboss.java @@ -0,0 +1,49 @@ +package com.zivilon.cinder_loe.client.render.entity; + +import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.*; + +import lotr.client.model.LOTRModelHuman; +import lotr.client.render.entity.LOTRRenderBiped; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderNexMiniboss extends LOTRRenderBiped { + public static ResourceLocation SHADOW_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/shadow.png"); + public static ResourceLocation FIRE_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/fire.png"); + public static ResourceLocation ICE_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/ice.png"); + public static ResourceLocation TOXIN_TEXTURE = new ResourceLocation("cinder_loe:mob/nex/toxin.png"); + + public RenderNexMiniboss() { + super(new LOTRModelHuman(), 0.0F); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + if (entity instanceof NexToxin) { + return TOXIN_TEXTURE; + } else if (entity instanceof NexFire) { + return FIRE_TEXTURE; + } else if (entity instanceof NexIce) { + return ICE_TEXTURE; + } else { + return SHADOW_TEXTURE; + } + } + + @Override + protected void preRenderCallback(EntityLivingBase entity, float partialTickTime) { + super.preRenderCallback(entity, partialTickTime); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); // Apply 50% transparency + } + + @Override + protected void renderModel(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) { + super.renderModel(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); + GL11.glDisable(GL11.GL_BLEND); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderRenegade.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderRenegade.java similarity index 97% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderRenegade.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderRenegade.java index 37b9ae3..1359057 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderRenegade.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderRenegade.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderTamedCrocodile.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderTamedCrocodile.java similarity index 92% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderTamedCrocodile.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderTamedCrocodile.java index 8aefe9c..79a3659 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderTamedCrocodile.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderTamedCrocodile.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.model.LOTRModelBoar; import lotr.client.model.LOTRModelCrocodile; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderUtumnoSlave.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderUtumnoSlave.java similarity index 95% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderUtumnoSlave.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderUtumnoSlave.java index ecabba9..86004b8 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderUtumnoSlave.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderUtumnoSlave.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.model.LOTRModelHuman; import lotr.client.render.entity.LOTRRenderBiped; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderWraith.java b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderWraith.java similarity index 96% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderWraith.java rename to src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderWraith.java index d9ad866..9ac378e 100644 --- a/src/main/java/com/zivilon/cinder_loe/client/render/RenderWraith.java +++ b/src/main/java/com/zivilon/cinder_loe/client/render/entity/RenderWraith.java @@ -1,4 +1,4 @@ -package com.zivilon.cinder_loe.client.render; +package com.zivilon.cinder_loe.client.render.entity; import lotr.client.model.LOTRModelMarshWraith; import net.minecraft.client.model.ModelBase; diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/item/TrollClubRenderer.java b/src/main/java/com/zivilon/cinder_loe/client/render/item/TrollClubRenderer.java new file mode 100644 index 0000000..6067895 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/item/TrollClubRenderer.java @@ -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(); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanFireball.java b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanFireball.java similarity index 100% rename from src/main/java/com/zivilon/cinder_loe/client/render/RenderSarumanFireball.java rename to src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderSarumanFireball.java diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/tileentity/TileEntityForgingStationRenderer.java b/src/main/java/com/zivilon/cinder_loe/client/render/tileentity/TileEntityForgingStationRenderer.java new file mode 100644 index 0000000..38d2291 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/tileentity/TileEntityForgingStationRenderer.java @@ -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(); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java index 95f4a23..63aa60c 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java @@ -67,6 +67,12 @@ public class LOTRMaterialTransformer implements IClassTransformer { addMaterial("USURPER", classNode); addMaterial("WARLORD",classNode); addMaterial("JADE",classNode); + addMaterial("NEX_ICE",classNode); + addMaterial("NEX_FIRE",classNode); + addMaterial("NEX_TOXIN",classNode); + addMaterial("NEX_SHADOW",classNode); + addMaterial("NIMVEIL",classNode); + addMaterial("FROZEN",classNode); // Protection Conversion diff --git a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java index 75f95db..db60d07 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRWeaponLinker.java @@ -25,7 +25,8 @@ public class LOTRWeaponLinker implements IClassTransformer { "frostblade", "spearsolidgold", "whip", "spearUnnamed", "welfRelic", "daggerVoid", "swordBree", "maceArnor", - "daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh", "cleaver"); + "daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh", "cleaver", + "celeiniss", "nimveil"); } return basicClass; } diff --git a/src/main/java/com/zivilon/cinder_loe/entity/effect/NimveilLightningBolt.java b/src/main/java/com/zivilon/cinder_loe/entity/effect/NimveilLightningBolt.java new file mode 100644 index 0000000..a716f48 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/effect/NimveilLightningBolt.java @@ -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_) {} +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/Nex.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/Nex.java new file mode 100644 index 0000000..339fcd8 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/Nex.java @@ -0,0 +1,413 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +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; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.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> nex_instances = new ArrayList<>(); + + public AxisAlignedBB collisionBox; + public AxisAlignedBB hitbox; + 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); + 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(); + } + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(31, Integer.valueOf(0)); + } + + 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 applyEntityAttributes() { + super.applyEntityAttributes(); + 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() { + phase = this.dataWatcher.getWatchableObjectInt(31); + return phase; + } + public void setPhase(int 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() { + return LOTRFaction.UTUMNO; + } + + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("NexPhase", getPhase()); + } + + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + setPhase(nbt.getInteger("NexPhase")); + } + + public boolean canBePushed() { + return false; + } + + protected void fall(float f) {} + + protected void updateFallState(double d, boolean flag) {} + + protected boolean canDespawn() { + return false; + } + + // 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 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 getValidPositions() { + int radius = 64; // Radius to search for valid blocks + + List 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 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 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 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) { + return; + } + + protected String getHurtSound() { + return "lotr:wight.hurt"; + } + + protected String getDeathSound() { + return "lotr:wight.death"; + } + + @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 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 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; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexCloud.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexCloud.java new file mode 100644 index 0000000..34e7c0d --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexCloud.java @@ -0,0 +1,180 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +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 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 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 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; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexFire.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexFire.java new file mode 100644 index 0000000..8c7f19e --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexFire.java @@ -0,0 +1,67 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +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 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; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/fire"; + } + + @Override + public void onBoundUpdate(int x, int y, int z) { + } + + @Override + public void onUnboundUpdate() { + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexIce.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexIce.java new file mode 100644 index 0000000..a2d676e --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexIce.java @@ -0,0 +1,68 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +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 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; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/ice"; + } + + @Override + public void onBoundUpdate(int x, int y, int z) { + } + + @Override + public void onUnboundUpdate() { + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexMiniboss.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexMiniboss.java new file mode 100644 index 0000000..583dd4f --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexMiniboss.java @@ -0,0 +1,151 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.util.Utilities; +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 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(); +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexShadow.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexShadow.java new file mode 100644 index 0000000..3ef6a13 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexShadow.java @@ -0,0 +1,85 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +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.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.world.World; + +import java.util.List; + +public class NexShadow extends NexMiniboss { + public String entity_name = "§7Fuinë"; + + public NexShadow(World world) { + super(world); + } + + @Override + 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 + public String getNPCName() { + return entity_name; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/shadow"; + } + + @Override + public void onBoundUpdate(int x, int y, int z) { + this.motionX = 0; + this.motionY = 0; + this.motionZ = 0; + this.setPosition(x + 0.5, y, z + 0.5); + } + + @Override + public void onUnboundUpdate() { + List players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(100.0D, 100.0D, 100.0D)); + + for (EntityPlayer player : players) { + int playerLightLevel = this.worldObj.getBlockLightValue(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); + double playerDistanceY = player.posY - this.posY; + + if (playerLightLevel < 4 && Math.abs(playerDistanceY) <= 4.0D) { + player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); // 5 seconds of blindness + } + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexToxin.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexToxin.java new file mode 100644 index 0000000..aa82377 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/frozen_dungeon/NexToxin.java @@ -0,0 +1,73 @@ +package com.zivilon.cinder_loe.entity.npc.frozen_dungeon; + +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 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; + } + @Override + public String getNPCFormattedName(String npcName, String entityName) { + return entity_name; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + return "nex/toxin"; + } + + @Override + public void onBoundUpdate(int x, int y, int z) { + } + + @Override + public void onUnboundUpdate() { + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/AulendurHammer.java b/src/main/java/com/zivilon/cinder_loe/items/AulendurHammer.java new file mode 100644 index 0000000..45a0ee8 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/AulendurHammer.java @@ -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 AulendurHammer extends LoEHammer { + public AulendurHammer() { + super(CinderLoE.MATERIAL_NIMVEIL, CinderLoE.enchantedIce); + this.setTextureName("lotr:aulendur_hammer"); + } + + @Override + public String getUnlocalizedName(ItemStack item) { + return "item.aulendur_hammer"; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { + list.add(EnumChatFormatting.GRAY + "This blacksmith hammer is brimming with power"); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/Celeiniss.java b/src/main/java/com/zivilon/cinder_loe/items/Celeiniss.java new file mode 100644 index 0000000..4205d76 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/Celeiniss.java @@ -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)); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java b/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java index 9a63149..828df48 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java +++ b/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java @@ -9,6 +9,7 @@ import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfBannerBearer; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfCommander; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfWarrior; import com.zivilon.cinder_loe.entity.npc.evil_human.*; +import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.*; import com.zivilon.cinder_loe.entity.npc.good_human.*; import com.zivilon.cinder_loe.entity.npc.radagast.*; import com.zivilon.cinder_loe.entity.trader.*; @@ -96,6 +97,11 @@ public class CinderLoESpawnEgg extends Item { ENTITY_CLASSES.add(CorruptMan.class); ENTITY_CLASSES.add(CorruptOrc.class); ENTITY_CLASSES.add(HobbitBannerBearer.class); + ENTITY_CLASSES.add(NexShadow.class); + ENTITY_CLASSES.add(NexIce.class); + ENTITY_CLASSES.add(NexFire.class); + ENTITY_CLASSES.add(NexToxin.class); + ENTITY_CLASSES.add(Nex.class); } @Override diff --git a/src/main/java/com/zivilon/cinder_loe/items/IceThawer.java b/src/main/java/com/zivilon/cinder_loe/items/IceThawer.java new file mode 100644 index 0000000..0cf0b9a --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/IceThawer.java @@ -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?"); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/Nimveil.java b/src/main/java/com/zivilon/cinder_loe/items/Nimveil.java new file mode 100644 index 0000000..654f408 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/Nimveil.java @@ -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 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; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/NimveilPart.java b/src/main/java/com/zivilon/cinder_loe/items/NimveilPart.java new file mode 100644 index 0000000..c902139 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/NimveilPart.java @@ -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)); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java new file mode 100644 index 0000000..8c5df91 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java @@ -0,0 +1,17 @@ +package com.zivilon.cinder_loe.items; + +import com.zivilon.cinder_loe.LoECreativeTabs; + +import net.minecraft.item.Item; + +public class ToxicCore extends Item { + + public ToxicCore() { + this.setUnlocalizedName("lotr:toxicCore"); + this.setTextureName("lotr:toxic_core"); + setCreativeTab(LoECreativeTabs.tabMiscLoE); + this.setMaxDamage(10000); + this.setNoRepair(); + this.setMaxStackSize(1); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/WeaponPart.java b/src/main/java/com/zivilon/cinder_loe/items/WeaponPart.java new file mode 100644 index 0000000..d047f44 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/WeaponPart.java @@ -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)); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityLivingBase.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityLivingBase.java index a566896..f1d815b 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityLivingBase.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityLivingBase.java @@ -2,6 +2,8 @@ package com.zivilon.cinder_loe.mixins; import com.zivilon.cinder_loe.util.*; +import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.*; + import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.*; @@ -79,6 +81,7 @@ public abstract class MixinEntityLivingBase extends Entity { /** * @author Shinare * @reason Adding damage event method + * Added Nex fire damage modifiers */ @Overwrite public boolean attackEntityFrom(DamageSource source, float damage) { @@ -88,7 +91,24 @@ public abstract class MixinEntityLivingBase extends Entity { this.entityAge = 0; if (this.getHealth() <= 0.0F) return false; - if (source.isFireDamage() && isPotionActive(Potion.fireResistance)) return false; + if (source.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; + damage *= 0.5F; + } + if (fire_phase) { + damage *= 3.0F; + List 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 (!(checked_cauldron)) { check_cauldron(); diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinItemRenderer.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinItemRenderer.java index b44dd96..73b081f 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinItemRenderer.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinItemRenderer.java @@ -281,4 +281,18 @@ public abstract class MixinItemRenderer { // 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); } + + /** + * 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; + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRRenderLargeItem.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRRenderLargeItem.java index e7d994e..62add57 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRRenderLargeItem.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRRenderLargeItem.java @@ -1,6 +1,7 @@ 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; @@ -30,15 +31,121 @@ 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 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")) + 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); } + + /** + * @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]; + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java index 2a8148c..2ebd594 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java @@ -58,7 +58,11 @@ public abstract class MixinSlotCrafting { if (itemstack1 != null) { if (!hasExceptionItem && DurableItemCrafter.customItems.contains(itemstack1.getItem())) { - damage_item(itemstack1, i, 1, craftMatrix); + if (itemstack1.getItem() == CinderLoE.toxicCore && arrow_count > 0) { + damage_item(itemstack1, i, arrow_count, craftMatrix); + } else { + damage_item(itemstack1, i, 1, craftMatrix); + } } else { craftMatrix.decrStackSize(i, 1); } diff --git a/src/main/java/com/zivilon/cinder_loe/recipe/ForgingRecipe.java b/src/main/java/com/zivilon/cinder_loe/recipe/ForgingRecipe.java new file mode 100644 index 0000000..3680377 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/recipe/ForgingRecipe.java @@ -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)); + } + +} diff --git a/src/main/java/com/zivilon/cinder_loe/recipe/ForgingRecipes.java b/src/main/java/com/zivilon/cinder_loe/recipe/ForgingRecipes.java new file mode 100644 index 0000000..bcac2bd --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/recipe/ForgingRecipes.java @@ -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 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 getAllRecipes() { + return recipes; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/recipe/ToxicCoreArrowsRecipe.java b/src/main/java/com/zivilon/cinder_loe/recipe/ToxicCoreArrowsRecipe.java new file mode 100644 index 0000000..12c51ae --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/recipe/ToxicCoreArrowsRecipe.java @@ -0,0 +1,81 @@ +package com.zivilon.cinder_loe.recipe; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; +import com.zivilon.cinder_loe.CinderLoE; + +public class ToxicCoreArrowsRecipe implements IRecipe { + + private final ItemStack result; + + public ToxicCoreArrowsRecipe(ItemStack result) { + this.result = result; + } + + @Override + public boolean matches(InventoryCrafting inv, World worldIn) { + ItemStack toxicCore = null; + int arrowCount = 0; + + for (int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null) { + if (itemstack.getItem() == CinderLoE.toxicCore) { + if (toxicCore != null) { + return false; // Only one toxic core allowed + } + toxicCore = itemstack; + } else if (itemstack.getItem() == Items.arrow) { + arrowCount++; + } else { + return false; // Invalid item in grid + } + } + } + + if (toxicCore != null && arrowCount > 0) { + return toxicCore.getItemDamage() + arrowCount <= toxicCore.getMaxDamage(); + } + + return false; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting inv) { + ItemStack toxicCore = null; + int arrowCount = 0; + + for (int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null) { + if (itemstack.getItem() == CinderLoE.toxicCore) { + toxicCore = itemstack; + } else if (itemstack.getItem() == Items.arrow) { + arrowCount++; + } + } + } + + if (toxicCore != null && arrowCount > 0) { + ItemStack resultStack = new ItemStack(result.getItem(), arrowCount); + return resultStack; + } + + return null; + } + + @Override + public int getRecipeSize() { + return 9; + } + + @Override + public ItemStack getRecipeOutput() { + return result; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/recipes.java b/src/main/java/com/zivilon/cinder_loe/recipes.java index 196a5e2..2527bab 100644 --- a/src/main/java/com/zivilon/cinder_loe/recipes.java +++ b/src/main/java/com/zivilon/cinder_loe/recipes.java @@ -7,6 +7,7 @@ import lotr.common.recipe.LOTRMillstoneRecipes; 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; @@ -41,59 +42,49 @@ public class recipes { public static void registerGeneralRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.bowAsh), " XS", "X S", " XS", - 'X', CinderLoE.ingotAsh, 'S', Items.string)); + 'X', CinderLoE.ingotAsh, 'S', Items.string)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.spearAsh), " X", " Y ", "Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.swordAsh), " X ", " X ", " Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.staffAsh), " XX", " YX", "Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.battleaxeAsh), "XXX", "XYX", " Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.pikeAsh), " X", " YX", "Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.hammerAsh), "XYX", "XYX", " Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.daggerAsh), "X ", "Y ", - 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); + 'X', CinderLoE.ingotAsh, 'Y', "stickWood")); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.bowAsh), new Object[] { " XS", "X S", " XS", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('S'), Items.string })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('S'), Items.string })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.spearAsh), new Object[] { " X", " Y ", "Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.swordAsh), new Object[] { " X ", " X ", " Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.staffAsh), new Object[] { " XX", " YX", "Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.battleaxeAsh), new Object[] { "XXX", "XYX", " Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.pikeAsh), new Object[] { " X", " YX", "Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.hammerAsh), new Object[] { "XYX", "XYX", " Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.daggerAsh), new Object[] { "X ", "Y ", - Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); + Character.valueOf('X'), CinderLoE.ingotAsh, Character.valueOf('Y'), "stickWood" })); GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.warDart, 1, 0), new Object[] { " Y", "X ", Character.valueOf('X'), "feather", Character.valueOf('Y'), "stickWood" })); - GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.warDart, 1, 0), new Object[] { " Y", "X ", - Character.valueOf('X'), "feather", Character.valueOf('Y'), "stickWood" })); + GameRegistry.addRecipe(new ToxicCoreArrowsRecipe(new ItemStack(LOTRMod.arrowPoisoned))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.spicedHam), CinderLoE.spice, Items.cooked_porkchop)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 1), LOTRMod.copper, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 2), LOTRMod.bronze, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 3), Items.iron_ingot, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 4), LOTRMod.orcSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 5), LOTRMod.dwarfSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 6), LOTRMod.urukSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 7), LOTRMod.blueDwarfSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 8), LOTRMod.blackUrukSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 9), LOTRMod.elfSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 10), LOTRMod.gildedIron, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 11), CinderLoE.redDwarfSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 12), LOTRMod.mithril, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); -// GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDartHeads, 2, 14), LOTRMod.morgulSteel, new ItemStack(LOTRMod.chisel, 1, OreDictionary.WILDCARD_VALUE))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 1), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 1))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 2), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 2))); @@ -156,136 +147,136 @@ public class recipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.pelmen), Items.wheat, "meat", LOTRMod.salt)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderBlock), "XXX", "XYX", "XXX", - 'X', Blocks.stone, 'Y', LOTRMod.balrogFire)); + 'X', Blocks.stone, 'Y', LOTRMod.balrogFire)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.reedBale), "XXX", "XXX", "XXX", - 'X', LOTRMod.reeds)); + 'X', LOTRMod.reeds)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.leatherBundle), "XXX", "XXX", "XXX", - 'X', Items.leather)); + 'X', Items.leather)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.pretzel, 2), "XYX", " X ", - 'X', CinderLoE.dough, 'Y', LOTRMod.salt)); + 'X', CinderLoE.dough, 'Y', LOTRMod.salt)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.dough, 8), "XXX", "XYX", "XXX", - 'X', CinderLoE.flour, 'Y', Items.water_bucket)); + 'X', CinderLoE.flour, 'Y', Items.water_bucket)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.fishBarrel), "XXX", "XXX", "XXX", - 'X', Items.fish)); + 'X', Items.fish)); //GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.rustedsword, 8), new Object[] { "X", "y", "y", //Character.valueOf('Y'), Items.iron_ingot, Character.valueOf('X'), "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.silverChain, 8), "X", "X", "X", - 'X', LOTRMod.silver)); + 'X', LOTRMod.silver)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.goldChain, 8), "X", "X", "X", - 'X', Items.gold_ingot)); + 'X', Items.gold_ingot)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.ironChain, 8), "X", "X", "X", - 'X', Items.iron_ingot)); + 'X', Items.iron_ingot)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.bronzeChain, 8), "X", "X", "X", - 'X', LOTRMod.bronze)); + 'X', LOTRMod.bronze)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cindercobble, 4, 0), "XX", "XX", - 'X', LOTRMod.cobblebrick)); + 'X', LOTRMod.cobblebrick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cutDrystone, 4), "XX", "XX", - 'X', new ItemStack(CinderLoE.cindercobble, 1, 0))); + 'X', new ItemStack(CinderLoE.cindercobble, 1, 0))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LOTRMod.cobblebrick, 4, 0), "XX", "XX", - 'X', CinderLoE.cutDrystone)); + 'X', CinderLoE.cutDrystone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.reeflessCoral, 1), "X", - 'X', LOTRMod.coralReef)); + 'X', LOTRMod.coralReef)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.plaster, 4), "XYX", "YXY", "XYX", - 'X', Items.paper, 'Y', Blocks.clay)); + 'X', Items.paper, 'Y', Blocks.clay)); // Cinder Stony Blocks GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cindercobble, 4, 1), "XY", "YX", - 'X', new ItemStack(LOTRMod.rock, 1, 0), 'Y', LOTRMod.mordorGravel)); + 'X', new ItemStack(LOTRMod.rock, 1, 0), 'Y', LOTRMod.mordorGravel)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LOTRMod.banner, 1, 44), " Y ", " X ", " Z ", - 'X', "stickWood", 'Y', new ItemStack(Blocks.wool, 1, 14), 'Z', "plankWood")); + 'X', "stickWood", 'Y', new ItemStack(Blocks.wool, 1, 14), 'Z', "plankWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LOTRMod.banner, 1, 45), " Y ", " X ", " Z ", - 'X', "stickWood", 'Y', new ItemStack(Blocks.wool, 1, 11), 'Z', "plankWood")); + 'X', "stickWood", 'Y', new ItemStack(Blocks.wool, 1, 11), 'Z', "plankWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LOTRMod.banner, 1, 46), " Y ", " X ", " Z ", - 'X', "stickWood", 'Y', new ItemStack(Blocks.wool, 1, 13), 'Z', "plankWood")); + 'X', "stickWood", 'Y', new ItemStack(Blocks.wool, 1, 13), 'Z', "plankWood")); // Furs and then carpets GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 0), "XX", "XX", - 'X', new ItemStack(LOTRMod.fur, 1))); + 'X', new ItemStack(LOTRMod.fur, 1))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 0), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 0))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 0))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 1), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 0))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 0))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 1), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 1))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 1))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 2), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 1))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 1))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 2), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 2))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 2))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 3), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 2))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 2))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 3), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 3))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 3))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 4), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 3))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 3))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 4), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 4))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 4))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 5), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 4))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 4))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 5), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 5))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 5))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 6), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 5))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 5))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 6), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 6))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 6))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 7), "XX", "XX", - 'X', new ItemStack(LOTRMod.lionFur, 1))); + 'X', new ItemStack(LOTRMod.lionFur, 1))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 7), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 7))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 7))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderfur, 2, 8), "XX", "XX", - 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 6))); + 'X', new ItemStack(CinderLoE.cinderFurItem, 1, 6))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.furCarpet, 3, 8), "XX", - 'X', new ItemStack(CinderLoE.cinderfur, 1, 8))); + 'X', new ItemStack(CinderLoE.cinderfur, 1, 8))); } public static void registerRedDwarvenRecipes() { LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetRedDwarf), "XXX", "X X", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bodyRedDwarf), "X X", "XXX", "XXX", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.legsRedDwarf), "XXX", "X X", "X X", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bootsRedDwarf), "X X", "X X", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.spearRedDwarf), " X", " Y ", "Y ", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.swordRedDwarf), " X ", " X ", " Y ", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.battleaxeRedDwarf), "XXX", "XYX", " Y ", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.pikeRedDwarf), " X", " YX", "Y ", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.hammerRedDwarf), "XYX", "XYX", " Y ", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.daggerRedDwarf), "X ", "Y ", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.crossbowRedDwarf), "XXY", "ZYX", "YZX", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood", Character.valueOf('Z'), "string")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "stickWood", Character.valueOf('Z'), "string")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.boarArmorRedDwarf), "X ", "XYX", "XXX", - Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "leather")); + Character.valueOf('X'), CinderLoE.redDwarfSteel, Character.valueOf('Y'), "leather")); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.blockRedDwarfSteel), "XXX", "XXX", "XXX", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.redDwarfSteel), "X ", " ", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.chandelierRedDwarf, 2), " X ", "ZYZ", " ", - Character.valueOf('X'), "stickWood", Character.valueOf('Y'), CinderLoE.redDwarfSteel, Character.valueOf('Z'), Blocks.torch)); + Character.valueOf('X'), "stickWood", Character.valueOf('Y'), CinderLoE.redDwarfSteel, Character.valueOf('Z'), Blocks.torch)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.barsRedDwarf, 16), "XXX", "XXX", " ", - Character.valueOf('X'), CinderLoE.redDwarfSteel)); + Character.valueOf('X'), CinderLoE.redDwarfSteel)); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.dwarvenBrickRuned, 4), " X ", "XYX", " X ", - Character.valueOf('X'), new ItemStack(LOTRMod.brick, 1, 6), Character.valueOf('Y'), Items.gold_nugget)); + Character.valueOf('X'), new ItemStack(LOTRMod.brick, 1, 6), Character.valueOf('Y'), Items.gold_nugget)); GameRegistry.addShapelessRecipe(new ItemStack(CinderLoE.redDwarfSteel, 9), new ItemStack(CinderLoE.blockRedDwarfSteel)); GameRegistry.addRecipe(new ItemStack(CinderLoE.blockRedDwarfSteel, 1), "XXX", "XXX", "XXX", - Character.valueOf('X'), CinderLoE.redDwarfSteel); + Character.valueOf('X'), CinderLoE.redDwarfSteel); LOTRRecipes.dwarvenRecipes.add(new ShapedOreRecipe(new ItemStack(LOTRMod.banner, 1, 42), " YR", " X ", " Z ", - Character.valueOf('X'), "stickWood", Character.valueOf('Y'), Blocks.wool, Character.valueOf('Z'), "plankWood", Character.valueOf('R'), "dyeRed")); + Character.valueOf('X'), "stickWood", Character.valueOf('Y'), Blocks.wool, Character.valueOf('Z'), "plankWood", Character.valueOf('R'), "dyeRed")); GameRegistry.addRecipe(new LOTRRecipePoisonWeapon(CinderLoE.daggerRedDwarf, CinderLoE.daggerRedDwarfPoisoned)); } @@ -300,87 +291,96 @@ public class recipes { OreDictionary.registerOre("bone", LOTRMod.wargBone); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetLimwaith), "XXX", "Y Y", - Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); + Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bodyLimwaith), "X X", "YYY", "XXX", - Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); + Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.legsLimwaith), "XXX", "Y Y", "X X", - Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); + Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bootsLimwaith), "Y Y", "X X", - Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); + Character.valueOf('X'), LOTRMod.driedReeds, Character.valueOf('Y'), new ItemStack(LOTRMod.planks, 1, 15))); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.spearLimwaith), " X", " Y ", "Y ", - Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.truncheonLimwaith), " X ", " X ", " Y ", - Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.battleaxeLimwaith), "XXX", "XYX", " Y ", - Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.tridentLimwaith), " XX", " YX", "Y ", - Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.daggerLimwaith), "X ", "Y ", - Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), "bone", Character.valueOf('Y'), "stickWood")); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.blowgunLimwaith), "YXX", " ", " ", - Character.valueOf('X'), LOTRMod.reeds, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), LOTRMod.reeds, Character.valueOf('Y'), "stickWood")); GameRegistry.addRecipe(new LOTRRecipePoisonWeapon(CinderLoE.daggerLimwaith, CinderLoE.daggerLimwaithPoisoned)); LOTRRecipes.moredainRecipes.add(new ShapelessOreRecipe(new ItemStack(CinderLoE.bonemold), "bone", new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15))); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetboneLimwaith), "XXX", "Y Y", - Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); + Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bodyboneLimwaith), "X X", "YYY", "XXX", - Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); + Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.legsboneLimwaith), "XXX", "Y Y", "X X", - Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); + Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bootsboneLimwaith), "Y Y", "X X", - Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); + Character.valueOf('X'), "bone", Character.valueOf('Y'), CinderLoE.bonemold)); LOTRRecipes.moredainRecipes.add(new ShapedOreRecipe(new ItemStack(LOTRMod.banner, 1, 43), " YR", " X ", " Z ", - Character.valueOf('X'), "stickWood", Character.valueOf('Y'), Blocks.wool, Character.valueOf('Z'), "plankWood", Character.valueOf('R'), LOTRMod.reeds)); + Character.valueOf('X'), "stickWood", Character.valueOf('Y'), Blocks.wool, Character.valueOf('Z'), "plankWood", Character.valueOf('R'), LOTRMod.reeds)); } public static void registerBreeRecipes() { LOTRRecipes.breeRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetBreeKettle), "XYX", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), CinderLoE.helmetBree)); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), CinderLoE.helmetBree)); LOTRRecipes.breeRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetBree), "XXX", "X X", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.breeRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bodyBree), "X X", "XXX", "XXX", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.breeRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.legsBree), "XXX", "X X", "X X", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.breeRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bootsBree), "X X", "X X", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.breeRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.swordBree), " X ", " X ", " Y ", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), "stickWood")); } public static void registerAngmarRecipes() { LOTRRecipes.angmarRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetRhudaur), "XXX", "X X", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.angmarRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bodyRhudaur), "X X", "XXX", "XXX", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.angmarRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.legsRhudaur), "XXX", "X X", "X X", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); LOTRRecipes.angmarRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bootsRhudaur), "X X", "X X", - Character.valueOf('X'), Items.iron_ingot)); + Character.valueOf('X'), Items.iron_ingot)); } public static void registerArnorRecipes() { LOTRRecipes.rangerRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.helmetArnorBanner), "YYY", "Y Y", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); LOTRRecipes.rangerRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bodyArnorBanner), "Y Y", "XXX", "YYY", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); LOTRRecipes.rangerRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.legsArnorBanner), "YYY", "X X", "Y Y", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); LOTRRecipes.rangerRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.bootsArnorBanner), "X X", "X X", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), Items.leather)); LOTRRecipes.rangerRecipes.add(new ShapedOreRecipe(new ItemStack(CinderLoE.maceArnor), " XX", " XX", "Y ", - Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), "stickWood")); + Character.valueOf('X'), Items.iron_ingot, Character.valueOf('Y'), "stickWood")); } public static void registerBrewingRecipes() { System.out.println("[CinderLoE] Registering Brewing recipes... We like to drink! jk I hate alcohol"); - CinderBrewingRecipes.addCustomBrewingRecipe(new ItemStack(LOTRMod.mugTauredainCocoa, BARREL_CAPACITY), - new ItemStack(Items.dye, 1, 3), - new ItemStack(Items.dye, 1, 3), - new ItemStack(Items.dye, 1, 3), - new ItemStack(LOTRMod.doubleFlower, 1, 2), - new ItemStack(LOTRMod.doubleFlower, 1, 3), - new ItemStack(LOTRMod.mugMilk)); + CinderBrewingRecipes.addCustomBrewingRecipe(new ItemStack(LOTRMod.mugTauredainCocoa, BARREL_CAPACITY), + new ItemStack(Items.dye, 1, 3), + new ItemStack(Items.dye, 1, 3), + new ItemStack(Items.dye, 1, 3), + new ItemStack(LOTRMod.doubleFlower, 1, 2), + new ItemStack(LOTRMod.doubleFlower, 1, 3), + new ItemStack(LOTRMod.mugMilk)); + + 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), + new ItemStack(CinderLoE.chocolatebar), + new ItemStack(CinderLoE.chocolatebar), + }); } public static void registerMillstoneRecipes() { diff --git a/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityForgingStation.java b/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityForgingStation.java new file mode 100644 index 0000000..c7313c5 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityForgingStation.java @@ -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; + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityShadowTile.java b/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityShadowTile.java new file mode 100644 index 0000000..c66a0b2 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/tileentity/TileEntityShadowTile.java @@ -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"); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java b/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java index e91aedb..b231fef 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java +++ b/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java @@ -14,6 +14,8 @@ public class DurableItemCrafter { static { customItems.add(LOTRMod.rollingPin); customItems.add(LOTRMod.chisel); - customItems.add(CinderLoE.cleaver); + customItems.add(CinderLoE.toxicCore); + + exceptionItems.add(LOTRMod.ithildin); } } diff --git a/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java b/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java index 7c811cf..dcf9277 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java +++ b/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java @@ -10,5 +10,6 @@ import com.zivilon.cinder_loe.CinderLoE; public class LOTREnchantmentExclusions { public static List exclusions = new ArrayList<>(); static { + exclusions.add(CinderLoE.celeiniss); } } diff --git a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java index b64a548..9e7fe34 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java +++ b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java @@ -200,6 +200,38 @@ public class Utilities { return LOTREnchantmentHelper.hasEnchant(held_item, LOTREnchantment.fire); } + public static int[] countNexArmor(String player_name) { + EntityPlayer player = getPlayerByName(player_name); + int[] nexPieces = new int[4]; + + if (player == null) { + System.out.println("[CinderLoE] Warning! Player not found: " + player_name); + return nexPieces; + } + + for (ItemStack armor : player.inventory.armorInventory) { + if (armor != null && armor.getItem() instanceof LOTRItemArmor) { + LOTRItemArmor itemArmor = (LOTRItemArmor) armor.getItem(); + if (itemArmor.getLOTRArmorMaterial() == CinderLoE.MATERIAL_NEX_ICE) { + nexPieces[0]++; + } else if (itemArmor.getLOTRArmorMaterial() == CinderLoE.MATERIAL_NEX_FIRE) { + nexPieces[1]++; + } else if (itemArmor.getLOTRArmorMaterial() == CinderLoE.MATERIAL_NEX_SHADOW) { + nexPieces[2]++; + } else if (itemArmor.getLOTRArmorMaterial() == CinderLoE.MATERIAL_NEX_TOXIN) { + nexPieces[3]++; + } + } + } + + if (nexPieces[0] == 4) nexPieces[0] = 5; + if (nexPieces[1] == 4) nexPieces[1] = 5; + if (nexPieces[2] == 4) nexPieces[2] = 5; + if (nexPieces[3] == 4) nexPieces[3] = 5; + + 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; diff --git a/src/main/java/com/zivilon/cinder_loe/util/VT_additions.java b/src/main/java/com/zivilon/cinder_loe/util/VT_additions.java index cc34e81..1e1143b 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/VT_additions.java +++ b/src/main/java/com/zivilon/cinder_loe/util/VT_additions.java @@ -1,9 +1,11 @@ package com.zivilon.cinder_loe.util; +import com.zivilon.cinder_loe.entity.npc.frozen_dungeon.Nex; + public class VT_additions { public static String applyCustomPlaceholders(String scriptLine) { -/* scriptLine = scriptLine.replace("", String.valueOf(Nex.get_nex_phase())); - scriptLine = scriptLine.replace("", String.valueOf(Nex.get_nex_health()));*/ + scriptLine = scriptLine.replace("", String.valueOf(Nex.get_nex_phase())); + scriptLine = scriptLine.replace("", String.valueOf(Nex.get_nex_health())); return scriptLine; } } diff --git a/src/main/resources/assets/lotr/textures/blocks/nex_ice_crystal.png b/src/main/resources/assets/lotr/textures/blocks/nex_ice_crystal.png deleted file mode 100644 index 571d58d..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/nex_ice_crystal.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/items/aulendur_hammer.png b/src/main/resources/assets/lotr/textures/items/aulendur_hammer.png new file mode 100644 index 0000000..fcaff5e Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/aulendur_hammer.png differ diff --git a/src/main/resources/assets/lotr/textures/items/celeiniss.png b/src/main/resources/assets/lotr/textures/items/celeiniss.png index a6288b0..6a82c7e 100644 Binary files a/src/main/resources/assets/lotr/textures/items/celeiniss.png and b/src/main/resources/assets/lotr/textures/items/celeiniss.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large/aulendur_hammer.png b/src/main/resources/assets/lotr/textures/items/large/aulendur_hammer.png new file mode 100644 index 0000000..aa65433 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large/aulendur_hammer.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large/celeiniss.png b/src/main/resources/assets/lotr/textures/items/large/celeiniss.png deleted file mode 100644 index 4401d3c..0000000 Binary files a/src/main/resources/assets/lotr/textures/items/large/celeiniss.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/celeiniss.png b/src/main/resources/assets/lotr/textures/items/large2/celeiniss.png new file mode 100644 index 0000000..6a82c7e Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/celeiniss.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_ancient.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_ancient.png new file mode 100644 index 0000000..5d17ad5 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_ancient.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_ancient_glow.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_ancient_glow.png new file mode 100644 index 0000000..e79fb81 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_ancient_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_mortals.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_mortals.png new file mode 100644 index 0000000..f477afb Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_mortals.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_mortals_glow.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_mortals_glow.png new file mode 100644 index 0000000..d1c63c9 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_mortals_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_sauron.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_sauron.png new file mode 100644 index 0000000..58523ec Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_sauron.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_sauron_glow.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_sauron_glow.png new file mode 100644 index 0000000..58eaee4 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_sauron_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_udun.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_udun.png new file mode 100644 index 0000000..3d1e3d6 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_udun.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_udun_glow.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_udun_glow.png new file mode 100644 index 0000000..82298d5 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_udun_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_valar.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_valar.png new file mode 100644 index 0000000..92c0334 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_valar.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large2/nimveil_valar_glow.png b/src/main/resources/assets/lotr/textures/items/large2/nimveil_valar_glow.png new file mode 100644 index 0000000..1998ca9 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large2/nimveil_valar_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_ancient.png b/src/main/resources/assets/lotr/textures/items/nimveil_ancient.png new file mode 100644 index 0000000..4c8b4c9 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_ancient.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_red_dwarven.png b/src/main/resources/assets/lotr/textures/items/nimveil_ancient_glow.png similarity index 53% rename from src/main/resources/assets/lotr/textures/items/war_red_dwarven.png rename to src/main/resources/assets/lotr/textures/items/nimveil_ancient_glow.png index 7ee04b7..4f45f68 100644 Binary files a/src/main/resources/assets/lotr/textures/items/war_red_dwarven.png and b/src/main/resources/assets/lotr/textures/items/nimveil_ancient_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_blade.png b/src/main/resources/assets/lotr/textures/items/nimveil_blade.png new file mode 100644 index 0000000..31a5bec Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_blade.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_hilt.png b/src/main/resources/assets/lotr/textures/items/nimveil_hilt.png new file mode 100644 index 0000000..d717407 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_hilt.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_mortals.png b/src/main/resources/assets/lotr/textures/items/nimveil_mortals.png new file mode 100644 index 0000000..cf6808f Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_mortals.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_mortals_glow.png b/src/main/resources/assets/lotr/textures/items/nimveil_mortals_glow.png new file mode 100644 index 0000000..a032ecd Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_mortals_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_sauron.png b/src/main/resources/assets/lotr/textures/items/nimveil_sauron.png new file mode 100644 index 0000000..082eb5e Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_sauron.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_sauron_glow.png b/src/main/resources/assets/lotr/textures/items/nimveil_sauron_glow.png new file mode 100644 index 0000000..ef5de0d Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_sauron_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_udun.png b/src/main/resources/assets/lotr/textures/items/nimveil_udun.png new file mode 100644 index 0000000..27a6c1c Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_udun.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_udun_glow.png b/src/main/resources/assets/lotr/textures/items/nimveil_udun_glow.png new file mode 100644 index 0000000..fc1c990 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_udun_glow.png differ diff --git a/src/main/resources/assets/lotr/textures/items/nimveil_valar.png b/src/main/resources/assets/lotr/textures/items/nimveil_valar.png new file mode 100644 index 0000000..b3b7393 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/nimveil_valar.png differ