mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 19:59:55 +00:00
retire modElectric
This commit is contained in:
1 parent
983c91c2c9
commit
b8bd6259ee
38 files changed
+95
-1406
No files matched your search
@@ -1,6 +1,6 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import ic2.api.item.*;
|
||||
import tconstruct.library.util.MathUtils;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.IBehaviorDispenseItem;
|
||||
import net.minecraft.entity.*;
|
||||
@@ -10,12 +10,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
/**
|
||||
* NBTTags
|
||||
* Main tag - InfiArmor
|
||||
*/
|
||||
public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem, IBoxable, ISpecialArmor
|
||||
public abstract class ArmorCore extends ItemArmor implements IEnergyContainerItem, ISpecialArmor
|
||||
{
|
||||
|
||||
public static final String SET_NAME = "InfiArmor";
|
||||
@@ -23,6 +24,11 @@ public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem
|
||||
private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDispenseArmorCopy();
|
||||
public final int baseProtection;
|
||||
|
||||
//TE power constants -- TODO grab these from the items added
|
||||
protected int capacity = 400000;
|
||||
protected int maxReceive = 75;
|
||||
protected int maxExtract = 75;
|
||||
|
||||
public ArmorCore(int par1, int baseProtection, EnumArmorPart part)
|
||||
{
|
||||
super(par1, EnumArmorMaterial.CHAIN, 0, 0);
|
||||
@@ -94,19 +100,19 @@ public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem
|
||||
|
||||
data = tags.getCompoundTag(SET_NAME);
|
||||
|
||||
if (tags.hasKey("charge"))
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int charge = tags.getInteger("charge");
|
||||
if (charge > damage)
|
||||
int energy = tags.getInteger("Energy");
|
||||
if (energy > damage)
|
||||
{
|
||||
charge -= damage;
|
||||
tags.setInteger("charge", charge);
|
||||
energy -= damage;
|
||||
tags.setInteger("Energy", energy);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
damage -= charge;
|
||||
tags.setInteger("charge", 0);
|
||||
damage -= energy;
|
||||
tags.setInteger("Energy", 0);
|
||||
int dmg = data.getInteger("Damage");
|
||||
dmg += damage;
|
||||
data.setInteger("Damage", dmg);
|
||||
@@ -121,143 +127,81 @@ public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* IC2 API support
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean canBeStoredInToolbox (ItemStack stack)
|
||||
//TE support section -- from COFH core API reference section
|
||||
public void setMaxTransfer (int maxTransfer)
|
||||
{
|
||||
return true;
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive (int maxReceive)
|
||||
{
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract (int maxExtract)
|
||||
{
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy (ItemStack container, int maxReceive, boolean simulate)
|
||||
{
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
return 0;
|
||||
int energy = tags.getInteger("Energy");
|
||||
int energyReceived = MathUtils.minInt(capacity - energy, MathUtils.minInt(this.maxReceive, maxReceive));
|
||||
if (!simulate)
|
||||
{
|
||||
energy += energyReceived;
|
||||
tags.setInteger("Energy", energy);
|
||||
container.setItemDamage(1 + (getMaxEnergyStored(container) - energy) * (container.getMaxDamage() - 2) / getMaxEnergyStored(container));
|
||||
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy (ItemStack stack)
|
||||
public int extractEnergy (ItemStack container, int maxExtract, boolean simulate)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
return tags.hasKey("charge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChargedItemId (ItemStack stack)
|
||||
{
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEmptyItemId (ItemStack stack)
|
||||
{
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCharge (ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
return tags.hasKey("charge") ? 10000 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier (ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransferLimit (ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
return tags.hasKey("charge") ? 32 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.hasKey("charge"))
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (amount > 0)
|
||||
int energy = tags.getInteger("Energy");
|
||||
int energyExtracted = MathUtils.minInt(energy, MathUtils.minInt(this.maxExtract, maxExtract));
|
||||
if (!simulate)
|
||||
{
|
||||
if (amount > getTransferLimit(stack) && !ignoreTransferLimit)
|
||||
{
|
||||
amount = getTransferLimit(stack);
|
||||
}
|
||||
energy -= energyExtracted;
|
||||
tags.setInteger("Energy", energy);
|
||||
container.setItemDamage(1 + (getMaxEnergyStored(container) - energy) * (container.getMaxDamage() - 1) / getMaxEnergyStored(container));
|
||||
|
||||
int charge = tags.getInteger("charge");
|
||||
|
||||
if (amount > getMaxCharge(stack))
|
||||
{
|
||||
amount = getMaxCharge(stack);
|
||||
}
|
||||
|
||||
charge += amount;
|
||||
|
||||
if (!simulate)
|
||||
{
|
||||
tags.setInteger("charge", charge);
|
||||
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack));
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
else
|
||||
return 0;
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
public int getEnergyStored (ItemStack container)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.hasKey("charge"))
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
if (amount > getTransferLimit(stack))
|
||||
{
|
||||
amount = getTransferLimit(stack);
|
||||
}
|
||||
|
||||
int charge = tags.getInteger("charge");
|
||||
|
||||
if (amount > charge)
|
||||
{
|
||||
amount = charge;
|
||||
}
|
||||
|
||||
charge -= amount;
|
||||
|
||||
if (!simulate)
|
||||
{
|
||||
tags.setInteger("charge", charge);
|
||||
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack));
|
||||
}
|
||||
|
||||
return charge;
|
||||
}
|
||||
|
||||
else
|
||||
return tags.getInteger("Energy");
|
||||
}
|
||||
@Override
|
||||
public int getMaxEnergyStored (ItemStack container)
|
||||
{
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
return 0;
|
||||
return capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse (ItemStack stack, int amount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShowChargeToolTip (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//end of TE support section
|
||||
|
||||
// Vanilla overrides
|
||||
public boolean isItemTool (ItemStack par1ItemStack)
|
||||
@@ -300,12 +244,12 @@ public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tags.hasKey("charge"))
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int charge = tags.getInteger("charge");
|
||||
if (charge > 0)
|
||||
int energy = tags.getInteger("Energy");
|
||||
if (energy > 0)
|
||||
{
|
||||
return this.getMaxCharge(stack);
|
||||
return this.getMaxEnergyStored(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,12 +264,12 @@ public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tags.hasKey("charge"))
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int charge = tags.getInteger("charge");
|
||||
if (charge > 0)
|
||||
int energy = tags.getInteger("Energy");
|
||||
if (energy > 0)
|
||||
{
|
||||
return this.getMaxCharge(stack) - charge;
|
||||
return this.getMaxEnergyStored(stack) - energy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import ic2.api.item.ICustomElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -389,16 +386,11 @@ public class AbilityHelper
|
||||
|
||||
public static boolean damageElectricTool (ItemStack stack, NBTTagCompound tags, Entity entity)
|
||||
{
|
||||
if (tags.hasKey("charge") || tags.hasKey("Energy"))
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int charge = -1;
|
||||
int energy = -1;
|
||||
if (tags.hasKey("charge"))
|
||||
{
|
||||
charge = tags.getInteger("charge");
|
||||
}
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
energy = tags.getInteger("Energy");
|
||||
@@ -430,22 +422,6 @@ public class AbilityHelper
|
||||
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
trueSpeed *= 6;
|
||||
if (charge > 0)
|
||||
{
|
||||
if (charge < trueSpeed)
|
||||
{
|
||||
if (charge > 0)
|
||||
tags.setInteger("charge", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
charge -= trueSpeed;
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
stack.setItemDamage(1 + (tool.getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / tool.getMaxCharge(stack));
|
||||
tags.setInteger("charge", charge);
|
||||
if (entity instanceof EntityPlayer)
|
||||
chargeFromArmor(stack, (EntityPlayer) entity);
|
||||
}
|
||||
if (energy > 0)
|
||||
{
|
||||
if (energy < trueSpeed)
|
||||
@@ -468,98 +444,6 @@ public class AbilityHelper
|
||||
}
|
||||
}
|
||||
|
||||
static void chargeFromArmor (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
boolean inContainer = false;
|
||||
|
||||
for (int armorIter = 0; armorIter < 4; ++armorIter)
|
||||
{
|
||||
ItemStack armor = player.inventory.armorInventory[armorIter];
|
||||
|
||||
if (armor != null && armor.getItem() instanceof IElectricItem)
|
||||
{
|
||||
IElectricItem electricArmor = (IElectricItem) armor.getItem();
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
|
||||
if (electricArmor.canProvideEnergy(stack) && electricArmor.getTier(stack) >= ((IElectricItem) stack.getItem()).getTier(stack))
|
||||
{
|
||||
int chargeAmount = tool.charge(stack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true);
|
||||
chargeAmount = discharge(armor, chargeAmount, Integer.MAX_VALUE, true, false);
|
||||
|
||||
if (chargeAmount > 0)
|
||||
{
|
||||
tool.charge(stack, chargeAmount, Integer.MAX_VALUE, true, false);
|
||||
inContainer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inContainer)
|
||||
{
|
||||
player.openContainer.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
{
|
||||
IElectricItem ielectricitem = (IElectricItem) stack.getItem();
|
||||
|
||||
if (ielectricitem instanceof ICustomElectricItem)
|
||||
{
|
||||
return ((ICustomElectricItem) ielectricitem).discharge(stack, amount, tier, ignoreTransferLimit, simulate);
|
||||
}
|
||||
else if (amount >= 0 && stack.stackSize <= 1 && ielectricitem.getTier(stack) <= tier)
|
||||
{
|
||||
if (amount > ielectricitem.getTransferLimit(stack) && !ignoreTransferLimit)
|
||||
{
|
||||
amount = ielectricitem.getTransferLimit(stack);
|
||||
}
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
int charge = tags.getInteger("charge");
|
||||
|
||||
if (amount > charge)
|
||||
{
|
||||
amount = charge;
|
||||
}
|
||||
|
||||
charge -= amount;
|
||||
|
||||
if (!simulate)
|
||||
{
|
||||
tags.setInteger("charge", charge);
|
||||
stack.itemID = charge > 0 ? ielectricitem.getChargedItemId(stack) : ielectricitem.getEmptyItemId(stack);
|
||||
|
||||
if (stack.getItem() instanceof IElectricItem)
|
||||
{
|
||||
ielectricitem = (IElectricItem) stack.getItem();
|
||||
|
||||
if (stack.getMaxDamage() > 2)
|
||||
{
|
||||
if (stack.getItemDamage() + 1 < stack.getMaxDamage())
|
||||
stack.setItemDamage(1 + (ielectricitem.getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / ielectricitem.getMaxCharge(stack));
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void breakTool (ItemStack stack, NBTTagCompound tags, Entity entity)
|
||||
{
|
||||
tags.getCompoundTag("InfiTool").setBoolean("Broken", true);
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import ic2.api.item.IBoxable;
|
||||
import ic2.api.item.ICustomElectricItem;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -60,9 +57,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* @see ToolMod
|
||||
*/
|
||||
|
||||
public abstract class ToolCore extends Item implements IEnergyContainerItem, ICustomElectricItem, IBoxable, IBattlegearWeapon
|
||||
public abstract class ToolCore extends Item implements IEnergyContainerItem, IBattlegearWeapon
|
||||
{
|
||||
//TE power constants -- TODO grab these from the
|
||||
//TE power constants -- TODO grab these from the items added
|
||||
protected int capacity = 400000;
|
||||
protected int maxReceive = 75;
|
||||
protected int maxExtract = 75;
|
||||
@@ -341,25 +338,6 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, ICu
|
||||
return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("charge"))
|
||||
{
|
||||
String color = "";
|
||||
//double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("charge");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxCharge(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxCharge(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
}
|
||||
|
||||
String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge(stack)).append(" EU").toString();
|
||||
list.add(charge);
|
||||
}
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
String color = "";
|
||||
@@ -843,13 +821,6 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, ICu
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tags.hasKey("charge"))
|
||||
{
|
||||
int charge = tags.getInteger("charge");
|
||||
if (charge > 0)
|
||||
return this.getMaxCharge(stack);
|
||||
}
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int energy = tags.getInteger("Energy");
|
||||
@@ -866,13 +837,6 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, ICu
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tags.hasKey("charge"))
|
||||
{
|
||||
int charge = tags.getInteger("charge");
|
||||
if (charge > 0)
|
||||
return getMaxCharge(stack) - charge;
|
||||
}
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int energy = tags.getInteger("Energy");
|
||||
@@ -882,142 +846,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, ICu
|
||||
return tags.getCompoundTag("InfiTool").getInteger("Damage");
|
||||
}
|
||||
|
||||
/* IC2 Support
|
||||
* Every tool can be an electric tool if you modify it right
|
||||
*/
|
||||
@Override
|
||||
public boolean canBeStoredInToolbox (ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
/*NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.hasKey("charge"))
|
||||
return false;
|
||||
|
||||
return true;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChargedItemId (ItemStack stack)
|
||||
{
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEmptyItemId (ItemStack stack)
|
||||
{
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCharge (ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.hasKey("charge"))
|
||||
return 0;
|
||||
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier (ItemStack itemStack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransferLimit (ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.hasKey("charge"))
|
||||
return 0;
|
||||
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.hasKey("charge"))
|
||||
return 0;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
if (amount > getTransferLimit(stack) && !ignoreTransferLimit)
|
||||
{
|
||||
amount = getTransferLimit(stack);
|
||||
}
|
||||
|
||||
int charge = tags.getInteger("charge");
|
||||
|
||||
if (amount > getMaxCharge(stack) - charge)
|
||||
{
|
||||
amount = getMaxCharge(stack) - charge;
|
||||
}
|
||||
|
||||
charge += amount;
|
||||
|
||||
if (!simulate)
|
||||
{
|
||||
tags.setInteger("charge", charge);
|
||||
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack));
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("charge"))
|
||||
return 0;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
if (amount > getTransferLimit(stack) && !ignoreTransferLimit)
|
||||
{
|
||||
amount = getTransferLimit(stack);
|
||||
}
|
||||
int charge = tags.getInteger("charge");
|
||||
|
||||
if (amount > charge)
|
||||
{
|
||||
amount = charge;
|
||||
}
|
||||
charge -= amount;
|
||||
if (!simulate)
|
||||
{
|
||||
tags.setInteger("charge", charge);
|
||||
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack));
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShowChargeToolTip (ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse (ItemStack itemStack, int amount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Battlegear support, IBattlegearWeapon */
|
||||
|
||||
|
||||
Reference in new issue
Block a user