use of vazkii.botania.api.recipe.StateIngredient in project Botania by VazkiiMods.
the class StateIngredientTagExcluding method serialize.
@Override
public JsonObject serialize() {
JsonObject object = new JsonObject();
object.addProperty("type", "tag_excluding");
object.addProperty("tag", getTagId().toString());
JsonArray array = new JsonArray();
for (StateIngredient exclude : excludes) {
array.add(exclude.serialize());
}
object.add("exclude", array);
return object;
}
use of vazkii.botania.api.recipe.StateIngredient in project Botania by VazkiiMods.
the class PureDaisyRecipeCategory method setRecipe.
// todo fluid input rendering is probably kinda janky with waterlogged blocks. Might be worth getting rid of it entirely and only checking for full fluid blocks
@Override
public void setRecipe(@Nonnull IRecipeLayoutBuilder builder, @Nonnull IPureDaisyRecipe recipe, @Nonnull IFocusGroup focusGroup) {
StateIngredient input = recipe.getInput();
IRecipeSlotBuilder inputSlotBuilder = builder.addSlot(RecipeIngredientRole.INPUT, 9, 12).setFluidRenderer(1000, false, 16, 16);
for (var state : input.getDisplayed()) {
if (!state.getFluidState().isEmpty()) {
inputSlotBuilder.addIngredient(VanillaTypes.FLUID, new FluidStack(state.getFluidState().getType(), 1000));
}
}
inputSlotBuilder.addItemStacks(input.getDisplayedStacks()).addTooltipCallback((view, tooltip) -> tooltip.addAll(input.descriptionTooltip()));
builder.addSlot(RecipeIngredientRole.CATALYST, 39, 12).addItemStack(new ItemStack(ModSubtiles.pureDaisy));
Block outBlock = recipe.getOutputState().getBlock();
FluidState outFluid = outBlock.defaultBlockState().getFluidState();
if (!outFluid.isEmpty()) {
builder.addSlot(RecipeIngredientRole.OUTPUT, 68, 12).setFluidRenderer(1000, false, 16, 16).addIngredient(VanillaTypes.FLUID, new FluidStack(outFluid.getType(), 1000));
} else {
if (outBlock.asItem() != Items.AIR) {
builder.addSlot(RecipeIngredientRole.OUTPUT, 68, 12).addItemStack(new ItemStack(outBlock));
}
}
}
use of vazkii.botania.api.recipe.StateIngredient in project Botania by VazkiiMods.
the class ManaPoolREICategory method setupDisplay.
@Override
@Nonnull
public List<Widget> setupDisplay(ManaPoolREIDisplay display, Rectangle bounds) {
List<Widget> widgets = new ArrayList<>();
ItemStack pool = manaPool.getValue().copy();
ItemNBTHelper.setBoolean(pool, "RenderFull", true);
EntryStack<ItemStack> renderPool = EntryStacks.of(pool);
Point center = new Point(bounds.getCenterX() - 8, bounds.getCenterY() - 14);
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createDrawableWidget(((helper, matrices, mouseX, mouseY, delta) -> {
CategoryUtils.drawOverlay(helper, matrices, OVERLAY, center.x - 23, center.y - 13, 0, 0, 65, 44);
HUDHandler.renderManaBar(matrices, center.x - 43, center.y + 37, 0x0000FF, 0.75F, display.getManaCost(), TilePool.MAX_MANA / 10);
})));
widgets.add(Widgets.createSlot(center).entry(renderPool).disableBackground());
StateIngredient catalyst = display.getCatalyst();
if (catalyst != null) {
List<EntryStack<ItemStack>> entries = catalyst.getDisplayed().stream().map(state -> EntryStacks.of(state.getBlock())).collect(Collectors.toList());
widgets.add(Widgets.createSlot(new Point(center.x - 50, center.y)).entries(entries).disableBackground());
}
widgets.add(Widgets.createSlot(new Point(center.x - 30, center.y)).entries(display.getInputEntries().get(0)).disableBackground());
widgets.add(Widgets.createSlot(new Point(center.x + 29, center.y)).entries(display.getOutputEntries().get(0)).disableBackground());
return widgets;
}
Aggregations