use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer in project BloodMagic by WayofTime.
the class TEBellJar method getContainerInfoFromItem.
public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a) {
NBTTagCompound tag = stack.getTagCompound();
if (tag != null) {
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
ReagentContainer[] tanks = new ReagentContainer[size];
ReagentContainerInfo[] infos = new ReagentContainerInfo[size];
for (int i = 0; i < size; i++) {
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
tanks[i] = ReagentContainer.readFromNBT(savedTag);
if (tanks[i] != null) {
infos[i] = tanks[i].getInfo();
}
}
return infos;
}
}
return new ReagentContainerInfo[0];
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer in project BloodMagic by WayofTime.
the class BlockBelljar method getSubBlocks.
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
if (this.equals(ModBlocks.blockCrystalBelljar)) {
par3List.add(new ItemStack(par1, 1, 0));
for (Reagent reagent : ReagentRegistry.reagentList.values()) {
ItemStack stack = new ItemStack(par1, 1, 0);
NBTTagCompound tag = new NBTTagCompound();
ReagentContainer[] tanks = new ReagentContainer[1];
tanks[0] = new ReagentContainer(reagent, 16000, 16000);
NBTTagList tagList = new NBTTagList();
NBTTagCompound savedTag = new NBTTagCompound();
if (tanks[0] != null) {
tanks[0].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
tag.setTag("reagentTanks", tagList);
stack.setTagCompound(tag);
par3List.add(stack);
}
} else {
super.getSubBlocks(par1, par2CreativeTabs, par3List);
}
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer in project BloodMagic by WayofTime.
the class ItemBlockCrystalBelljar method addInformation.
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
ReagentContainer[] tanks = this.getReagentContainers(stack);
if (tanks == null) {
list.add(StatCollector.translateToLocal("tooltip.crystalbelljar.empty"));
} else {
list.add(StatCollector.translateToLocal("tooltip.crystalbelljar.contents"));
for (int i = 0; i < tanks.length; i++) {
if (tanks[i] == null || tanks[i].getReagent() == null || tanks[i].getReagent().reagent == null) {
list.add("- Empty");
} else {
ReagentStack reagentStack = tanks[i].getReagent();
list.add("- " + reagentStack.reagent.name + ": " + reagentStack.amount + "/" + tanks[i].getCapacity() / 1000 + "k AR");
}
}
}
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer in project BloodMagic by WayofTime.
the class ItemBlockCrystalBelljar method getReagentContainers.
public ReagentContainer[] getReagentContainers(ItemStack stack) {
if (stack != null && stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound();
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
ReagentContainer[] tanks = new ReagentContainer[size];
for (int i = 0; i < size; i++) {
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
tanks[i] = ReagentContainer.readFromNBT(savedTag);
}
return tanks;
}
return null;
}
Aggregations