From bacaf114fb01172ae3682338110f72b570b000e2 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 27 Oct 2020 18:32:03 -0400 Subject: [PATCH] Fixed Sentient Sword Fixed the sentient sword so that it now extends `SwordItem` --- .../bloodmagic/common/item/BMItemTier.java | 62 +++++++++++++++++++ .../common/item/soul/ItemSentientSword.java | 6 +- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 src/main/java/wayoftime/bloodmagic/common/item/BMItemTier.java diff --git a/src/main/java/wayoftime/bloodmagic/common/item/BMItemTier.java b/src/main/java/wayoftime/bloodmagic/common/item/BMItemTier.java new file mode 100644 index 00000000..9da76ed4 --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/common/item/BMItemTier.java @@ -0,0 +1,62 @@ +package wayoftime.bloodmagic.common.item; + +import java.util.function.Supplier; + +import net.minecraft.item.IItemTier; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.LazyValue; + +public enum BMItemTier implements IItemTier +{ + SENTIENT(4, 512, 6.0F, 2.0F, 50, () -> { + return Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()); + }); + + private final int harvestLevel; + private final int maxUses; + private final float efficiency; + private final float attackDamage; + private final int enchantability; + private final LazyValue repairMaterial; + + private BMItemTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier repairMaterialIn) + { + this.harvestLevel = harvestLevelIn; + this.maxUses = maxUsesIn; + this.efficiency = efficiencyIn; + this.attackDamage = attackDamageIn; + this.enchantability = enchantabilityIn; + this.repairMaterial = new LazyValue<>(repairMaterialIn); + } + + public int getMaxUses() + { + return this.maxUses; + } + + public float getEfficiency() + { + return this.efficiency; + } + + public float getAttackDamage() + { + return this.attackDamage; + } + + public int getHarvestLevel() + { + return this.harvestLevel; + } + + public int getEnchantability() + { + return this.enchantability; + } + + public Ingredient getRepairMaterial() + { + return this.repairMaterial.getValue(); + } + +} diff --git a/src/main/java/wayoftime/bloodmagic/common/item/soul/ItemSentientSword.java b/src/main/java/wayoftime/bloodmagic/common/item/soul/ItemSentientSword.java index 8e59bcd2..a19c1d7e 100644 --- a/src/main/java/wayoftime/bloodmagic/common/item/soul/ItemSentientSword.java +++ b/src/main/java/wayoftime/bloodmagic/common/item/soul/ItemSentientSword.java @@ -20,6 +20,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.SwordItem; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -30,6 +31,7 @@ import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import wayoftime.bloodmagic.BloodMagic; +import wayoftime.bloodmagic.common.item.BMItemTier; import wayoftime.bloodmagic.common.item.BloodMagicItems; import wayoftime.bloodmagic.iface.IMultiWillTool; import wayoftime.bloodmagic.util.Constants; @@ -39,7 +41,7 @@ import wayoftime.bloodmagic.will.IDemonWill; import wayoftime.bloodmagic.will.IDemonWillWeapon; import wayoftime.bloodmagic.will.PlayerDemonWillHandler; -public class ItemSentientSword extends Item implements IDemonWillWeapon, IMultiWillTool +public class ItemSentientSword extends SwordItem implements IDemonWillWeapon, IMultiWillTool { public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000, 2000, 4000 }; @@ -81,7 +83,7 @@ public class ItemSentientSword extends Item implements IDemonWillWeapon, IMultiW public ItemSentientSword() { // super(RegistrarBloodMagicItems.SOUL_TOOL_MATERIAL); - super(new Item.Properties().maxDamage(520).group(BloodMagic.TAB)); + super(BMItemTier.SENTIENT, 6, -2.6f, new Item.Properties().maxDamage(520).group(BloodMagic.TAB)); } // @Override