Add heat to REI

This commit is contained in:
drcrazy 2019-08-20 03:44:54 +03:00
parent 21d77a2d7d
commit fee7d69919
4 changed files with 26 additions and 0 deletions

View file

@ -39,6 +39,10 @@ public class BlastFurnaceRecipe extends RebornRecipe {
public BlastFurnaceRecipe(RebornRecipeType<?> type, Identifier name) {
super(type, name);
}
public int getHeat() {
return heat;
}
@Override
public void deserialize(JsonObject jsonObject) {

View file

@ -94,6 +94,7 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
for (List<ItemStack> inputs : machineRecipe.getInput()){
widgets.add(new SlotWidget(startPoint.x + 1, startPoint.y + 1 + (i++ * 20), Renderer.fromItemStacks(inputs), true, true, true));
}
Text energyPerTick = new TranslatableText("techreborn.jei.recipe.running.cost", "E", machineRecipe.getEnergy());
widgets.add(new LabelWidget(startPoint.x + 1, startPoint.y + 1 + (i++ * 20), energyPerTick.asFormattedString()){
@Override
@ -106,6 +107,17 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
for (ItemStack outputs : machineRecipe.getOutput()){
widgets.add(new SlotWidget(startPoint.x + 61, startPoint.y + 1 + (i++ * 20), Renderer.fromItemStack(outputs), true, true, true));
}
int heat = machineRecipe.getHeat();
if (heat > 0) {
String neededHeat = heat + " " + StringUtils.t("techreborn.jei.recipe.heat");
widgets.add(new LabelWidget(startPoint.x + 61, startPoint.y + 1 + (i++ * 20), neededHeat){
@Override
public void render(int mouseX, int mouseY, float delta) {
font.draw(text, x - font.getStringWidth(text) / 2, y, ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040);
}
});
}
return widgets;
}

View file

@ -28,6 +28,7 @@ import me.shedaniel.rei.api.RecipeDisplay;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.ingredient.RebornIngredient;
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
import reborncore.common.crafting.RebornRecipe;
import java.util.List;
@ -40,17 +41,25 @@ public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDispl
private List<List<ItemStack>> inputs;
private List<ItemStack> outputs;
private int energy = 0;
private int heat = 0;
public MachineRecipeDisplay(R recipe) {
this.recipe = recipe;
this.inputs = recipe.getRebornIngredients().stream().map(RebornIngredient::getPreviewStacks).collect(Collectors.toList());
this.outputs = recipe.getOutputs();
this.energy = recipe.getPower();
if (recipe instanceof BlastFurnaceRecipe) {
this.heat = ((BlastFurnaceRecipe) recipe).getHeat();
}
}
public int getEnergy() {
return energy;
}
public int getHeat() {
return heat;
}
@Override
public Optional<Identifier> getRecipeLocation() {

View file

@ -597,6 +597,7 @@
"techreborn.jei.recipe.running.cost": "%s/t: %s",
"techreborn.jei.recipe.processing.time.1": "Time: %s ticks",
"techreborn.jei.recipe.processing.time.2": "(%s sec)",
"techreborn.jei.recipe.heat": "Heat",
"techreborn.jei.desc.rubberSap": "In order to get sap, you need to find a rubber tree or obtain a rubber tree sapling and proceed to grow it. Once you have obtained a rubber tree, search around for little yellowish spots on the tree. If you don't see any, just wait a bit and eventually these yellow \"sap\" spots. To harvest the sap, use a treetap and use it on the log.",
"techreborn.jei.desc.scrapBox": "Scrapboxes can be opened by either a simple use in hand, or by dispensers. That's right, just throw your scrapboxes into dispensers and give them a redstone signal, and boom! Random item!",