Merge branch 'master' of https://github.com/calclavia/Resonant-Induction
This commit is contained in:
commit
a57f8fb022
2 changed files with 40 additions and 2 deletions
|
@ -3,13 +3,23 @@
|
||||||
*/
|
*/
|
||||||
package resonantinduction.api;
|
package resonantinduction.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO: Use UE interface after ModJAm
|
||||||
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IBattery
|
public interface IBattery
|
||||||
{
|
{
|
||||||
public float getEnergyStored();
|
public float getEnergyStored(ItemStack itemStack);
|
||||||
|
|
||||||
public float getMaxEnergyStored();
|
public float getMaxEnergyStored();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param itemStack
|
||||||
|
* @param amount
|
||||||
|
*/
|
||||||
|
public void setEnergyStored(ItemStack itemStack, float amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
*/
|
*/
|
||||||
package resonantinduction.battery;
|
package resonantinduction.battery;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import resonantinduction.api.IBattery;
|
||||||
import resonantinduction.base.ItemBase;
|
import resonantinduction.base.ItemBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +14,7 @@ import resonantinduction.base.ItemBase;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ItemCapacitor extends ItemBase
|
public class ItemCapacitor extends ItemBase implements IBattery
|
||||||
{
|
{
|
||||||
public ItemCapacitor(int id)
|
public ItemCapacitor(int id)
|
||||||
{
|
{
|
||||||
|
@ -20,4 +23,29 @@ public class ItemCapacitor extends ItemBase
|
||||||
this.setMaxDamage(1000);
|
this.setMaxDamage(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEnergyStored(ItemStack itemStack, float amount)
|
||||||
|
{
|
||||||
|
if (itemStack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
itemStack.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
itemStack.getTagCompound().setFloat("energyStored", amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEnergyStored(ItemStack itemStack)
|
||||||
|
{
|
||||||
|
if (itemStack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
itemStack.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
return itemStack.getTagCompound().getFloat("energyStored");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getMaxEnergyStored()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue