use of hellfirepvp.astralsorcery.common.crafting.helper.ingredient.FluidIngredient in project AstralSorcery by HellFirePvP.
the class RenderPageRecipeTemplate method addInputInformation.
protected void addInputInformation(ItemStack stack, @Nullable Ingredient stackIngredient, List<ITextProperties> tooltip) {
try {
tooltip.addAll(stack.getTooltip(Minecraft.getInstance().player, Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL));
} catch (Exception exc) {
tooltip.add(new TranslationTextComponent("astralsorcery.misc.tooltipError").mergeStyle(TextFormatting.RED));
}
BookLookupInfo info = BookLookupRegistry.findPage(Minecraft.getInstance().player, LogicalSide.CLIENT, stack);
if (info != null && info.canSee(ResearchHelper.getProgress(Minecraft.getInstance().player, LogicalSide.CLIENT)) && !info.getResearchNode().equals(this.getResearchNode())) {
tooltip.add(StringTextComponent.EMPTY);
tooltip.add(new TranslationTextComponent("astralsorcery.misc.craftInformation").mergeStyle(TextFormatting.GRAY));
}
if (stackIngredient != null && Minecraft.getInstance().gameSettings.advancedItemTooltips) {
ITag<Item> itemTag = IngredientHelper.guessTag(stackIngredient);
if (itemTag instanceof ITag.INamedTag) {
tooltip.add(StringTextComponent.EMPTY);
tooltip.add(new TranslationTextComponent("astralsorcery.misc.input.tag", ((ITag.INamedTag<Item>) itemTag).getName().toString()).mergeStyle(TextFormatting.GRAY));
}
if (stackIngredient instanceof FluidIngredient) {
List<FluidStack> fluids = ((FluidIngredient) stackIngredient).getFluids();
if (!fluids.isEmpty()) {
ITextProperties cmp = null;
for (FluidStack f : fluids) {
if (cmp == null) {
cmp = f.getFluid().getAttributes().getDisplayName(f);
} else {
cmp = new TranslationTextComponent("astralsorcery.misc.input.fluid.chain", cmp, f.getFluid().getAttributes().getDisplayName(f)).mergeStyle(TextFormatting.GRAY);
}
}
tooltip.add(StringTextComponent.EMPTY);
tooltip.add(new TranslationTextComponent("astralsorcery.misc.input.fluid", cmp).mergeStyle(TextFormatting.GRAY));
}
}
}
}
use of hellfirepvp.astralsorcery.common.crafting.helper.ingredient.FluidIngredient in project AstralSorcery by HellFirePvP.
the class ActiveSimpleAltarRecipe method consumeInputs.
public void consumeInputs(TileAltar altar) {
TileInventory inv = altar.getInventory();
AltarRecipeGrid grid = this.recipeToCraft.getInputs();
for (int slot = 0; slot < AltarRecipeGrid.MAX_INVENTORY_SIZE; slot++) {
Ingredient input = grid.getIngredient(slot);
if (input instanceof FluidIngredient) {
ItemStack stack = inv.getStackInSlot(slot);
FluidActionResult far = FluidUtil.tryEmptyContainer(stack, VoidFluidHandler.INSTANCE, FluidAttributes.BUCKET_VOLUME, null, true);
if (far.isSuccess()) {
inv.setStackInSlot(slot, far.getResult());
}
} else {
ItemUtils.decrementItem(inv, slot, altar::dropItemOnTop);
}
}
for (CraftingFocusStack input : this.focusStacks) {
TileSpectralRelay tar = MiscUtils.getTileAt(altar.getWorld(), input.getRealPosition(), TileSpectralRelay.class, true);
if (tar != null) {
TileInventory tarInventory = tar.getInventory();
if (input.getInput() != null && input.getInput().getIngredient() instanceof FluidIngredient) {
ItemStack stack = tarInventory.getStackInSlot(0);
FluidActionResult far = FluidUtil.tryEmptyContainer(stack, VoidFluidHandler.INSTANCE, FluidAttributes.BUCKET_VOLUME, null, true);
if (far.isSuccess()) {
tarInventory.setStackInSlot(0, far.getResult());
}
} else {
ItemUtils.decrementItem(tarInventory, 0, altar::dropItemOnTop);
}
}
}
}
Aggregations