#3980 with deployer integration

- Deploying and Item Application recipes now display up to 3 additional rollable output stacks in JEI. Original PR by Christofmeg
This commit is contained in:
simibubi 2022-12-12 13:07:07 +01:00
parent 7dec49768f
commit 8e79317ae4
7 changed files with 389 additions and 371 deletions

View file

@ -565,7 +565,7 @@ c219c77242e645f32704201dd80e279b3759b794 assets/create/lang/en_us.json
83d427726fdc38ec3c5b8c3c0f6f87f49d3e5ff3 assets/create/lang/unfinished/es_cl.json
d21caeb0cbe871e38dc101c34ab89ece3cbe2127 assets/create/lang/unfinished/es_es.json
752876654a1e23def550cd5a338b86baf80e90ce assets/create/lang/unfinished/es_mx.json
a325d24c3de7956c5702c9fc7610b65eb06791bc assets/create/lang/unfinished/fr_fr.json
5bd8c8d5bc9529288eaf9147ae0ee0c52059527c assets/create/lang/unfinished/fr_fr.json
b49206b64026382a642de89c2815f6ed2dcafb7a assets/create/lang/unfinished/it_it.json
8a5e0a600804f18a900a391a25d40a388c883472 assets/create/lang/unfinished/ja_jp.json
ca3000e0001ba5a70a8fda0eab91c09902260231 assets/create/lang/unfinished/ko_kr.json
@ -574,7 +574,7 @@ d5bfeacb442236c8b075fddb41364f85c8cb7feb assets/create/lang/unfinished/pl_pl.jso
0f3f51d065d896a7e3b4abd8c2801fa3e8fbd8c3 assets/create/lang/unfinished/pt_br.json
9f2ec0b2f8fa9b380c7edb56bfb806bcce621cce assets/create/lang/unfinished/pt_pt.json
1f88f0d91bdf5c68224cb65249f77272771939c9 assets/create/lang/unfinished/ro_ro.json
3fb5b13e1345b7b4c2c28ec1d18ff92eb6e92d85 assets/create/lang/unfinished/ru_ru.json
a95340ed064b065ebcb8ef68e02c54583ad2b9c8 assets/create/lang/unfinished/ru_ru.json
ed29ef4ae8f3633533485d56f7fa8cb77b790a0a assets/create/lang/unfinished/uk_ua.json
e5cf7b657be816bc15b331dd058f7ccdabee8c14 assets/create/lang/unfinished/zh_cn.json
7c7d88a1350fd86fa3ae1efee33ee644cde48933 assets/create/lang/unfinished/zh_tw.json

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1",
"_": "Missing Localizations: 0",
"_": "->------------------------] Game Elements [------------------------<-",
@ -2023,7 +2023,7 @@
"block.create.placard.tooltip.behaviour2": "_Убирает_ текущий _предмет_ из рамки.",
"block.create.flywheel.tooltip": "МАХОВИК",
"block.create.flywheel.tooltip.summary": "UNLOCALIZED: _Embellish_ your _Machines_ with this imposing Wheel of Brass.",
"block.create.flywheel.tooltip.summary": "_Украсьте_ свои _штуковины_ этим внушительным латунным колесом.",
"block.create.flywheel.tooltip.condition1": "При вращении",
"block.create.flywheel.tooltip.behaviour1": "Начинает вращаться. Удивительно!",

View file

@ -1,10 +1,13 @@
package com.simibubi.create.compat.jei.category;
import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer;
import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.utility.Lang;
@ -34,22 +37,28 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
.addSlot(RecipeIngredientRole.INPUT, 51, 5)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredients(recipe.getRequiredHeldItem());
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132, 51)
.setBackground(getRenderedSlot(recipe.getRollableResults().get(0)), -1, -1)
.addItemStack(recipe.getResultItem())
.addTooltipCallback(addStochasticTooltip(recipe.getRollableResults().get(0)));
if (recipe.shouldKeepHeldItem()) {
handItemSlot.addTooltipCallback((recipeSlotView, tooltip) -> tooltip.add(1, Lang.translateDirect("recipe.deploying.not_consumed").withStyle(ChatFormatting.GOLD)));
List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1;
for (int i = 0; i < results.size(); i++) {
ProcessingOutput output = results.get(i);
int xOffset = i % 2 == 0 ? 0 : 19;
int yOffset = (i / 2) * -19;
builder.addSlot(RecipeIngredientRole.OUTPUT, single ? 132 : 132 + xOffset, 51 + yOffset)
.setBackground(getRenderedSlot(output), -1, -1)
.addItemStack(output.getStack())
.addTooltipCallback(addStochasticTooltip(output));
}
if (recipe.shouldKeepHeldItem())
handItemSlot.addTooltipCallback((recipeSlotView, tooltip) -> tooltip.add(1, Lang.translateDirect("recipe.deploying.not_consumed").withStyle(ChatFormatting.GOLD)));
}
@Override
public void draw(DeployerApplicationRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SHADOW.render(matrixStack, 62, 57);
AllGuiTextures.JEI_DOWN_ARROW.render(matrixStack, 126, 29);
AllGuiTextures.JEI_DOWN_ARROW.render(matrixStack, 126, 29 + (recipe.getRollableResults().size() > 2 ? -19 : 0));
deployer.draw(matrixStack, getBackground().getWidth() / 2 - 13, 22);
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei.category;
import java.util.List;
import java.util.Optional;
import javax.annotation.ParametersAreNonnullByDefault;
@ -8,6 +9,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.content.contraptions.processing.ItemApplicationRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import com.simibubi.create.foundation.utility.Lang;
@ -46,10 +48,17 @@ public class ItemApplicationCategory extends CreateRecipeCategory<ItemApplicatio
: (view, tooltip) -> {}
);
builder.addSlot(RecipeIngredientRole.OUTPUT, 132, 38)
.setBackground(getRenderedSlot(recipe.getRollableResults().get(0)), -1, -1)
.addItemStack(recipe.getResultItem())
.addTooltipCallback(addStochasticTooltip(recipe.getRollableResults().get(0)));
List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1;
for (int i = 0; i < results.size(); i++) {
ProcessingOutput output = results.get(i);
int xOffset = i % 2 == 0 ? 0 : 19;
int yOffset = (i / 2) * -19;
builder.addSlot(RecipeIngredientRole.OUTPUT, single ? 132 : 132 + xOffset, 38 + yOffset)
.setBackground(getRenderedSlot(output), -1, -1)
.addItemStack(output.getStack())
.addTooltipCallback(addStochasticTooltip(output));
}
}
@Override

View file

@ -32,7 +32,7 @@ public class DeployerApplicationRecipe extends ItemApplicationRecipe implements
@Override
protected int getMaxOutputCount() {
return 2;
return 4;
}
public static DeployerApplicationRecipe convert(Recipe<?> sandpaperRecipe) {

View file

@ -34,7 +34,7 @@ public class ItemApplicationRecipe extends ProcessingRecipe<RecipeWrapper> {
@Override
protected int getMaxOutputCount() {
return 9;
return 4;
}
public boolean shouldKeepHeldItem() {