Fixed the repairing for Sentient equipment.

WHoopsies, forgot that line was commented out!
This commit is contained in:
WayofTime 2020-11-25 10:23:00 -05:00
parent 69ad344aa0
commit 907a0f27e7
5 changed files with 65 additions and 49 deletions

View file

@ -53,6 +53,7 @@ import wayoftime.bloodmagic.api.compat.EnumDemonWillType;
import wayoftime.bloodmagic.api.compat.IDemonWill;
import wayoftime.bloodmagic.api.compat.IDemonWillWeapon;
import wayoftime.bloodmagic.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
@ -82,16 +83,22 @@ public class ItemSentientScythe extends HoeItem implements IDemonWillWeapon, IMu
public static double[] movementSpeed = new double[] { 0.05, 0.1, 0.15, 0.2, 0.25 };
public final double baseAttackDamage = 4;
public final double baseAttackSpeed = -3;
public final static double baseAttackDamage = 4;
public final static double baseAttackSpeed = -3;
private static Map<UUID, Boolean> hitMap = new HashMap<UUID, Boolean>();
public ItemSentientScythe()
{
super(BMItemTier.SENTIENT, 8, -3.1f, new Item.Properties().maxDamage(520).group(BloodMagic.TAB));
super(BMItemTier.SENTIENT, (int) baseAttackDamage, (float) baseAttackSpeed, new Item.Properties().maxDamage(520).group(BloodMagic.TAB));
// super(RegistrarBloodMagicItems.SOUL_TOOL_MATERIAL, 8.0F, 3.1F);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return BloodMagicTags.CRYSTAL_DEMON.contains(repair.getItem()) || super.getIsRepairable(toRepair, repair);
}
@Override
public float getDestroySpeed(ItemStack stack, BlockState state)
{

View file

@ -34,14 +34,15 @@ 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.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.api.compat.EnumDemonWillType;
import wayoftime.bloodmagic.api.compat.IDemonWill;
import wayoftime.bloodmagic.api.compat.IDemonWillWeapon;
import wayoftime.bloodmagic.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.common.item.BMItemTier;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
public class ItemSentientAxe extends AxeItem implements IDemonWillWeapon, IMultiWillTool
@ -91,6 +92,12 @@ public class ItemSentientAxe extends AxeItem implements IDemonWillWeapon, IMulti
}
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return BloodMagicTags.CRYSTAL_DEMON.contains(repair.getItem()) || super.getIsRepairable(toRepair, repair);
}
public void recalculatePowers(ItemStack stack, World world, PlayerEntity player)
{
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
@ -196,8 +203,7 @@ public class ItemSentientAxe extends AxeItem implements IDemonWillWeapon, IMulti
{
float absorption = attacker.getAbsorptionAmount();
attacker.addPotionEffect(new EffectInstance(Effects.ABSORPTION, absorptionTime[willBracket], 127));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth()
* 0.05f, maxAbsorptionHearts));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
}
break;
case VENGEFUL:
@ -361,9 +367,7 @@ public class ItemSentientAxe extends AxeItem implements IDemonWillWeapon, IMulti
{
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
{
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack)
* attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack))
* killedEntity.getMaxHealth() / 20d);
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
soulList.add(soulStack);
}
}

View file

@ -34,14 +34,15 @@ 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.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.api.compat.EnumDemonWillType;
import wayoftime.bloodmagic.api.compat.IDemonWill;
import wayoftime.bloodmagic.api.compat.IDemonWillWeapon;
import wayoftime.bloodmagic.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.common.item.BMItemTier;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
public class ItemSentientPickaxe extends PickaxeItem implements IDemonWillWeapon, IMultiWillTool
@ -77,6 +78,12 @@ public class ItemSentientPickaxe extends PickaxeItem implements IDemonWillWeapon
super(BMItemTier.SENTIENT, (int) baseAttackDamage, (float) baseAttackSpeed, new Item.Properties().maxDamage(520).group(BloodMagic.TAB));
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return BloodMagicTags.CRYSTAL_DEMON.contains(repair.getItem()) || super.getIsRepairable(toRepair, repair);
}
@Override
public float getDestroySpeed(ItemStack stack, BlockState state)
{
@ -195,8 +202,7 @@ public class ItemSentientPickaxe extends PickaxeItem implements IDemonWillWeapon
{
float absorption = attacker.getAbsorptionAmount();
attacker.addPotionEffect(new EffectInstance(Effects.ABSORPTION, absorptionTime[willBracket], 127));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth()
* 0.05f, maxAbsorptionHearts));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
}
break;
case VENGEFUL:
@ -360,9 +366,7 @@ public class ItemSentientPickaxe extends PickaxeItem implements IDemonWillWeapon
{
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
{
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack)
* attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack))
* killedEntity.getMaxHealth() / 20d);
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
soulList.add(soulStack);
}
}

View file

@ -34,14 +34,15 @@ 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.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.api.compat.EnumDemonWillType;
import wayoftime.bloodmagic.api.compat.IDemonWill;
import wayoftime.bloodmagic.api.compat.IDemonWillWeapon;
import wayoftime.bloodmagic.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.common.item.BMItemTier;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
public class ItemSentientShovel extends ShovelItem implements IDemonWillWeapon, IMultiWillTool
@ -77,6 +78,12 @@ public class ItemSentientShovel extends ShovelItem implements IDemonWillWeapon,
super(BMItemTier.SENTIENT, (int) baseAttackDamage, (float) baseAttackSpeed, new Item.Properties().maxDamage(520).group(BloodMagic.TAB));
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return BloodMagicTags.CRYSTAL_DEMON.contains(repair.getItem()) || super.getIsRepairable(toRepair, repair);
}
@Override
public float getDestroySpeed(ItemStack stack, BlockState state)
{
@ -195,8 +202,7 @@ public class ItemSentientShovel extends ShovelItem implements IDemonWillWeapon,
{
float absorption = attacker.getAbsorptionAmount();
attacker.addPotionEffect(new EffectInstance(Effects.ABSORPTION, absorptionTime[willBracket], 127));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth()
* 0.05f, maxAbsorptionHearts));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
}
break;
case VENGEFUL:
@ -361,9 +367,7 @@ public class ItemSentientShovel extends ShovelItem implements IDemonWillWeapon,
{
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
{
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack)
* attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack))
* killedEntity.getMaxHealth() / 20d);
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
soulList.add(soulStack);
}
}

View file

@ -33,14 +33,15 @@ 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.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.api.compat.EnumDemonWillType;
import wayoftime.bloodmagic.api.compat.IDemonWill;
import wayoftime.bloodmagic.api.compat.IDemonWillWeapon;
import wayoftime.bloodmagic.api.compat.IMultiWillTool;
import wayoftime.bloodmagic.common.item.BMItemTier;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NBTHelper;
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
public class ItemSentientSword extends SwordItem implements IDemonWillWeapon, IMultiWillTool
@ -73,12 +74,11 @@ public class ItemSentientSword extends SwordItem implements IDemonWillWeapon, IM
super(BMItemTier.SENTIENT, 6, -2.6f, new Item.Properties().maxDamage(520).group(BloodMagic.TAB));
}
// @Override
// public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
// {
// return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem()
// || super.getIsRepairable(toRepair, repair);
// }
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return BloodMagicTags.CRYSTAL_DEMON.contains(repair.getItem()) || super.getIsRepairable(toRepair, repair);
}
public void recalculatePowers(ItemStack stack, World world, PlayerEntity player)
{
@ -196,8 +196,7 @@ public class ItemSentientSword extends SwordItem implements IDemonWillWeapon, IM
{
float absorption = attacker.getAbsorptionAmount();
attacker.addPotionEffect(new EffectInstance(Effects.ABSORPTION, absorptionTime[willBracket], 127, false, false));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth()
* 0.05f, maxAbsorptionHearts));
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
}
break;
case VENGEFUL:
@ -361,9 +360,7 @@ public class ItemSentientSword extends SwordItem implements IDemonWillWeapon, IM
{
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
{
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack)
* attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack))
* killedEntity.getMaxHealth() / 20d);
ItemStack soulStack = soul.createWill(willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
soulList.add(soulStack);
}
}