diff --git a/.gradle/8.2.1/checksums/checksums.lock b/.gradle/8.2.1/checksums/checksums.lock deleted file mode 100644 index 9982850..0000000 Binary files a/.gradle/8.2.1/checksums/checksums.lock and /dev/null differ diff --git a/.gradle/8.2.1/dependencies-accessors/dependencies-accessors.lock b/.gradle/8.2.1/dependencies-accessors/dependencies-accessors.lock deleted file mode 100644 index 451a4ce..0000000 Binary files a/.gradle/8.2.1/dependencies-accessors/dependencies-accessors.lock and /dev/null differ diff --git a/.gradle/8.2.1/dependencies-accessors/gc.properties b/.gradle/8.2.1/dependencies-accessors/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.gradle/8.2.1/fileChanges/last-build.bin b/.gradle/8.2.1/fileChanges/last-build.bin deleted file mode 100644 index f76dd23..0000000 Binary files a/.gradle/8.2.1/fileChanges/last-build.bin and /dev/null differ diff --git a/.gradle/8.2.1/fileHashes/fileHashes.lock b/.gradle/8.2.1/fileHashes/fileHashes.lock deleted file mode 100644 index 2a4130d..0000000 --- a/.gradle/8.2.1/fileHashes/fileHashes.lock +++ /dev/null @@ -1 +0,0 @@ -�[�i5�ï¿ûo \ No newline at end of file diff --git a/.gradle/8.2.1/gc.properties b/.gradle/8.2.1/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 9eeb0e9..8c9e31a 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -4,9 +4,12 @@ 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.projectile.*; import com.zivilon.cinder_loe.client.render.corrupt.*; import com.zivilon.cinder_loe.command.CommandCinderCharacter; import com.zivilon.cinder_loe.entity.*; +import com.zivilon.cinder_loe.entity.projectile.*; import com.zivilon.cinder_loe.entity.corrupt.*; import com.zivilon.cinder_loe.entity.npc.*; import com.zivilon.cinder_loe.entity.trader.BladorthinSmith; @@ -107,6 +110,10 @@ 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; // Blocks @@ -132,6 +139,9 @@ public class CinderLoE { public static Block bronzeChain; public static Block plaster; public static Block voidblock; + public static Block shadowTile; + public static Block entityBarrier; + public static Block iceCage; //public static Block verticalWeaponRack; @@ -177,11 +187,35 @@ 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 firstAgeGlaive; + public static Item toxicCore; + + + // Misc // Common tools/weapons public static Item whip; public static Item cleaver; + public static Item warDart; + public static Item warDartHeads; // Elite Armors public static Item helmetserpent; @@ -300,7 +334,6 @@ public class CinderLoE { public static Item BreeCaptainSpawnEgg; public static Item BreeSoldierBannerBearerSpawnEgg; public static Item BreeOutriderSpawnEgg; - public static Item SauronSpawnEgg; public static Item utumnoSlaveSpawnEgg; @@ -358,7 +391,7 @@ public class CinderLoE { event.registerServerCommand(new CommandCinderCharacter()); } - public void registerEntities() { // Last ID added: 43 + public void registerEntities() { // Last ID added: 45 ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock"); ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword"); @@ -376,6 +409,8 @@ public class CinderLoE { // Others EntityRegistry.registerModEntity(DarkSpider.class, "DarkSpider", (entityID + 42), this, 64, 1, true); + EntityRegistry.registerModEntity(Nex.class, "Nex", (entityID + 44), this, 64, 1, true); + EntityRegistry.registerModEntity(EntityWarDart.class, "WarDart", (entityID + 45), this, 64, 1, true); EntityRegistry.registerModEntity(CorruptDwarf.class, "CorruptDwarf", (entityID + 36), this, 64, 1, true); EntityRegistry.registerModEntity(CorruptElf.class, "CorruptElf", (entityID + 37), this, 64, 1, true); @@ -491,6 +526,12 @@ public class CinderLoE { GameRegistry.registerBlock(mistBlock, "mist"); voidblock = (new voidblock()); GameRegistry.registerBlock(voidblock, "voidblock"); + shadowTile = (new ShadowTile()); + GameRegistry.registerBlock(shadowTile, "shadow_tile"); + entityBarrier = (new EntityBarrier()); + GameRegistry.registerBlock(entityBarrier, "entity_barrier"); + iceCage = (new IceCage()); + GameRegistry.registerBlock(iceCage, "ice_cage"); // Building Blocks cutDrystone = (new cutDrystone()); @@ -594,7 +635,7 @@ public class CinderLoE { * Item Registation, add up the "last ID added" upon adding a new item * Weapons will need to be linked */ - // Last ID added: 127 + // Last ID added: 147 // ==Food Items== ItemRegistration.registerItem(onion, "onion", 89); @@ -671,6 +712,10 @@ public class CinderLoE { // Misc EVENT = getLOTRMaterialByName("EVENT"); MATERIAL_JADE = getLOTRMaterialByName("JADE"); + MATERIAL_NEX_ICE = getLOTRMaterialByName("NEX_ICE"); + MATERIAL_NEX_FIRE = getLOTRMaterialByName("NEX_FIRE"); + MATERIAL_NEX_TOXIN = getLOTRMaterialByName("NEX_TOXIN"); + MATERIAL_NEX_SHADOW = getLOTRMaterialByName("NEX_SHADOW"); frostblade = (new LOTRItemSword(EVENT)).setUnlocalizedName("lotr:frostblade").setTextureName("lotr:frostblade"); daggervoid = (new VoidDagger(EVENT)).addWeaponDamage(5.0F).setUnlocalizedName("lotr:daggerVoid").setTextureName("lotr:daggerVoid").setCreativeTab(null); @@ -683,6 +728,46 @@ public class CinderLoE { legsJade = (new LOTRItemArmor(MATERIAL_JADE, 2,"leggings")).setUnlocalizedName("lotr:legsJade").setTextureName("lotr:legsJade").setCreativeTab(null); bootsJade = (new LOTRItemArmor(MATERIAL_JADE, 3)).setUnlocalizedName("lotr:bootsJade").setTextureName("lotr:bootsJade").setCreativeTab(null); + helmetNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 0)).setUnlocalizedName("lotr:helmetNexIce").setTextureName("lotr:helmetNexIce").setCreativeTab(null); + bodyNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 1)).setUnlocalizedName("lotr:bodyNexIce").setTextureName("lotr:bodyNexIce").setCreativeTab(null); + legsNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 2)).setUnlocalizedName("lotr:legsNexIce").setTextureName("lotr:legsNexIce").setCreativeTab(null); + bootsNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 3)).setUnlocalizedName("lotr:bootsNexIce").setTextureName("lotr:bootsNexIce").setCreativeTab(null); + helmetNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 0)).setUnlocalizedName("lotr:helmetNexFire").setTextureName("lotr:helmetNexFire").setCreativeTab(null); + bodyNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 1)).setUnlocalizedName("lotr:bodyNexFire").setTextureName("lotr:bodyNexFire").setCreativeTab(null); + legsNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 2)).setUnlocalizedName("lotr:legsNexFire").setTextureName("lotr:legsNexFire").setCreativeTab(null); + bootsNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 3)).setUnlocalizedName("lotr:bootsNexFire").setTextureName("lotr:bootsNexFire").setCreativeTab(null); + helmetNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 0)).setUnlocalizedName("lotr:helmetNexToxin").setTextureName("lotr:helmetNexToxin").setCreativeTab(null); + bodyNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 1)).setUnlocalizedName("lotr:bodyNexToxin").setTextureName("lotr:bodyNexToxin").setCreativeTab(null); + legsNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 2)).setUnlocalizedName("lotr:legsNexToxin").setTextureName("lotr:legsNexToxin").setCreativeTab(null); + bootsNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 3)).setUnlocalizedName("lotr:bootsNexToxin").setTextureName("lotr:bootsNexToxin").setCreativeTab(null); + helmetNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 0)).setUnlocalizedName("lotr:helmetNexShadow").setTextureName("lotr:helmetNexShadow").setCreativeTab(null); + bodyNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 1)).setUnlocalizedName("lotr:bodyNexShadow").setTextureName("lotr:bodyNexShadow").setCreativeTab(null); + legsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 2)).setUnlocalizedName("lotr:legsNexShadow").setTextureName("lotr:legsNexShadow").setCreativeTab(null); + bootsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 3)).setUnlocalizedName("lotr:bootsNexShadow").setTextureName("lotr:bootsNexShadow").setCreativeTab(null); + firstAgeGlaive = (new LOTRItemPolearm(MATERIAL_NEX_SHADOW)).setUnlocalizedName("lotr:firstAgeGlaive").setTextureName("lotr:firstAgeGlaive").setCreativeTab(null); + toxicCore = (new ToxicCore()).setUnlocalizedName("lotr:toxicCore").setTextureName("lotr:toxicCore").setCreativeTab(null); + + linkLOTRWeapon(firstAgeGlaive, "firstAgeGlaive"); + + ItemRegistration.registerItem(helmetNexIce,"helmetNexIce",130); + ItemRegistration.registerItem(bodyNexIce,"bodyNexIce",131); + ItemRegistration.registerItem(legsNexIce,"legsNexIce",132); + ItemRegistration.registerItem(bootsNexIce,"bootsNexIce",133); + ItemRegistration.registerItem(helmetNexFire,"helmetNexFire",134); + ItemRegistration.registerItem(bodyNexFire,"bodyNexFire",135); + ItemRegistration.registerItem(legsNexFire,"legsNexFire",136); + ItemRegistration.registerItem(bootsNexFire,"bootsNexFire",137); + ItemRegistration.registerItem(helmetNexToxin,"helmetNexToxin",138); + ItemRegistration.registerItem(bodyNexToxin,"bodyNexToxin",139); + ItemRegistration.registerItem(legsNexToxin,"legsNexToxin",140); + ItemRegistration.registerItem(bootsNexToxin,"bootsNexToxin",141); + ItemRegistration.registerItem(helmetNexShadow,"helmetNexShadow",142); + ItemRegistration.registerItem(bodyNexShadow,"bodyNexShadow",143); + ItemRegistration.registerItem(legsNexShadow,"legsNexShadow",144); + ItemRegistration.registerItem(bootsNexShadow,"bootsNexShadow",145); + ItemRegistration.registerItem(firstAgeGlaive, "firstAgeGlaive",146); + ItemRegistration.registerItem(toxicCore,"toxicCore",147); + ItemRegistration.registerItem(frostblade, "frostblade", 30); ItemRegistration.registerItem(daggervoid, "daggerVoid", 96); ItemRegistration.registerItem(spearsolidgold, "spearsolidgold", 31); @@ -701,10 +786,16 @@ public class CinderLoE { // Common Tools/Weapons cleaver = (new LOTRItemDagger(GONDOR)).setUnlocalizedName("lotr:cleaver").setTextureName("lotr:cleaver"); + warDart = (new WarDart()).setUnlocalizedName("war_dart").setTextureName("lotr:war_dart"); + warDartHeads = (new WarDartHeads()).setUnlocalizedName("war_dart_heads").setTextureName("lotr:war_dart_heads_0"); ItemRegistration.registerItem(cleaver,"cleaver",127); linkLOTRWeapon(cleaver, "cleaver"); + ItemRegistration.registerItem(warDart,"warDart",128); + ItemRegistration.registerItem(warDartHeads,"warDartHeads",129); + + //ASH MATERIAL_ASH = getLOTRMaterialByName("ASH"); ingotAsh = new Item().setUnlocalizedName("lotr:ingotAsh").setTextureName("lotr:ingotAsh").setCreativeTab((CreativeTabs) materials); @@ -965,6 +1056,8 @@ public class CinderLoE { public void setup() { // RenderingRegistry.registerEntityRenderingHandler(HaradLevy.class, new LOTRRenderNearHaradrim()); // RenderingRegistry.registerEntityRenderingHandler(DwarfLevy.class, new LOTRRenderDwarf()); + RenderingRegistry.registerBlockHandler(new RenderIceCage()); + RenderingRegistry.registerEntityRenderingHandler(EntityWarDart.class, new RenderWarDart()); RenderingRegistry.registerEntityRenderingHandler(BladorthinSmith.class, new LOTRRenderDorwinionElfVintner()); @@ -981,6 +1074,7 @@ public class CinderLoE { RenderingRegistry.registerEntityRenderingHandler(Renegade.class, new RenderRenegade()); RenderingRegistry.registerEntityRenderingHandler(RenegadeCaptain.class, new RenderRenegade()); RenderingRegistry.registerEntityRenderingHandler(Wraith.class, new RenderWraith()); + RenderingRegistry.registerEntityRenderingHandler(Nex.class, new RenderNex()); RenderingRegistry.registerEntityRenderingHandler(RedDwarfWarrior.class, new LOTRRenderDwarf()); RenderingRegistry.registerEntityRenderingHandler(RedDwarfArbalest.class, new LOTRRenderDwarf()); diff --git a/src/main/java/com/zivilon/cinder_loe/Materials.java b/src/main/java/com/zivilon/cinder_loe/Materials.java index d63df85..4990c3a 100644 --- a/src/main/java/com/zivilon/cinder_loe/Materials.java +++ b/src/main/java/com/zivilon/cinder_loe/Materials.java @@ -25,8 +25,10 @@ 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("BRONZE", 2000, 0.0F, 0.6F, 2, 7.0F, 10, LOTRMod.bronze); + modifyMaterial("NEX_ICE",1500, 0.0F, 0.8F, 0, 9.0F, 10, null); + modifyMaterial("NEX_FIRE",1500, 0.0F, 0.8F, 0, 9.0F, 10, null); + modifyMaterial("NEX_TOXIN",1500, 0.0F, 0.8F, 0, 9.0F, 10, null); + modifyMaterial("NEX_SHADOW",1500, 0.0F, 0.8F, 0, 9.0F, 10, null); } public static void modifyMaterial(String fieldName, int uses, float weapon_damage, float protection, int harvest_level, float speed, int enchantability, Item crafting_item) { diff --git a/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java b/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java new file mode 100644 index 0000000..4e8bb1c --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java @@ -0,0 +1,107 @@ +package com.zivilon.cinder_loe; + +import java.util.List; +import java.util.ArrayList; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraft.world.World; +import net.minecraft.item.crafting.IRecipe; + +public class ShapelessDurabilityRecipe implements IRecipe { + private final ItemStack recipeOutput; + private final List recipeItems; + private final Item toolItem; + + public ShapelessDurabilityRecipe(ItemStack result, Item toolItem, ItemStack... ingredients) { + this.recipeOutput = result; + this.recipeItems = new ArrayList<>(ingredients.length); + for (ItemStack ingredient : ingredients) { + this.recipeItems.add(ingredient); + } + this.toolItem = toolItem; + System.out.println("[CinderLoE] Created ShapelessDurabilityRecipe for: " + result.getUnlocalizedName()); + System.out.println("[CinderLoE] Ingredients: " + this.recipeItems); + } + + @Override + public boolean matches(InventoryCrafting inv, World worldIn) { + System.out.println("[CinderLoE] Checking matches for ShapelessDurabilityRecipe"); + + boolean hasTool = false; + List ingredientsCopy = new ArrayList<>(this.recipeItems); + + for (int i = 0; i < inv.getSizeInventory(); ++i) { + ItemStack stack = inv.getStackInSlot(i); + if (stack != null) { + if (stack.getItem() == toolItem) { + hasTool = true; + } else { + boolean matched = false; + for (ItemStack recipeStack : ingredientsCopy) { + if (stack.getItem() == recipeStack.getItem() && (recipeStack.getItemDamage() == 32767 || stack.getItemDamage() == recipeStack.getItemDamage())) { + matched = true; + ingredientsCopy.remove(recipeStack); + break; + } + } + if (!matched) { + System.out.println("[CinderLoE] Ingredient did not match: " + stack); + return false; + } + } + } + } + + boolean matches = hasTool && ingredientsCopy.isEmpty(); + System.out.println("[CinderLoE] ShapelessDurabilityRecipe match result: " + matches + ", has tool: " + hasTool); + return matches; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting inv) { + System.out.println("[CinderLoE] Getting crafting result for ShapelessDurabilityRecipe"); + return this.recipeOutput.copy(); + } + + @Override + public int getRecipeSize() { + return this.recipeItems.size(); + } + + @Override + public ItemStack getRecipeOutput() { + return this.recipeOutput; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) { + System.out.println("[CinderLoE] Getting remaining items for ShapelessDurabilityRecipe"); + ItemStack[] remainingItems = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < remainingItems.length; ++i) { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem() == toolItem) { + ItemStack tool = itemstack.copy(); + tool.setItemDamage(tool.getItemDamage() + 1); + System.out.println("[CinderLoE] Damaging tool: " + tool.getUnlocalizedName() + " | New Damage: " + tool.getItemDamage()); + + if (tool.getItemDamage() >= tool.getMaxDamage()) { + System.out.println("[CinderLoE] Tool is out of durability, breaking: " + tool.getUnlocalizedName()); + tool = null; + } + + remainingItems[i] = tool; + } else if (itemstack != null && itemstack.getItem().hasContainerItem(itemstack)) { + System.out.println("[CinderLoE] Consuming non-tool item " + itemstack.getUnlocalizedName()); + remainingItems[i] = itemstack.getItem().getContainerItem(itemstack); + } else { + remainingItems[i] = itemstack; + } + } + + return remainingItems; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/EntityBarrier.java b/src/main/java/com/zivilon/cinder_loe/blocks/EntityBarrier.java new file mode 100644 index 0000000..aed9edd --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/EntityBarrier.java @@ -0,0 +1,84 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.util.Utilities; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.util.IIcon; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import java.lang.reflect.Field; +import java.util.List; +import net.minecraft.client.Minecraft; +import cpw.mods.fml.common.FMLCommonHandler; + +public class EntityBarrier extends Block { + @SideOnly(Side.CLIENT) + public IIcon transparentIcon; + + public EntityBarrier() { + super(Material.rock); + setHardness(Float.MAX_VALUE); + setResistance(Float.MAX_VALUE); + setBlockTextureName(Utilities.toSnakeCase("lotr:entityBarrier")); + setBlockName(Utilities.toSnakeCase("lotr:entityBarrier")); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public int getRenderType() { + return -1; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.transparentIcon = iconRegister.registerIcon("lotr:invisible"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return this.transparentIcon; + } + + @SideOnly(Side.CLIENT) + private boolean isPlayerInSurvivalModeClientSide() { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + return player != null && !player.capabilities.isCreativeMode; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && isPlayerInSurvivalModeClientSide()) { + this.setBlockBounds(0.5F, 1.0F, 0.5F, 0.5F, 0.0F, 0.5F); // Zero-sized bounding box for survival players + } else { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); // Full-sized bounding box for others + } + } + + @Override + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) { + if (entity instanceof EntityPlayer) { + return; + } + AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F); + if (boundingBox != null && aabb.intersectsWith(boundingBox)) { + list.add(boundingBox); + } + } +} 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..a5cc3d5 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/IceCage.java @@ -0,0 +1,200 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.util.Utilities; +import com.zivilon.cinder_loe.client.render.block.RenderIceCage; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +import java.util.List; +import java.util.Random; + +public class IceCage extends Block { + @SideOnly(Side.CLIENT) + private IIcon blockIcon; + @SideOnly(Side.CLIENT) + private IIcon emptyIcon; + + public IceCage() { + super(Material.ice); + setHardness(2.0F); + setResistance(1.0F); + setStepSound(soundTypeGlass); + setBlockTextureName(Utilities.toSnakeCase("lotr:iceCage")); + setBlockName(Utilities.toSnakeCase("lotr:iceCage")); + setLightOpacity(5); // Semi-transparent + setCreativeTab(CreativeTabs.tabBlock); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public int getRenderType() { + return RenderIceCage.RENDER_ID; // Use the custom render type + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.blockIcon = iconRegister.registerIcon("lotr:ice_cage"); + this.emptyIcon = iconRegister.registerIcon("lotr:invisible"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if ((meta == 0 && side == 1) || (meta == 1 && side == 0)) { + return this.emptyIcon; + } + return this.blockIcon; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + return AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F); + } + + @Override + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { // Lower part + float thickness = 0.0625F; // 1/16th of a block thickness + + AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{ + AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall + AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall + AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall + AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F) // Back wall + }; + + for (AxisAlignedBB boundingBox : boundingBoxes) { + if (boundingBox != null && aabb.intersectsWith(boundingBox)) { + list.add(boundingBox); + } + } + } else if (meta == 1) { // Upper partplayer.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III + float thickness = 0.0625F; // 1/16th of a block thickness + + AxisAlignedBB[] boundingBoxes = new AxisAlignedBB[]{ + AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1.0F, z + 1.0F), // Left wall + AxisAlignedBB.getBoundingBox(x + 1.0F - thickness, y, z, x + 1.0F, y + 1.0F, z + 1.0F), // Right wall + AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + thickness), // Front wall + AxisAlignedBB.getBoundingBox(x, y, z + 1.0F - thickness, x + 1.0F, y + 1.0F, z + 1.0F), // Back wall + AxisAlignedBB.getBoundingBox(x, y + 1.0F - thickness, z, x + 1.0F, y + 1.0F, z + 1.0F) // Ceiling + }; + + for (AxisAlignedBB boundingBox : boundingBoxes) { + if (boundingBox != null && aabb.intersectsWith(boundingBox)) { + list.add(boundingBox); + } + } + } + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if (entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + AxisAlignedBB blockBounds = AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 1.0F, z + 1.0F); + if (blockBounds != null && blockBounds.intersectsWith(player.boundingBox)) { + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III + } + } + } + + @Override + public void updateTick(World world, int x, int y, int z, Random random) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { // Lower part + List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0F, y + 2.0F, z + 1.0F)); + for (EntityPlayer player : players) { + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 2, true)); // Mining Fatigue III + } + } + world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world)); + } + + @Override + public int tickRate(World world) { + return 1; // Adjust the tick rate as needed + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + return true; + } + + @Override + public boolean canPlaceBlockAt(World world, int x, int y, int z) { + return world.isAirBlock(x, y, z) && world.isAirBlock(x, y + 1, z); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); // Lower part + world.setBlock(x, y + 1, z, this, 1, 2); // Upper part + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { // Lower part + if (world.getBlock(x, y + 1, z) != this) { + world.setBlockToAir(x, y, z); + } + } else if (meta == 1) { // Upper part + if (world.getBlock(x, y - 1, z) != this) { + world.setBlockToAir(x, y, z); + } + } + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + if (meta == 0) { // Lower part + if (world.getBlock(x, y + 1, z) == this) { + world.setBlockToAir(x, y + 1, z); + } + } else if (meta == 1) { // Upper part + if (world.getBlock(x, y - 1, z) == this) { + world.setBlockToAir(x, y - 1, z); + } + } + super.breakBlock(world, x, y, z, block, meta); + } +} 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..7ad60e4 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/ShadowTile.java @@ -0,0 +1,44 @@ +package com.zivilon.cinder_loe.blocks; + +import lotr.common.LOTRCreativeTabs; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import net.minecraft.block.BlockPressurePlate; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.entity.player.EntityPlayer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import java.lang.reflect.Field; + +public class ShadowTile extends BlockPressurePlate { + + public ShadowTile() { + super("lotr:shadow_tile", Material.rock, BlockPressurePlate.Sensitivity.players); + try { + Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabMisc"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to + LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); + setCreativeTab((CreativeTabs)tab); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + setBlockTextureName("lotr:shadow_tile"); + setBlockName("lotr:shadowTile"); + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if (entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer)entity; + player.attackEntityFrom(new DamageSource("shadow"), 10.0F); + player.addPotionEffect(new PotionEffect(15, 6*20, 0, false)); + world.setBlockToAir(x, y, z); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/model/ModelNex.java b/src/main/java/com/zivilon/cinder_loe/client/model/ModelNex.java new file mode 100644 index 0000000..2c5d794 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/model/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/RenderNex.java b/src/main/java/com/zivilon/cinder_loe/client/render/RenderNex.java new file mode 100644 index 0000000..286829b --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/RenderNex.java @@ -0,0 +1,134 @@ +package lotr.client.render.entity; + +import com.zivilon.cinder_loe.client.model.ModelNex; +import com.zivilon.cinder_loe.entity.Nex; +import lotr.common.entity.LOTRRandomSkinEntity; +import lotr.common.entity.npc.LOTREntityBalrog; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderNex extends RenderLiving { + private static LOTRRandomSkins balrogSkins; + + private static LOTRRandomSkins balrogSkinsBright; + + private static final ResourceLocation fireTexture = new ResourceLocation("lotr:mob/balrog/fire.png"); + + private ModelNex balrogModel; + + private ModelNex balrogModelBright; + + private ModelNex fireModel; + + public RenderNex() { + super((ModelBase)new ModelNex(), 0.5F); + this.balrogModel = (ModelNex)this.mainModel; + this.balrogModelBright = new ModelNex(0.05F); + this.fireModel = new ModelNex(0.0F); + this.fireModel.setFireModel(); + balrogSkins = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog"); + balrogSkinsBright = LOTRRandomSkins.loadSkinsList("lotr:mob/balrog/balrog_bright"); + } + + protected ResourceLocation getEntityTexture(Entity entity) { + return balrogSkins.getRandomSkin((LOTRRandomSkinEntity)entity); + } + + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + Nex balrog = (Nex)entity; + ItemStack heldItem = balrog.getHeldItem(); + this.fireModel.heldItemRight = (heldItem == null) ? 0 : 2; + doRender((EntityLiving)balrog, d, d1, d2, f, f1); + } + + protected void preRenderCallback(EntityLivingBase entity, float f) { + Nex balrog = (Nex)entity; + float scale = 2.0F; + GL11.glScalef(scale, scale, scale); + } + + private void setupFullBright() { + int light = 15728880; + int lx = light % 65536; + int ly = light / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lx / 1.0F, ly / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + protected int shouldRenderPass(EntityLivingBase entity, int pass, float f) { + Nex balrog = (Nex)entity; + if (pass == 1) { + float alpha; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); + GL11.glMatrixMode(5890); + GL11.glLoadIdentity(); + float f1 = balrog.ticksExisted + f; + float f2 = f1 * 0.01F; + float f3 = f1 * 0.01F; + GL11.glTranslatef(f2, f3, 0.0F); + GL11.glMatrixMode(5888); + GL11.glAlphaFunc(516, 0.01F); + GL11.glEnable(3042); + GL11.glBlendFunc(1, 1); + alpha = 0.3F + MathHelper.sin(f1 * 0.05F) * 0.15F; + GL11.glColor4f(alpha, alpha, alpha, 1.0F); + GL11.glDisable(2896); + GL11.glDepthMask(false); + setRenderPassModel((ModelBase)this.fireModel); + bindTexture(fireTexture); + return 1; + } + if (pass == 2) { + GL11.glMatrixMode(5890); + GL11.glLoadIdentity(); + GL11.glMatrixMode(5888); + GL11.glAlphaFunc(516, 0.1F); + GL11.glDisable(3042); + GL11.glEnable(2896); + GL11.glDepthMask(true); + GL11.glDisable(2896); + setupFullBright(); + setRenderPassModel((ModelBase)this.balrogModelBright); + bindTexture(balrogSkinsBright.getRandomSkin((LOTRRandomSkinEntity)balrog)); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + return 1; + } + if (pass == 3) { + GL11.glEnable(2896); + GL11.glDisable(3042); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + return -1; + } + + protected void renderEquippedItems(EntityLivingBase entity, float f) { + GL11.glColor3f(1.0F, 1.0F, 1.0F); + ItemStack heldItem = entity.getHeldItem(); + if (heldItem != null) { + GL11.glPushMatrix(); + this.balrogModel.body.postRender(0.0625F); + this.balrogModel.rightArm.postRender(0.0625F); + GL11.glTranslatef(-0.25F, 1.5F, -0.125F); + float scale = 1.25F; + GL11.glScalef(scale, -scale, scale); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + this.renderManager.itemRenderer.renderItem(entity, heldItem, 0); + if (heldItem.getItem().requiresMultipleRenderPasses()) + for (int x = 1; x < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); x++) + this.renderManager.itemRenderer.renderItem(entity, heldItem, x); + GL11.glPopMatrix(); + } + } +} 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..a52b040 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/block/RenderIceCage.java @@ -0,0 +1,76 @@ +package com.zivilon.cinder_loe.client.render.block; + +import com.zivilon.cinder_loe.blocks.IceCage; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderIceCage implements ISimpleBlockRenderingHandler { + + public static final int RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (modelID != RENDER_ID) return; + + // Render inventory block as flat texture icon + renderer.renderBlockAsItem(block, metadata, 1.0F); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + if (!(block instanceof IceCage) || modelId != RENDER_ID) { + return false; + } + + int meta = world.getBlockMetadata(x, y, z); + float thickness = 0.0625F; // 1/16th of a block thickness + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + // Render the bounding boxes as defined in the block class + if (meta == 0) { // Lower part + renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 0, 1, thickness, 1); // Floor + renderer.renderStandardBlock(block, x, y, z); + } else if (meta == 1) { // Upper part + renderer.setRenderBounds(0, 0, 0, thickness, 1, 1); // Left wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(1 - thickness, 0, 0, 1, 1, 1); // Right wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 0, 1, 1, thickness); // Front wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 0, 1 - thickness, 1, 1, 1); // Back wall + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0, 1, 0, 1, 1 + thickness, 1); // Ceiling + renderer.renderStandardBlock(block, x, y, z); + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return false; // Do not render as 3D in inventory + } + + @Override + public int getRenderId() { + return RENDER_ID; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderWarDart.java b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderWarDart.java new file mode 100644 index 0000000..86bef56 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/projectile/RenderWarDart.java @@ -0,0 +1,53 @@ +package com.zivilon.cinder_loe.client.render.projectile; + +import com.zivilon.cinder_loe.entity.projectile.EntityWarDart; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation;import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.ItemRenderer; + +public class RenderWarDart extends Render { + + protected ResourceLocation getEntityTexture(Entity entity) { + return TextureMap.locationItemsTexture; + } + + @Override + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + EntityWarDart dart = (EntityWarDart)entity; + GL11.glPushMatrix(); + GL11.glTranslatef((float)d, (float)d1, (float)d2); + GL11.glRotatef(dart.prevRotationYaw + (dart.rotationYaw - dart.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(dart.prevRotationPitch + (dart.rotationPitch - dart.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F); + GL11.glEnable(32826); + GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -1.0F, 0.0F); + float scale = 0.6F; + GL11.glScalef(scale, scale, scale); + GL11.glTranslatef(0.0F, 0.8F, 0.0F); + + if (dart.item != null) { + IIcon icon = dart.getDartIcon(); + if (icon != null) { + Tessellator tessellator = Tessellator.instance; + float minU = icon.getMinU(); + float maxU = icon.getMaxU(); + float minV = icon.getMinV(); + float maxV = icon.getMaxV(); + int width = icon.getIconWidth(); + int height = icon.getIconHeight(); + bindTexture(getEntityTexture((Entity)dart)); + ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, width, height, 0.0625F); + } + } + + GL11.glDisable(32826); + 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 b5cdad5..abd5c93 100644 --- a/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java +++ b/src/main/java/com/zivilon/cinder_loe/coremod/LOTRMaterialTransformer.java @@ -67,7 +67,10 @@ public class LOTRMaterialTransformer implements IClassTransformer { addMaterial("USURPER", classNode); addMaterial("WARLORD",classNode); addMaterial("JADE",classNode); - + addMaterial("NEX_ICE",classNode); + addMaterial("NEX_FIRE",classNode); + addMaterial("NEX_TOXIN",classNode); + addMaterial("NEX_SHADOW",classNode); // Protection Conversion 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 7df320c..8a31da6 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", "swordBree", "maceArnor", - "daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh"); + "daggerAsh","bowAsh","hammerAsh","pikeAsh","battleaxeAsh","swordAsh","spearAsh", "staffAsh", + "firstAgeGlaive"); } return basicClass; } diff --git a/src/main/java/com/zivilon/cinder_loe/entity/Nex.java b/src/main/java/com/zivilon/cinder_loe/entity/Nex.java new file mode 100644 index 0000000..431f2db --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/Nex.java @@ -0,0 +1,117 @@ +package com.zivilon.cinder_loe.entity; + +import java.util.UUID; + +import lotr.common.entity.ai.LOTREntityAIAttackOnCollide; +import lotr.common.entity.npc.LOTREntityNPC; +import lotr.common.fac.LOTRFaction; + +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; + +import com.zivilon.cinder_loe.CinderLoE; + +public class Nex extends LOTREntityNPC { + public AxisAlignedBB collisionBox; + public AxisAlignedBB hitbox; + public int phase = 1; + public ChunkCoordinates currentFlightTarget; + public EntityPlayer playerTarget; + + public Nex(World world) { + super(world); + setSize(1.5F, 3.0F); + ((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.3D, false)); + ((EntityLiving) this).tasks.addTask(5, (EntityAIBase) new EntityAIWander(this, 1.0D)); + ((EntityLiving) this).tasks.addTask(9, (EntityAIBase) new EntityAILookIdle((EntityLiving) this)); + addTargetTasks(true); + } + + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(31, Integer.valueOf(0)); + } + + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1000.0D); + getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D); + } + + public int getPhase() { + return this.dataWatcher.getWatchableObjectInt(31); + } + public void setPhase(int i) { + this.dataWatcher.updateObject(31, Integer.valueOf(i)); + } + + public LOTRFaction getFaction() { + return LOTRFaction.UTUMNO; + } + + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("NexPhase", getPhase()); + } + + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + setPhase(nbt.getInteger("NexPhase")); + } + + public boolean canBePushed() { + return false; + } + + protected void fall(float f) {} + + protected void updateFallState(double d, boolean flag) {} + + protected boolean canDespawn() { + return false; + } + + public void onLivingUpdate() { + super.onLivingUpdate(); + if (rand.nextBoolean()) + ((Entity)this).worldObj.spawnParticle("chill", ((Entity)this).posX + (rand.nextDouble() - 0.5D) * ((Entity)this).width, ((Entity)this).posY + rand.nextDouble() * ((Entity)this).height, ((Entity)this).posZ + (rand.nextDouble() - 0.5D) * ((Entity)this).width, 0.0D, 0.0D, 0.0D); + } + + protected void dropFewItems(boolean flag, int i) { + return; + } + + protected String getHurtSound() { + return "lotr:wight.hurt"; + } + + protected String getDeathSound() { + return "lotr:wight.death"; + } + + public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) { + // Do nothing + } + + @Override + public ItemStack getPickedResult(MovingObjectPosition target) { + return null; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityWarDart.java b/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityWarDart.java new file mode 100644 index 0000000..adcbc38 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/projectile/EntityWarDart.java @@ -0,0 +1,159 @@ +package com.zivilon.cinder_loe.entity.projectile; + +import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.items.WarDart; +import lotr.common.entity.projectile.LOTREntityProjectileBase; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityWarDart extends LOTREntityProjectileBase { + + public static int POSITION_WATCHER_ID = 20; + public static int ITEMSTACK_WATCHER_ID = 18; + + public int xTile = -1; + public int yTile = -1; + public int zTile = -1; + public Block inTile; + public int inData = 0; + public boolean inGround = false; + public int shake = 0; + public Entity shootingEntity; + public int ticksInGround; + public int ticksInAir = 0; + public int canBePickedUp = 0; + public int knockbackStrength = 0; + + public ItemStack item; + public int damage; + + public EntityWarDart(World world) { + super(world); + } + + public EntityWarDart(World world, EntityLivingBase thrower, ItemStack item) { + super(world, thrower, item, 3.0F); + this.item = item.copy(); // Store a copy of the item stack + this.item.stackSize = 1; + this.damage = WarDart.getDamageFromMeta(item.getItemDamage()); + } + + @Override + protected void entityInit() { + this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); + this.dataWatcher.addObjectByDataType(ITEMSTACK_WATCHER_ID, 5); + this.dataWatcher.addObject(POSITION_WATCHER_ID, ""); // Test adding object with ID + } + + @Override + public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) { + float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); + x /= f2; + y /= f2; + z /= f2; + x += this.rand.nextGaussian() * 0.0075D * inaccuracy; + y += this.rand.nextGaussian() * 0.0075D * inaccuracy; + z += this.rand.nextGaussian() * 0.0075D * inaccuracy; + x *= velocity; + y *= velocity; + z *= velocity; + this.motionX = x; + this.motionY = y; + this.motionZ = z; + float f3 = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, f3) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + @Override + public void onUpdate() { + super.onUpdate(); + + if (!this.worldObj.isRemote) { + this.dataWatcher.updateObject(ITEMSTACK_WATCHER_ID, this.item); + if (this.inGround) { + String posString = this.xTile + "," + this.yTile + "," + this.zTile; + this.dataWatcher.updateObject(POSITION_WATCHER_ID, posString); + } + } else { + this.item = this.dataWatcher.getWatchableObjectItemStack(ITEMSTACK_WATCHER_ID); + String posString = this.dataWatcher.getWatchableObjectString(POSITION_WATCHER_ID); + if (!posString.equals("")) { + String[] coords = posString.split(","); + this.xTile = Integer.parseInt(coords[0]); + this.yTile = Integer.parseInt(coords[1]); + this.zTile = Integer.parseInt(coords[2]); + } + } + + // Ensure proper synchronization of position + if (this.inGround) { + this.motionX = this.motionY = this.motionZ = 0; + this.posX = this.xTile + 0.5; + this.posY = this.yTile + 0.5; + this.posZ = this.zTile + 0.5; + } + } + + @Override + public float getBaseImpactDamage(Entity entity, ItemStack itemStack) { + return this.damage; + } + + @Override + public void writeEntityToNBT(NBTTagCompound tagCompound) { + // Do not call super.writeEntityToNBT to avoid recursion issues + tagCompound.setInteger("xTile", this.xTile); + tagCompound.setInteger("yTile", this.yTile); + tagCompound.setInteger("zTile", this.zTile); + tagCompound.setInteger("inTile", Block.getIdFromBlock(this.inTile)); + tagCompound.setByte("inData", (byte)this.inData); + tagCompound.setByte("shake", (byte)this.shake); + tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + tagCompound.setByte("pickup", (byte)this.canBePickedUp); + tagCompound.setByte("Knockback", (byte)this.knockbackStrength); + if (this.item != null) { + NBTTagCompound itemTag = new NBTTagCompound(); + this.item.writeToNBT(itemTag); + tagCompound.setTag("Item", itemTag); + } + } + + @Override + public void readEntityFromNBT(NBTTagCompound tagCompound) { + // Do not call super.readEntityFromNBT to avoid recursion issues + this.xTile = tagCompound.getInteger("xTile"); + this.yTile = tagCompound.getInteger("yTile"); + this.zTile = tagCompound.getInteger("zTile"); + this.inTile = Block.getBlockById(tagCompound.getInteger("inTile")); + this.inData = tagCompound.getByte("inData"); + this.shake = tagCompound.getByte("shake"); + this.inGround = tagCompound.getByte("inGround") == 1; + this.canBePickedUp = tagCompound.getByte("pickup"); + this.knockbackStrength = tagCompound.getByte("Knockback"); + if (tagCompound.hasKey("Item")) { + this.item = ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("Item")); + if (this.item != null) { + this.damage = WarDart.getDamageFromMeta(this.item.getItemDamage()); + this.dataWatcher.updateObject(ITEMSTACK_WATCHER_ID, this.item); // Ensure DataWatcher is updated with the deserialized ItemStack + } + } + } + + + + + public IIcon getDartIcon() { + WarDart itemDart = (WarDart) CinderLoE.warDart; + return itemDart.getIconFromDamage(this.item.getItemDamage()); + } +} 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..27ae090 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java @@ -0,0 +1,12 @@ +package com.zivilon.cinder_loe.items; + +import net.minecraft.item.Item; + +public class ToxicCore extends Item { + + public ToxicCore() { + this.setMaxDamage(100); + this.setNoRepair(); + this.setMaxStackSize(1); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/WarDart.java b/src/main/java/com/zivilon/cinder_loe/items/WarDart.java new file mode 100644 index 0000000..ff0a344 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/WarDart.java @@ -0,0 +1,150 @@ +package com.zivilon.cinder_loe.items; + +import com.zivilon.cinder_loe.entity.projectile.EntityWarDart; + +import lotr.common.LOTRCreativeTabs; +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 java.util.List; + +public class WarDart extends Item { + public IIcon[] icons; + + public WarDart() { + this.setHasSubtypes(true); + setMaxStackSize(4); + this.setMaxDamage(0); + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { + if (itemStack.getItemDamage() > 0) { + if (!player.capabilities.isCreativeMode) { + --itemStack.stackSize; + } + + world.playSoundAtEntity(player, "lotr:item.dart", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F)); + + if (!world.isRemote) { + world.spawnEntityInWorld(new EntityWarDart(world, player, itemStack)); + } + } + return itemStack; + } + + @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[14]; + this.icons[0] = iconRegister.registerIcon("lotr:war_dart_headless"); + this.icons[1] = iconRegister.registerIcon("lotr:war_dart_copper"); + this.icons[2] = iconRegister.registerIcon("lotr:war_dart_bronze"); + this.icons[3] = iconRegister.registerIcon("lotr:war_dart_iron"); + this.icons[4] = iconRegister.registerIcon("lotr:war_dart_orc"); + this.icons[5] = iconRegister.registerIcon("lotr:war_dart_dwarven"); + this.icons[6] = iconRegister.registerIcon("lotr:war_dart_uruk"); + this.icons[7] = iconRegister.registerIcon("lotr:war_dart_blue_dwarven"); + this.icons[8] = iconRegister.registerIcon("lotr:war_dart_black_uruk"); + this.icons[9] = iconRegister.registerIcon("lotr:war_dart_elven"); + this.icons[10] = iconRegister.registerIcon("lotr:war_dart_gilded_iron"); + this.icons[11] = iconRegister.registerIcon("lotr:war_dart_red_dwarven"); + this.icons[12] = iconRegister.registerIcon("lotr:war_dart_mithril"); + this.icons[13] = iconRegister.registerIcon("lotr:war_dart_ancient"); + } + + public static String getDartMaterial(ItemStack item) { + switch(item.getItemDamage()) { + case 1: + return "copper"; + case 2: + return "bronze"; + case 3: + return "iron"; + case 4: + return "orc"; + case 5: + return "dwarven"; + case 6: + return "uruk"; + case 7: + return "blue_dwarven"; + case 8: + return "black_uruk"; + case 9: + return "elven"; + case 10: + return "gilded_iron"; + case 11: + return "red_dwarven"; + case 12: + return "mithril"; + case 13: + return "ancient"; + default: + return "headless"; + } + } + + @Override + public String getUnlocalizedName(ItemStack item) { + return "item.war_dart_" + getDartMaterial(item); + } + + @Override + public int getMetadata(int damage) { + return damage; + } + + public static int getDamageFromMeta(int meta) { + switch(meta) { + case 1: return 3; // Copper + case 2: return 3; // Bronze + case 3: return 4; // Iron + case 4: return 5; // Orc + case 5: return 6; // Dwarven + case 6: return 6; // Uruk + case 7: return 6; // Blue Dwarven + case 8: return 6; // Black Uruk + case 9: return 6; // Elven + case 10: return 5; // Gilded Iron + case 11: return 6; // Red Dwarven + case 12: return 10; // Mithril + case 13: return 12; // Ancient + default: return 0; + } + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { + int damageMeta = stack.getItemDamage(); + double damagePercent = getDamageFromMeta(damageMeta) * (1.0 / 8) * 100.0; + double roundedDamagePercent = 5 * Math.round(damagePercent / 5.0); + list.add(EnumChatFormatting.DARK_GREEN + "Ranged damage: " + roundedDamagePercent + "%"); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java b/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java new file mode 100644 index 0000000..a581680 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java @@ -0,0 +1,70 @@ +package com.zivilon.cinder_loe.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.util.List; + +public class WarDartHeads extends Item { + private IIcon[] icons; + + public WarDartHeads() { + super(); + setCreativeTab(CreativeTabs.tabMisc); + setHasSubtypes(true); // Allows for different metadata values + } + + @Override + public void registerIcons(IIconRegister iconRegister) { + icons = new IIcon[6]; // 6 icons for 0 to 5 count levels + for (int i = 0; i < icons.length; i++) { + icons[i] = iconRegister.registerIcon("lotr:war_dart_heads_" + i); + } + } + + @Override + public String getUnlocalizedName(ItemStack item) { + return "item.war_dart_heads_" + WarDart.getDartMaterial(item); + } + + @Override + public int getColorFromItemStack(ItemStack stack, int renderPass) { + int damage = stack.getItemDamage(); + + switch (damage) { + case 1: return 0xCA6C40; // Copper + case 2: return 0xC28336; // Bronze + case 3: return 0xD8D8D8; // Iron + case 4: return 0x5D685A; // Orc + case 5: return 0x6B787A; // Dwarven + case 6: return 0x4C4D34; // Uruk + case 7: return 0x577287; // Blue Dwarven + case 8: return 0x444138; // Black Uruk + case 9: return 0xD0C9AC; // Elven + case 10: return 0xFFFFB0; // Gilded Iron + case 11: return 0xFFC48B; // Red dwarven + case 12: return 0xAFB3D3; // Mithril + case 13: return 0x033346; // Ancient + default: return 0xFFFFFF; // Blank + } + } + + @Override + public IIcon getIconIndex(ItemStack item) { + return getIcon(item, 0); + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass) { + int count = stack.stackSize; + if (count > 5 || count < 1) { + return icons[0]; + } else { + return icons[count]; + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java new file mode 100644 index 0000000..891d0e6 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinSlotCrafting.java @@ -0,0 +1,94 @@ +package com.zivilon.cinder_loe.mixins; + +import com.zivilon.cinder_loe.util.DurableItemCrafter; +import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.SlotCrafting; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Overwrite; + +import com.zivilon.cinder_loe.CinderLoE; + +@Mixin(SlotCrafting.class) +public abstract class MixinSlotCrafting { + @Shadow + private final IInventory craftMatrix; + @Shadow + private EntityPlayer thePlayer; + @Shadow + protected void onCrafting(ItemStack p_75210_1_) {} + + public MixinSlotCrafting() { + craftMatrix = null; + } + + @Overwrite + public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { + FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, craftMatrix); + onCrafting(p_82870_2_); + boolean hasExceptionItem = false; + int arrow_count = 0; + + for (int i = 0; i < craftMatrix.getSizeInventory(); ++i) { + ItemStack itemstack1 = craftMatrix.getStackInSlot(i); + + if (itemstack1 != null && DurableItemCrafter.exceptionItems.contains(itemstack1.getItem())) { + hasExceptionItem = true; + } + if (itemstack1 != null && itemstack1.getItem() == Items.arrow) { + arrow_count++; + } + } + + for (int i = 0; i < craftMatrix.getSizeInventory(); ++i) { + ItemStack itemstack1 = craftMatrix.getStackInSlot(i); + + if (itemstack1 != null) { + if (!hasExceptionItem && DurableItemCrafter.customItems.contains(itemstack1.getItem())) { + 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); + } + + if (itemstack1 != null && itemstack1.getItem().hasContainerItem(itemstack1)) { + ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); + + if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) { + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); + continue; + } + + if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !thePlayer.inventory.addItemStackToInventory(itemstack2)) { + if (craftMatrix.getStackInSlot(i) == null) { + craftMatrix.setInventorySlotContents(i, itemstack2); + } else { + thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); + } + } + } + } + } + } + + @Dynamic + public void damage_item(ItemStack item, int i, int damage, IInventory matrix) { + item.setItemDamage(item.getItemDamage() + damage); + if (item.getItemDamage() >= item.getMaxDamage()) { + matrix.setInventorySlotContents(i, null); // Item breaks and is removed + } else { + matrix.setInventorySlotContents(i, item); + } + } +} 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 e2d36e7..9109ae3 100644 --- a/src/main/java/com/zivilon/cinder_loe/recipes.java +++ b/src/main/java/com/zivilon/cinder_loe/recipes.java @@ -4,15 +4,22 @@ import cpw.mods.fml.common.registry.GameRegistry; import lotr.common.LOTRMod; import lotr.common.recipe.LOTRRecipePoisonWeapon; import lotr.common.recipe.LOTRRecipes; +import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.recipe.*; + +import lotr.common.item.LOTRItemFood; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import net.minecraftforge.oredict.RecipeSorter; +import net.minecraftforge.oredict.RecipeSorter.Category; public class recipes { + public static void registerRecipes() { // Register a block recipe System.out.println("[CinderLoE] Registering recipes..."); @@ -24,7 +31,6 @@ public class recipes { registerAngmarRecipes(); } - public static void registerGeneralRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.bowAsh), " XS", "X S", " XS", 'X', CinderLoE.ingotAsh, 'S', Items.string)); @@ -43,7 +49,60 @@ public class recipes { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.daggerAsh), "X ", "Y ", '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 })); + GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.spearAsh), new Object[] { " X", " Y ", "Y ", + 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" })); + GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.staffAsh), new Object[] { " XX", " YX", "Y ", + 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" })); + GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.pikeAsh), new Object[] { " X", " YX", "Y ", + 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" })); + GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.daggerAsh), new Object[] { "X ", "Y ", + 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(new ToxicCoreArrowsRecipe(new ItemStack(LOTRMod.arrowPoisoned))); + + 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.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))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 3), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 3))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 4), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 4))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 5), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 5))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 6), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 6))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 7), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 7))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 8), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 8))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 9), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 9))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 10), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 10))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 11), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 11))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 12), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 12))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(CinderLoE.warDart, 1, 13), new ItemStack(CinderLoE.warDart, 1, 0), new ItemStack(CinderLoE.warDartHeads, 1, 13))); OreDictionary.registerOre("vegetable1", CinderLoE.onion); OreDictionary.registerOre("vegetable1", LOTRMod.leek); diff --git a/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java b/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java new file mode 100644 index 0000000..ec08bcb --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java @@ -0,0 +1,19 @@ +package com.zivilon.cinder_loe.util; + +import net.minecraft.item.Item; +import java.util.ArrayList; +import java.util.List; + +import lotr.common.LOTRMod; +import com.zivilon.cinder_loe.CinderLoE; + +public class DurableItemCrafter { + public static final List customItems = new ArrayList<>(); + public static final List exceptionItems = new ArrayList<>(); + static { + customItems.add(LOTRMod.chisel); + customItems.add(CinderLoE.toxicCore); + + exceptionItems.add(LOTRMod.ithildin); + } +} 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 167f904..613f923 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java +++ b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java @@ -1,6 +1,7 @@ package com.zivilon.cinder_loe.util; import com.zivilon.cinder_loe.client.render.item.RenderHelper; +import com.zivilon.cinder_loe.CinderLoE; import java.io.BufferedWriter; import java.io.FileOutputStream; @@ -16,8 +17,14 @@ import java.util.Vector; import lotr.common.LOTRCreativeTabs; import lotr.common.world.biome.LOTRBiome; +import lotr.common.item.LOTRItemArmor; +import lotr.common.item.LOTRMaterial; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; +import net.minecraft.item.ItemStack; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; @@ -122,4 +129,74 @@ public class Utilities { } } + public static EntityPlayer getPlayerByName(String player_name) { + MinecraftServer server = MinecraftServer.getServer(); + if (server == null) { + return null; + } + + for (Object obj : server.getConfigurationManager().playerEntityList) { + if (obj instanceof EntityPlayerMP) { + EntityPlayer player = (EntityPlayer)obj; + String found_name = player.getCommandSenderName(); + if (found_name.equals(player_name)) { + return player; + } + } + } + return null; // Player not found or not online + } + + public static boolean hasFireWeapon(String player_name) { + EntityPlayer player = getPlayerByName(player_name); + + if (player == null) { + System.out.println("[CinderLoE] Warning! Player not found: " + player_name); + return false; + } + + ItemStack held_item = player.getHeldItem(); + boolean has_fire = LOTREnchantmentHelper.hasEnchant(held_item, LOTREnchantment.fire); + return has_fire; + } + + public static int[] countNexArmour(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 boolean isArrayEmpty(int[] array) { + for (int value : array) { + if (value != 0) return false; + } + return true; + } + } diff --git a/src/main/resources/assets/cinder_loe/lang/en_US.lang b/src/main/resources/assets/cinder_loe/lang/en_US.lang index fc813f3..c3e5e57 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -100,6 +100,36 @@ item.lotr:banner.red.name=Red Flag item.lotr:banner.blue.name=Blue Flag item.lotr:banner.green.name=Green Flag +item.war_dart_headless.name=Headless Dart +item.war_dart_copper.name=Copper Dart +item.war_dart_bronze.name=Bronze Dart +item.war_dart_iron.name=Iron Dart +item.war_dart_orc.name=Orc Dart +item.war_dart_dwarven.name=Dwarven Dart +item.war_dart_uruk.name=Uruk Dart +item.war_dart_blue_dwarven.name=Blue Dwarven Dart +item.war_dart_black_uruk.name=Black Uruk Dart +item.war_dart_elven.name=Elven Dart +item.war_dart_gilded_iron.name=Gilded Iron Dart +item.war_dart_red_dwarven.name=Red Dwarven Dart +item.war_dart_mithril.name=Mithril Dart +item.war_dart_ancient.name=Ancient Dart + +item.war_dart_heads_headless.name=??? Dart Heads +item.war_dart_heads_copper.name=Copper Dart Heads +item.war_dart_heads_bronze.name=Bronze Dart Heads +item.war_dart_heads_iron.name=Iron Dart Heads +item.war_dart_heads_orc.name=Orc Dart Heads +item.war_dart_heads_dwarven.name=Dwarven Dart Heads +item.war_dart_heads_uruk.name=Uruk Dart Heads +item.war_dart_heads_blue_dwarven.name=Blue Dwarven Dart Heads +item.war_dart_heads_black_uruk.name=Black Uruk Dart Heads +item.war_dart_heads_elven.name=Elven Dart Heads +item.war_dart_heads_gilded_iron.name=Gilded Iron Dart Heads +item.war_dart_heads_red_dwarven.name=Red Dwarven Dart Heads +item.war_dart_heads_mithril.name=Mithril Dart Heads +item.war_dart_heads_ancient.name=Ancient Dart Heads + item.spawn_egg_fangornauroch.name=Spawn Fangorn Auroch item.spawn_egg_fangornbear.name=Spawn Fangorn Bear item.spawn_egg_fangornwildboar.name=Spawn Fangorn Wild Boar diff --git a/src/main/resources/assets/lotr/armor/nex_fire_1.png b/src/main/resources/assets/lotr/armor/nex_fire_1.png new file mode 100644 index 0000000..d07300c Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_fire_1.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_fire_2.png b/src/main/resources/assets/lotr/armor/nex_fire_2.png new file mode 100644 index 0000000..7f7e021 Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_fire_2.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_ice_1.png b/src/main/resources/assets/lotr/armor/nex_ice_1.png new file mode 100644 index 0000000..ea6891a Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_ice_1.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_ice_2.png b/src/main/resources/assets/lotr/armor/nex_ice_2.png new file mode 100644 index 0000000..d761058 Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_ice_2.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_shadow_1.png b/src/main/resources/assets/lotr/armor/nex_shadow_1.png new file mode 100644 index 0000000..964c442 Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_shadow_1.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_shadow_2.png b/src/main/resources/assets/lotr/armor/nex_shadow_2.png new file mode 100644 index 0000000..cc96dcc Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_shadow_2.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_toxin_1.png b/src/main/resources/assets/lotr/armor/nex_toxin_1.png new file mode 100644 index 0000000..ff4c2ba Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_toxin_1.png differ diff --git a/src/main/resources/assets/lotr/armor/nex_toxin_2.png b/src/main/resources/assets/lotr/armor/nex_toxin_2.png new file mode 100644 index 0000000..f3d9ed2 Binary files /dev/null and b/src/main/resources/assets/lotr/armor/nex_toxin_2.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/ice_cage.png b/src/main/resources/assets/lotr/textures/blocks/ice_cage.png new file mode 100644 index 0000000..cfdeb25 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/ice_cage.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/invisible.png b/src/main/resources/assets/lotr/textures/blocks/invisible.png new file mode 100644 index 0000000..3ccb574 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/invisible.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/shadow_tile.png b/src/main/resources/assets/lotr/textures/blocks/shadow_tile.png new file mode 100644 index 0000000..30d8fdf Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/shadow_tile.png differ diff --git a/src/main/resources/assets/lotr/textures/items/firstAgeGlaive.png b/src/main/resources/assets/lotr/textures/items/firstAgeGlaive.png new file mode 100644 index 0000000..a6288b0 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/firstAgeGlaive.png differ diff --git a/src/main/resources/assets/lotr/textures/items/large/firstAgeGlaive.png b/src/main/resources/assets/lotr/textures/items/large/firstAgeGlaive.png new file mode 100644 index 0000000..4401d3c Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/large/firstAgeGlaive.png differ diff --git a/src/main/resources/assets/lotr/textures/items/toxicCore.png b/src/main/resources/assets/lotr/textures/items/toxicCore.png new file mode 100644 index 0000000..3033850 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/toxicCore.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_ancient.png b/src/main/resources/assets/lotr/textures/items/war_dart_ancient.png new file mode 100644 index 0000000..ace2df4 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_ancient.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_black_uruk.png b/src/main/resources/assets/lotr/textures/items/war_dart_black_uruk.png new file mode 100644 index 0000000..1bbe9f1 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_black_uruk.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_blue_dwarven.png b/src/main/resources/assets/lotr/textures/items/war_dart_blue_dwarven.png new file mode 100644 index 0000000..31ec468 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_blue_dwarven.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_bronze.png b/src/main/resources/assets/lotr/textures/items/war_dart_bronze.png new file mode 100644 index 0000000..9bcaa1a Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_bronze.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_copper.png b/src/main/resources/assets/lotr/textures/items/war_dart_copper.png new file mode 100644 index 0000000..be81a2a Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_copper.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_dwarven.png b/src/main/resources/assets/lotr/textures/items/war_dart_dwarven.png new file mode 100644 index 0000000..42ce651 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_dwarven.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_elven.png b/src/main/resources/assets/lotr/textures/items/war_dart_elven.png new file mode 100644 index 0000000..c9e7012 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_elven.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_gilded_iron.png b/src/main/resources/assets/lotr/textures/items/war_dart_gilded_iron.png new file mode 100644 index 0000000..6b3e491 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_gilded_iron.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_headless.png b/src/main/resources/assets/lotr/textures/items/war_dart_headless.png new file mode 100644 index 0000000..a4b4022 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_headless.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_0.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_0.png new file mode 100644 index 0000000..3cb0e00 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_0.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_1.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_1.png new file mode 100644 index 0000000..08e3713 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_1.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_1_alt.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_1_alt.png new file mode 100644 index 0000000..aba15a1 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_1_alt.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_2.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_2.png new file mode 100644 index 0000000..418bae5 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_2.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_3.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_3.png new file mode 100644 index 0000000..0a0b7f9 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_3.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_4.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_4.png new file mode 100644 index 0000000..6e26dca Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_4.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_heads_5.png b/src/main/resources/assets/lotr/textures/items/war_dart_heads_5.png new file mode 100644 index 0000000..50a1bb1 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_heads_5.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_iron.png b/src/main/resources/assets/lotr/textures/items/war_dart_iron.png new file mode 100644 index 0000000..1a1752c Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_iron.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_mithril.png b/src/main/resources/assets/lotr/textures/items/war_dart_mithril.png new file mode 100644 index 0000000..953f928 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_mithril.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_orc.png b/src/main/resources/assets/lotr/textures/items/war_dart_orc.png new file mode 100644 index 0000000..14996f6 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_orc.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_red_dwarven.png b/src/main/resources/assets/lotr/textures/items/war_dart_red_dwarven.png new file mode 100644 index 0000000..ccdb1be Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_red_dwarven.png differ diff --git a/src/main/resources/assets/lotr/textures/items/war_dart_uruk.png b/src/main/resources/assets/lotr/textures/items/war_dart_uruk.png new file mode 100644 index 0000000..675b96a Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/war_dart_uruk.png differ diff --git a/src/main/resources/mixins.cinder_loe.json b/src/main/resources/mixins.cinder_loe.json index 97c97a2..5b0c8cd 100644 --- a/src/main/resources/mixins.cinder_loe.json +++ b/src/main/resources/mixins.cinder_loe.json @@ -30,7 +30,8 @@ "MixinLOTRTradeEntries", "MixinLOTRWorldGenMumakSkeleton", "MixinRendererLivingEntity", - "MixinRenderItem" - ], + "MixinRenderItem", + "MixinSlotCrafting" + ], "client": [] }