package eiteam.esteemedinnovation.storage.steam;
import eiteam.esteemedinnovation.armor.exosuit.steam.ItemSteamExosuitArmor;
import eiteam.esteemedinnovation.armor.exosuit.steam.ModelSteamExosuit;
import eiteam.esteemedinnovation.commons.Config;
import eiteam.esteemedinnovation.api.exosuit.ExosuitSlot;
import eiteam.esteemedinnovation.api.exosuit.ExosuitTank;
import eiteam.esteemedinnovation.api.exosuit.ExosuitUpgrade;
import eiteam.esteemedinnovation.api.exosuit.ModelExosuitUpgrade;
import eiteam.esteemedinnovation.misc.BlockManyMetadataItem;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import java.util.List;
public class BlockTankItem extends BlockManyMetadataItem implements ExosuitTank, ExosuitUpgrade {
public BlockTankItem(Block block) {
super(block);
}
@Override
public int renderPriority() {
return 0;
}
@Override
public ExosuitSlot getSlot() {
return ExosuitSlot.BODY_TANK;
}
@Override
public ResourceLocation getOverlay() {
return null;
}
@Override
public Class<? extends ModelExosuitUpgrade> getModel() {
return ModelExosuitTank.class;
}
@Override
public void updateModel(ModelBiped parentModel, EntityLivingBase entityLivingBase, ItemStack itemStack, ModelExosuitUpgrade modelExosuitUpgrade) {
float pressure = 0.0F;
if (itemStack.getMaxDamage() != 0) {
pressure = itemStack.getItemDamage() / (float) itemStack.getMaxDamage();
}
modelExosuitUpgrade.nbtTagCompound.setFloat("pressure", pressure);
int dye = -1;
ItemSteamExosuitArmor item = ((ItemSteamExosuitArmor) itemStack.getItem());
if (item.getStackInSlot(itemStack, 2) != null) {
int dyeIndex = ModelSteamExosuit.findDyeIndexFromItemStack(item.getStackInSlot(itemStack, 2));
if (dyeIndex != -1) {
dye = dyeIndex;
}
}
modelExosuitUpgrade.nbtTagCompound.setInteger("dye", dye);
}
@Override
public void writeInfo(List list) {}
@Override
public boolean canFill(ItemStack stack) {
return true;
}
@Override
public int getStorage(ItemStack stack) {
int cap = Config.basicTankCapacity;
if (((ItemSteamExosuitArmor) stack.getItem()).getStackInSlot(stack, 5).getItemDamage() == 1) {
cap = Integer.MAX_VALUE;
}
return cap;
}
}