equivalent-exchange-3/src/main/java/com/pahimar/ee3/item/ItemMiniumShard.java

31 lines
1,000 B
Java
Raw Normal View History

2013-08-23 16:59:50 +02:00
package com.pahimar.ee3.item;
import com.pahimar.ee3.api.exchange.EnergyValue;
import com.pahimar.ee3.api.exchange.IEnergyValueProvider;
import com.pahimar.ee3.reference.Names;
import net.minecraft.item.ItemStack;
2023-01-03 17:47:36 +01:00
public class ItemMiniumShard extends ItemEE implements IEnergyValueProvider {
public ItemMiniumShard() {
super();
this.setMaxStackSize(64);
this.setUnlocalizedName(Names.Items.MINIUM_SHARD);
}
@Override
public EnergyValue getEnergyValue(ItemStack itemStack) {
2023-01-03 17:47:36 +01:00
if (itemStack != null && itemStack.hasTagCompound()
&& itemStack.getTagCompound().hasKey(Names.NBT.ENERGY_VALUE)) {
if (Float.compare(
itemStack.getTagCompound().getFloat(Names.NBT.ENERGY_VALUE), 0
)
> 0) {
return new EnergyValue(
itemStack.getTagCompound().getFloat(Names.NBT.ENERGY_VALUE)
);
}
}
return null;
}
2013-08-23 16:59:50 +02:00
}