use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo in project BloodMagic by WayofTime.
the class RenderHelper method getHUDElements.
private static List<HUDElement> getHUDElements(Minecraft mc) {
List<HUDElement> elements = new ArrayList();
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
World world = mc.theWorld;
if (movingobjectposition == null) {
return elements;
} else {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY;
int z = movingobjectposition.blockZ;
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof IReagentHandler)) {
return elements;
}
IReagentHandler relay = (IReagentHandler) tile;
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
if (infos != null) {
for (ReagentContainerInfo info : infos) {
if (info == null || info.reagent == null || info.reagent.reagent == null) {
continue;
}
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
if (itemStack != null)
elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
}
}
}
}
return elements;
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo in project BloodMagic by WayofTime.
the class SigilDivination method onItemRightClick.
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
return par1ItemStack;
}
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 0)) {
return par1ItemStack;
}
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null || itemTag.getString("ownerName").equals("")) {
return par1ItemStack;
}
String ownerName = itemTag.getString("ownerName");
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
if (movingobjectposition == null) {
par3EntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + SoulNetworkHandler.getCurrentEssence(ownerName) + "LP"));
return par1ItemStack;
} else {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY;
int z = movingobjectposition.blockZ;
TileEntity tile = par2World.getTileEntity(x, y, z);
if (!(tile instanceof IReagentHandler)) {
par3EntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + SoulNetworkHandler.getCurrentEssence(ownerName) + "LP"));
return par1ItemStack;
}
IReagentHandler relay = (IReagentHandler) tile;
ReagentContainerInfo[] infoList = relay.getContainerInfo(ForgeDirection.UNKNOWN);
if (infoList != null) {
for (ReagentContainerInfo info : infoList) {
if (info != null && info.reagent != null && info.reagent.reagent != null) {
par3EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.reagent") + " " + ReagentRegistry.getKeyForReagent(info.reagent.reagent) + "," + StatCollector.translateToLocal("message.divinationsigil.amount") + " " + info.reagent.amount));
}
}
}
}
}
return par1ItemStack;
}
Aggregations