Updated JEI createDrawable usage for fusion reactor.
This commit is contained in:
parent
f54353290b
commit
f0852a09cf
4 changed files with 19 additions and 94 deletions
|
@ -40,22 +40,18 @@ import javax.annotation.Nullable;
|
|||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class RecipeUtil {
|
||||
private static final int color = Color.darkGray.getRGB();
|
||||
|
||||
private RecipeUtil() {
|
||||
}
|
||||
|
||||
public static void drawInfo(
|
||||
@Nonnull
|
||||
Minecraft minecraft, int x, int y, final double startCost,
|
||||
final double euPerTick, final int tickTime) {
|
||||
public static void drawInfo(@Nonnull Minecraft minecraft, int x, int y, double startCost, double euPerTick,
|
||||
int tickTime) {
|
||||
FontRenderer fontRenderer = minecraft.fontRenderer;
|
||||
int lineSpacing = fontRenderer.FONT_HEIGHT + 1;
|
||||
|
||||
String startCostEU = PowerSystem.getLocaliszedPower(startCost);
|
||||
//String startCostString = I18n.translateToLocalFormatted("techreborn.jei.recipe.start.cost", startCostEU);
|
||||
String startCostString = StringUtils.t("techreborn.jei.recipe.start.cost", startCostEU);
|
||||
fontRenderer.drawString(startCostString, x, y, color);
|
||||
y += lineSpacing;
|
||||
|
@ -63,92 +59,26 @@ public class RecipeUtil {
|
|||
drawInfo(minecraft, x, y, euPerTick, tickTime);
|
||||
}
|
||||
|
||||
public static void drawInfo(
|
||||
@Nonnull
|
||||
Minecraft minecraft, int x, int y, final double euPerTick, final int tickTime) {
|
||||
public static void drawInfo(@Nonnull Minecraft minecraft, int x, int y, double euPerTick, int tickTime) {
|
||||
FontRenderer fontRenderer = minecraft.fontRenderer;
|
||||
int lineSpacing = fontRenderer.FONT_HEIGHT + 1;
|
||||
|
||||
String runningCostString = StringUtils.t("techreborn.jei.recipe.running.cost", PowerSystem.getDisplayPower().abbreviation.toUpperCase(), PowerSystem.getLocaliszedPowerFormattedNoSuffix(euPerTick));
|
||||
//String runningCostString = I18n.translateToLocalFormatted("techreborn.jei.recipe.running.cost",PowerSystem.getDisplayPower().abbreviation.toUpperCase(), PowerSystem.getLocaliszedPowerFormattedNoSuffix(euPerTick));
|
||||
String runningCostString = StringUtils.t("techreborn.jei.recipe.running.cost",
|
||||
PowerSystem.getDisplayPower().abbreviation.toUpperCase(),
|
||||
PowerSystem.getLocaliszedPowerFormattedNoSuffix(euPerTick));
|
||||
fontRenderer.drawString(runningCostString, x, y, color);
|
||||
y += lineSpacing;
|
||||
|
||||
// String processingTimeString1 = I18n.translateToLocalFormatted("techreborn.jei.recipe.processing.time.1", tickTime);
|
||||
String processingTimeString1 = StringUtils.t("techreborn.jei.recipe.processing.time.1", tickTime);
|
||||
String processingTimeString2 = StringUtils.t("techreborn.jei.recipe.processing.time.2", tickTime / 20);
|
||||
fontRenderer.drawString(processingTimeString1, x, y, color);
|
||||
y += lineSpacing;
|
||||
|
||||
int seconds = tickTime / 20;
|
||||
//String processingTimeString2 = I18n.translateToLocalFormatted("techreborn.jei.recipe.processing.time.2", seconds);
|
||||
String processingTimeString2 = StringUtils.t("techreborn.jei.recipe.processing.time.2", seconds);
|
||||
fontRenderer.drawString(processingTimeString2, x + 10, y, color);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void setRecipeItems(
|
||||
@Nonnull
|
||||
IRecipeLayout recipeLayout,
|
||||
@Nonnull
|
||||
BaseRecipeWrapper<?> recipe,
|
||||
@Nullable
|
||||
int[] itemInputSlots,
|
||||
@Nullable
|
||||
int[] itemOutputSlots,
|
||||
@Nullable
|
||||
int[] fluidInputSlots,
|
||||
@Nullable
|
||||
int[] fluidOutputSlots) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
if (itemInputSlots != null) {
|
||||
List<List<ItemStack>> inputs = recipe.getInputs();
|
||||
for (int i = 0; i < inputs.size() && i < itemInputSlots.length; i++) {
|
||||
int inputSlot = itemInputSlots[i];
|
||||
guiItemStacks.set(inputSlot, inputs.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (itemOutputSlots != null) {
|
||||
List<ItemStack> outputs = recipe.getOutputs();
|
||||
for (int i = 0; i < outputs.size() && i < itemOutputSlots.length; i++) {
|
||||
int outputSlot = itemOutputSlots[i];
|
||||
guiItemStacks.set(outputSlot, outputs.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (fluidInputSlots != null) {
|
||||
List<FluidStack> fluidInputs = recipe.getFluidInputs();
|
||||
for (int i = 0; i < fluidInputs.size() && i < fluidInputSlots.length; i++) {
|
||||
int inputTank = fluidInputSlots[i];
|
||||
guiFluidStacks.set(inputTank, fluidInputs.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 1.11
|
||||
// if (fluidOutputSlots != null) {
|
||||
// List<FluidStack> fluidOutputs = recipe.getFluidOutputs();
|
||||
// for (int i = 0; i < fluidOutputs.size() && i < fluidOutputSlots.length; i++) {
|
||||
// int outputTank = fluidOutputSlots[i];
|
||||
// guiFluidStacks.set(outputTank, fluidOutputs.get(i));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static void setRecipeItems(
|
||||
@Nonnull
|
||||
IRecipeLayout recipeLayout,
|
||||
@Nonnull
|
||||
IIngredients ingredients,
|
||||
@Nullable
|
||||
int[] itemInputSlots,
|
||||
@Nullable
|
||||
int[] itemOutputSlots,
|
||||
@Nullable
|
||||
int[] fluidInputSlots,
|
||||
@Nullable
|
||||
int[] fluidOutputSlots) {
|
||||
public static void setRecipeItems(@Nonnull IRecipeLayout recipeLayout, @Nonnull IIngredients ingredients,
|
||||
@Nullable int[] itemInputSlots, @Nullable int[] itemOutputSlots, @Nullable int[] fluidInputSlots,
|
||||
@Nullable int[] fluidOutputSlots) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import techreborn.lib.ModInfo;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
public class FusionReactorRecipeCategory implements IRecipeCategory<FusionReactorRecipeWrapper> {
|
||||
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/jei.png");
|
||||
private static final int inputSlotTop = 0;
|
||||
private static final int inputSlotBottom = 1;
|
||||
|
@ -51,7 +51,7 @@ public class FusionReactorRecipeCategory implements IRecipeCategory<FusionReacto
|
|||
private final String title;
|
||||
|
||||
public FusionReactorRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createDrawable(texture, 0, 172, 116, 64, 0, 40, 20, 20);
|
||||
background = guiHelper.createDrawable(texture, 0, 172, 116, 84);
|
||||
title = StringUtils.t("tile.techreborn:fusion_control_computer.name");
|
||||
}
|
||||
|
||||
|
@ -79,17 +79,12 @@ public class FusionReactorRecipeCategory implements IRecipeCategory<FusionReacto
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(
|
||||
@Nonnull
|
||||
IRecipeLayout recipeLayout,
|
||||
@Nonnull
|
||||
FusionReactorRecipeWrapper recipeWrapper,
|
||||
@Nonnull
|
||||
IIngredients ingredients) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FusionReactorRecipeWrapper recipeWrapper,
|
||||
@Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
itemStacks.init(inputSlotTop, true, 23, 7);
|
||||
itemStacks.init(inputSlotBottom, true, 115, 7);
|
||||
itemStacks.init(outputSlot, false, 69, 7);
|
||||
itemStacks.init(inputSlotTop, true, 3, 7);
|
||||
itemStacks.init(inputSlotBottom, true, 95, 7);
|
||||
itemStacks.init(outputSlot, false, 49, 7);
|
||||
|
||||
itemStacks.set(inputSlotTop, recipeWrapper.getTopInput());
|
||||
itemStacks.set(inputSlotBottom, recipeWrapper.getBottomInput());
|
||||
|
|
|
@ -57,6 +57,6 @@ public class FusionReactorRecipeWrapper implements IRecipeWrapper {
|
|||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
RecipeUtil.drawInfo(minecraft, 0, 67, baseRecipe.getStartEU(), baseRecipe.getEuTick(), baseRecipe.getTickTime());
|
||||
RecipeUtil.drawInfo(minecraft, 0, 34, baseRecipe.getStartEU(), baseRecipe.getEuTick(), baseRecipe.getTickTime());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -679,7 +679,7 @@ keys.techreborn.config=Config
|
|||
techreborn.jei.recipe.start.cost=Start: %s
|
||||
techreborn.jei.recipe.running.cost=%s/t: %s
|
||||
techreborn.jei.recipe.processing.time.1=Time: %s ticks
|
||||
techreborn.jei.recipe.processing.time.2=(%s seconds)
|
||||
techreborn.jei.recipe.processing.time.2=(%s sec)
|
||||
jei.techreborn.scrapbox.name=Opening Scrapboxes
|
||||
techreborn.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.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!
|
||||
|
|
Loading…
Add table
Reference in a new issue