From d077158a574e034802033ed5e11d819e2de3ff03 Mon Sep 17 00:00:00 2001 From: Shinare Date: Fri, 2 Aug 2024 21:55:53 +0300 Subject: [PATCH] LOTREnchantment exclusions, more items to creative tabs --- .../com/zivilon/cinder_loe/CinderLoE.java | 43 +++++++------- .../zivilon/cinder_loe/LoECreativeTabs.java | 2 + .../cinder_loe/blocks/CinderBlock.java | 10 +--- .../cinder_loe/blocks/EnchantedIce.java | 47 +++++++++++++++ .../cinder_loe/items/CinderLoESpawnEgg.java | 4 +- .../cinder_loe/items/FirstAgeGlaive.java | 57 +++++++++++++++++++ .../zivilon/cinder_loe/items/ToxicCore.java | 5 ++ .../cinder_loe/items/WarDartHeads.java | 15 ++++- .../com/zivilon/cinder_loe/items/Whip.java | 3 + .../zivilon/cinder_loe/items/WizardStaff.java | 6 +- .../mixins/MixinLOTREnchantmentType.java | 26 +++++++++ .../cinder_loe/util/DurableItemCrafter.java | 4 +- .../util/LOTREnchantmentExclusions.java | 15 +++++ src/main/resources/mixins.cinder_loe.json | 3 +- 14 files changed, 201 insertions(+), 39 deletions(-) create mode 100644 src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java create mode 100644 src/main/java/com/zivilon/cinder_loe/items/FirstAgeGlaive.java create mode 100644 src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentType.java create mode 100644 src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 2a72211..a26c65f 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -142,6 +142,7 @@ public class CinderLoE { public static Block shadowTile; public static Block entityBarrier; public static Block iceCage; + public static Block enchantedIce; //public static Block verticalWeaponRack; @@ -382,6 +383,8 @@ public class CinderLoE { recipes.registerRecipes(); // Register recipes at com.zivilon.cinder_loe.recipes.java setupTradeEntries(); LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F); + LOTRWeaponStats.registerMeleeReach(FirstAgeGlaive.class, 1.8F); + LOTRWeaponStats.registerMeleeSpeed(FirstAgeGlaive.class, 1.0F); LoECreativeTabs.setupIcons(); } @@ -533,6 +536,8 @@ public class CinderLoE { GameRegistry.registerBlock(entityBarrier, "entity_barrier"); iceCage = (new IceCage()); GameRegistry.registerBlock(iceCage, "ice_cage"); + enchantedIce = (new EnchantedIce()); + GameRegistry.registerBlock(enchantedIce, "enchanted_ice"); // Building Blocks cutDrystone = (new cutDrystone()); @@ -729,24 +734,24 @@ 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); + helmetNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 0)).setUnlocalizedName("lotr:helmetNexIce").setTextureName("lotr:helmetNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bodyNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 1)).setUnlocalizedName("lotr:bodyNexIce").setTextureName("lotr:bodyNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE); + legsNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 2)).setUnlocalizedName("lotr:legsNexIce").setTextureName("lotr:legsNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bootsNexIce = (new LOTRItemArmor(MATERIAL_NEX_ICE, 3)).setUnlocalizedName("lotr:bootsNexIce").setTextureName("lotr:bootsNexIce").setCreativeTab(LoECreativeTabs.tabCombatLoE); + helmetNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 0)).setUnlocalizedName("lotr:helmetNexFire").setTextureName("lotr:helmetNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bodyNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 1)).setUnlocalizedName("lotr:bodyNexFire").setTextureName("lotr:bodyNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE); + legsNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 2)).setUnlocalizedName("lotr:legsNexFire").setTextureName("lotr:legsNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bootsNexFire = (new LOTRItemArmor(MATERIAL_NEX_FIRE, 3)).setUnlocalizedName("lotr:bootsNexFire").setTextureName("lotr:bootsNexFire").setCreativeTab(LoECreativeTabs.tabCombatLoE); + helmetNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 0)).setUnlocalizedName("lotr:helmetNexToxin").setTextureName("lotr:helmetNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bodyNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 1)).setUnlocalizedName("lotr:bodyNexToxin").setTextureName("lotr:bodyNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE); + legsNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 2)).setUnlocalizedName("lotr:legsNexToxin").setTextureName("lotr:legsNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bootsNexToxin = (new LOTRItemArmor(MATERIAL_NEX_TOXIN, 3)).setUnlocalizedName("lotr:bootsNexToxin").setTextureName("lotr:bootsNexToxin").setCreativeTab(LoECreativeTabs.tabCombatLoE); + helmetNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 0)).setUnlocalizedName("lotr:helmetNexShadow").setTextureName("lotr:helmetNexShadow").setCreativeTab(LoECreativeTabs.tabCombatLoE); + bodyNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 1)).setUnlocalizedName("lotr:bodyNexShadow").setTextureName("lotr:bodyNexShadow").setCreativeTab(LoECreativeTabs.tabCombatLoE); legsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 2)).setUnlocalizedName("lotr:legsNexShadow").setTextureName("lotr:legsNexShadow").setCreativeTab(null); - bootsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 3)).setUnlocalizedName("lotr:bootsNexShadow").setTextureName("lotr:bootsNexShadow").setCreativeTab(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); + bootsNexShadow = (new LOTRItemArmor(MATERIAL_NEX_SHADOW, 3)).setUnlocalizedName("lotr:bootsNexShadow").setTextureName("lotr:bootsNexShadow").setCreativeTab(LoECreativeTabs.tabCombatLoE); + firstAgeGlaive = (new FirstAgeGlaive()).setCreativeTab(LoECreativeTabs.tabCombatLoE); + toxicCore = (new ToxicCore()); linkLOTRWeapon(firstAgeGlaive, "firstAgeGlaive"); @@ -1058,12 +1063,10 @@ public class CinderLoE { // RenderingRegistry.registerEntityRenderingHandler(HaradLevy.class, new LOTRRenderNearHaradrim()); // RenderingRegistry.registerEntityRenderingHandler(DwarfLevy.class, new LOTRRenderDwarf()); RenderingRegistry.registerBlockHandler(new RenderIceCage()); - RenderingRegistry.registerEntityRenderingHandler(EntityWarDart.class, new RenderWarDart()); + RenderingRegistry.registerEntityRenderingHandler(EntityWarDart.class, new RenderWarDart()); RenderingRegistry.registerEntityRenderingHandler(BladorthinSmith.class, new LOTRRenderDorwinionElfVintner()); - RenderingRegistry.registerEntityRenderingHandler(DarkSpider.class, new RenderDarkSpider()); - RenderingRegistry.registerEntityRenderingHandler(CorruptDwarf.class, new RenderCorruptDwarf()); RenderingRegistry.registerEntityRenderingHandler(CorruptElf.class, new RenderCorruptElf()); RenderingRegistry.registerEntityRenderingHandler(CorruptEnt.class, new RenderCorruptEnt()); diff --git a/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java b/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java index 3f672d0..8d6dd44 100644 --- a/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java +++ b/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java @@ -14,6 +14,7 @@ public class LoECreativeTabs extends CreativeTabs { public static LoECreativeTabs tabMiscLoE = new LoECreativeTabs("tabMiscLoE"); public static LoECreativeTabs tabFoodLoE = new LoECreativeTabs("tabFoodLoE"); public static LoECreativeTabs tabDecoLoE = new LoECreativeTabs("tabDecoLoE"); + public static LoECreativeTabs tabCharacterLoE = new LoECreativeTabs("tabCharacterLoE"); public ItemStack theIcon; @@ -28,6 +29,7 @@ public class LoECreativeTabs extends CreativeTabs { tabMiscLoE.theIcon = new ItemStack(CinderLoE.bonemold); tabFoodLoE.theIcon = new ItemStack(CinderLoE.onion); tabDecoLoE.theIcon = new ItemStack(CinderLoE.silverChain); + tabCharacterLoE.theIcon = new ItemStack(CinderLoE.sarumanStaff); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/CinderBlock.java b/src/main/java/com/zivilon/cinder_loe/blocks/CinderBlock.java index c0884f4..602a66f 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/CinderBlock.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/CinderBlock.java @@ -1,6 +1,6 @@ package com.zivilon.cinder_loe.blocks; -import lotr.common.LOTRCreativeTabs; +import com.zivilon.cinder_loe.LoECreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,13 +17,7 @@ public class CinderBlock extends Block { public CinderBlock() { super(Material.rock); - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); setHardness(2.0F); setResistance(5.0F); setBlockTextureName("lotr:cinder_block"); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java b/src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java new file mode 100644 index 0000000..4ee562f --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/EnchantedIce.java @@ -0,0 +1,47 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.LoECreativeTabs; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockIce; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import java.lang.reflect.Field; +import java.util.Random; + +public class EnchantedIce extends BlockIce { + public IIcon baseIcon; + + public EnchantedIce() { + super(); + this.setTickRandomly(false); + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); + setBlockTextureName("minecraft:ice"); + setBlockName("lotr:enchantedIce"); + setLightLevel(0.25F); + } + + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + this.baseIcon = iconRegister.registerIcon(this.getTextureName()); + } + + @Override + public IIcon getIcon(int side, int meta) { + return this.baseIcon; + } + + public IIcon getBaseIcon() { + return this.baseIcon; + } + + @Override + public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {} +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java b/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java index 1854254..4f0647c 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java +++ b/src/main/java/com/zivilon/cinder_loe/items/CinderLoESpawnEgg.java @@ -1,6 +1,6 @@ package com.zivilon.cinder_loe.items; -import net.minecraft.creativetab.CreativeTabs; +import com.zivilon.cinder_loe.LoECreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; @@ -19,7 +19,7 @@ public class CinderLoESpawnEgg extends Item { this.entityClass = entityClass; this.setUnlocalizedName("spawn_egg_" + entityClass.getSimpleName().toLowerCase()); this.setTextureName("spawn_egg"); - this.setCreativeTab(CreativeTabs.tabMisc); // Or any other tab you prefer + this.setCreativeTab(LoECreativeTabs.tabSpawnLoE); } @Override diff --git a/src/main/java/com/zivilon/cinder_loe/items/FirstAgeGlaive.java b/src/main/java/com/zivilon/cinder_loe/items/FirstAgeGlaive.java new file mode 100644 index 0000000..7d36235 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/FirstAgeGlaive.java @@ -0,0 +1,57 @@ +package com.zivilon.cinder_loe.items; + +import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.LoECreativeTabs; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import lotr.common.LOTRBannerProtection; +import lotr.common.LOTRMod; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; +import lotr.common.item.LOTRItemSword; +import lotr.common.item.LOTRItemPolearm; +import lotr.common.item.LOTRMaterial; +import lotr.common.item.LOTRWeaponStats; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class FirstAgeGlaive extends LOTRItemPolearm { + public FirstAgeGlaive() { + super(CinderLoE.MATERIAL_NEX_ICE); + this.lotrWeaponDamage = 11.5F; + this.setUnlocalizedName("lotr:firstAgeGlaive"); + this.setTextureName("lotr:firstAgeGlaive"); + this.setCreativeTab(LoECreativeTabs.tabCombatLoE); + LOTRWeaponStats.registerMeleeReach(FirstAgeGlaive.class, 1.8F); + LOTRWeaponStats.registerMeleeSpeed(FirstAgeGlaive.class, 1.0F); + } + + public boolean getIsRepairable(ItemStack itemstack, ItemStack repairItem) { + return (repairItem.getItem() == Item.getItemFromBlock(CinderLoE.enchantedIce)); + } + +// private void checkIncompatibleModifiers(ItemStack itemstack) {} + + public static UUID accessWeaponDamageModifier() { + return null; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java index 27ae090..613b0b6 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java +++ b/src/main/java/com/zivilon/cinder_loe/items/ToxicCore.java @@ -1,10 +1,15 @@ package com.zivilon.cinder_loe.items; +import com.zivilon.cinder_loe.LoECreativeTabs; + import net.minecraft.item.Item; public class ToxicCore extends Item { public ToxicCore() { + this.setUnlocalizedName("lotr:toxicCore"); + this.setTextureName("lotr:toxicCore"); + setCreativeTab(LoECreativeTabs.tabMiscLoE); this.setMaxDamage(100); this.setNoRepair(); this.setMaxStackSize(1); diff --git a/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java b/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java index a581680..b08ba43 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java +++ b/src/main/java/com/zivilon/cinder_loe/items/WarDartHeads.java @@ -1,5 +1,7 @@ package com.zivilon.cinder_loe.items; +import com.zivilon.cinder_loe.LoECreativeTabs; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -14,13 +16,13 @@ public class WarDartHeads extends Item { public WarDartHeads() { super(); - setCreativeTab(CreativeTabs.tabMisc); - setHasSubtypes(true); // Allows for different metadata values + this.setCreativeTab(LoECreativeTabs.tabMiscLoE); + setHasSubtypes(true); } @Override public void registerIcons(IIconRegister iconRegister) { - icons = new IIcon[6]; // 6 icons for 0 to 5 count levels + icons = new IIcon[6]; for (int i = 0; i < icons.length; i++) { icons[i] = iconRegister.registerIcon("lotr:war_dart_heads_" + i); } @@ -67,4 +69,11 @@ public class WarDartHeads extends Item { return icons[count]; } } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 1; i < 14; i++) { + list.add(new ItemStack(item, 1, i)); + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/items/Whip.java b/src/main/java/com/zivilon/cinder_loe/items/Whip.java index 2ef6db8..dc08139 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/Whip.java +++ b/src/main/java/com/zivilon/cinder_loe/items/Whip.java @@ -1,5 +1,7 @@ package com.zivilon.cinder_loe.items; +import com.zivilon.cinder_loe.LoECreativeTabs; + import java.util.ArrayList; import java.util.List; @@ -32,6 +34,7 @@ import net.minecraft.world.World; public class Whip extends LOTRItemSword { public Whip() { super(LOTRMaterial.FUR); + this.setCreativeTab(LoECreativeTabs.tabCombatLoE); this.lotrWeaponDamage = 4.0F; LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F); } diff --git a/src/main/java/com/zivilon/cinder_loe/items/WizardStaff.java b/src/main/java/com/zivilon/cinder_loe/items/WizardStaff.java index e65b292..ffaa2df 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/WizardStaff.java +++ b/src/main/java/com/zivilon/cinder_loe/items/WizardStaff.java @@ -1,11 +1,11 @@ package com.zivilon.cinder_loe.items; +import com.zivilon.cinder_loe.LoECreativeTabs; + import cpw.mods.fml.common.network.simpleimpl.IMessage; -import lotr.common.LOTRCreativeTabs; import lotr.common.entity.projectile.LOTREntityGandalfFireball; import lotr.common.network.LOTRPacketHandler; import lotr.common.network.LOTRPacketWeaponFX; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -22,7 +22,7 @@ import com.zivilon.cinder_loe.CinderLoE; public class WizardStaff extends LOTRItemSword implements LOTRStoryItem { public WizardStaff() { super(CinderLoE.getLOTRMaterialByName("WIZARD")); - setCreativeTab((CreativeTabs)LOTRCreativeTabs.tabStory); + this.setCreativeTab(LoECreativeTabs.tabCharacterLoE); } public int getMaxItemUseDuration(ItemStack itemstack) { diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentType.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentType.java new file mode 100644 index 0000000..e871d08 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREnchantmentType.java @@ -0,0 +1,26 @@ +package com.zivilon.cinder_loe.mixins; + +import com.zivilon.cinder_loe.util.LOTREnchantmentExclusions; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import lotr.common.enchant.LOTREnchantmentType; +import lotr.common.item.LOTRWeaponStats; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; + +@Mixin(LOTREnchantmentType.class) +public class MixinLOTREnchantmentType { + + @Inject(method = "canApply", at = @At("HEAD"), cancellable = true, remap = false) + public void onCanApply(ItemStack itemstack, boolean considering, CallbackInfoReturnable cir) { + Item item = itemstack.getItem(); + if (LOTREnchantmentExclusions.exclusions.contains(item)) { + cir.setReturnValue(false); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java b/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java index ec08bcb..242a81a 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java +++ b/src/main/java/com/zivilon/cinder_loe/util/DurableItemCrafter.java @@ -8,8 +8,8 @@ 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<>(); + public static List customItems = new ArrayList<>(); + public static List exceptionItems = new ArrayList<>(); static { customItems.add(LOTRMod.chisel); customItems.add(CinderLoE.toxicCore); diff --git a/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java b/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java new file mode 100644 index 0000000..8327caf --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/util/LOTREnchantmentExclusions.java @@ -0,0 +1,15 @@ +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 LOTREnchantmentExclusions { + public static List exclusions = new ArrayList<>(); + static { + exclusions.add(CinderLoE.firstAgeGlaive); + } +} diff --git a/src/main/resources/mixins.cinder_loe.json b/src/main/resources/mixins.cinder_loe.json index 5b0c8cd..c33d57e 100644 --- a/src/main/resources/mixins.cinder_loe.json +++ b/src/main/resources/mixins.cinder_loe.json @@ -31,7 +31,8 @@ "MixinLOTRWorldGenMumakSkeleton", "MixinRendererLivingEntity", "MixinRenderItem", - "MixinSlotCrafting" + "MixinSlotCrafting", + "MixinLOTREnchantmentType" ], "client": [] }