equivalent-exchange-3/src/main/java/com/pahimar/ee3/item/ItemMiniumShard.java
2023-01-03 17:47:36 +01:00

30 lines
1,000 B
Java

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;
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) {
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;
}
}