I18n for machines implementation

This commit is contained in:
Bufka2011 2025-08-23 17:09:19 -06:00
parent fb4bca3544
commit fa6b4faeee
6 changed files with 123 additions and 76 deletions

View File

@ -8,6 +8,7 @@ import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.machine.ItemBlueprints; import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineAssemblyMachine; import com.hbm.tileentity.machine.TileEntityMachineAssemblyMachine;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
@ -21,22 +22,22 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_assembler.png"); private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_assembler.png");
private TileEntityMachineAssemblyMachine assembler; private TileEntityMachineAssemblyMachine assembler;
public GUIMachineAssemblyMachine(InventoryPlayer invPlayer, TileEntityMachineAssemblyMachine tedf) { public GUIMachineAssemblyMachine(InventoryPlayer invPlayer, TileEntityMachineAssemblyMachine tedf) {
super(new ContainerMachineAssemblyMachine(invPlayer, tedf)); super(new ContainerMachineAssemblyMachine(invPlayer, tedf));
assembler = tedf; assembler = tedf;
this.xSize = 176; this.xSize = 176;
this.ySize = 256; this.ySize = 256;
} }
@Override @Override
public void drawScreen(int mouseX, int mouseY, float f) { public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f); super.drawScreen(mouseX, mouseY, f);
assembler.inputTank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 99, 52, 16); assembler.inputTank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 99, 52, 16);
assembler.outputTank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 99, 52, 16); assembler.outputTank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 99, 52, 16);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
@ -44,32 +45,32 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe); GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
this.func_146283_a(recipe.print(), mouseX, mouseY); this.func_146283_a(recipe.print(), mouseX, mouseY);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + "Click to set recipe", mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
} }
} }
} }
@Override @Override
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int i, int j) { protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.assembler.hasCustomInventoryName() ? this.assembler.getInventoryName() : I18n.format(this.assembler.getInventoryName()); String name = this.assembler.hasCustomInventoryName() ? this.assembler.getInventoryName() : I18n.format(this.assembler.getInventoryName());
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = (int) (assembler.power * 61 / assembler.maxPower); int p = (int) (assembler.power * 61 / assembler.maxPower);
drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p); drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p);
@ -77,25 +78,25 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
int j = (int) Math.ceil(70 * assembler.assemblerModule.progress); int j = (int) Math.ceil(70 * assembler.assemblerModule.progress);
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
} }
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe); GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe);
/// LEFT LED /// LEFT LED
if(assembler.didProcess) { if(assembler.didProcess) {
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6); drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6);
} else if(recipe != null) { } else if(recipe != null) {
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6); drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6);
} }
/// RIGHT LED /// RIGHT LED
if(assembler.didProcess) { if(assembler.didProcess) {
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6); drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6);
} else if(recipe != null && assembler.power >= recipe.power) { } else if(recipe != null && assembler.power >= recipe.power) {
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6); drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6);
} }
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126); this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126);
if(recipe != null && recipe.inputItem != null) { if(recipe != null && recipe.inputItem != null) {
for(int i = 0; i < recipe.inputItem.length; i++) { for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule.inputSlots[i]); Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule.inputSlots[i]);
@ -115,7 +116,7 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
} }
assembler.inputTank.renderTank(guiLeft + 8, guiTop + 115, this.zLevel, 52, 16, 1); assembler.inputTank.renderTank(guiLeft + 8, guiTop + 115, this.zLevel, 52, 16, 1);
assembler.outputTank.renderTank(guiLeft + 80, guiTop + 115, this.zLevel, 52, 16, 1); assembler.outputTank.renderTank(guiLeft + 80, guiTop + 115, this.zLevel, 52, 16, 1);
} }

View File

@ -8,6 +8,7 @@ import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.machine.ItemBlueprints; import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant; import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
@ -21,15 +22,15 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_chemplant.png"); private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_chemplant.png");
private TileEntityMachineChemicalPlant chemplant; private TileEntityMachineChemicalPlant chemplant;
public GUIMachineChemicalPlant(InventoryPlayer invPlayer, TileEntityMachineChemicalPlant tedf) { public GUIMachineChemicalPlant(InventoryPlayer invPlayer, TileEntityMachineChemicalPlant tedf) {
super(new ContainerMachineChemicalPlant(invPlayer, tedf)); super(new ContainerMachineChemicalPlant(invPlayer, tedf));
chemplant = tedf; chemplant = tedf;
this.xSize = 176; this.xSize = 176;
this.ySize = 256; this.ySize = 256;
} }
@Override @Override
public void drawScreen(int mouseX, int mouseY, float f) { public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f); super.drawScreen(mouseX, mouseY, f);
@ -38,7 +39,7 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
chemplant.inputTanks[i].renderTankInfo(this, mouseX, mouseY, guiLeft + 8 + i * 18, guiTop + 18, 16, 34); chemplant.inputTanks[i].renderTankInfo(this, mouseX, mouseY, guiLeft + 8 + i * 18, guiTop + 18, 16, 34);
chemplant.outputTanks[i].renderTankInfo(this, mouseX, mouseY, guiLeft + 80 + i * 18, guiTop + 18, 16, 34); chemplant.outputTanks[i].renderTankInfo(this, mouseX, mouseY, guiLeft + 80 + i * 18, guiTop + 18, 16, 34);
} }
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
@ -46,32 +47,32 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule.recipe); GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule.recipe);
this.func_146283_a(recipe.print(), mouseX, mouseY); this.func_146283_a(recipe.print(), mouseX, mouseY);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + "Click to set recipe", mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
} }
} }
} }
@Override @Override
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule.recipe, 0, ItemBlueprints.grabPool(chemplant.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule.recipe, 0, ItemBlueprints.grabPool(chemplant.slots[1]), this);
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int i, int j) { protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18n.format(this.chemplant.getInventoryName()); String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18nUtil.resolveKey(this.chemplant.getInventoryName());
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18nUtil.resolveKey("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = (int) (chemplant.power * 61 / chemplant.maxPower); int p = (int) (chemplant.power * 61 / chemplant.maxPower);
drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p); drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p);
@ -79,25 +80,25 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
int j = (int) Math.ceil(70 * chemplant.chemplantModule.progress); int j = (int) Math.ceil(70 * chemplant.chemplantModule.progress);
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
} }
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe); GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe);
/// LEFT LED /// LEFT LED
if(chemplant.didProcess) { if(chemplant.didProcess) {
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6); drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6);
} else if(recipe != null) { } else if(recipe != null) {
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6); drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6);
} }
/// RIGHT LED /// RIGHT LED
if(chemplant.didProcess) { if(chemplant.didProcess) {
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6); drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6);
} else if(recipe != null && chemplant.power >= recipe.power) { } else if(recipe != null && chemplant.power >= recipe.power) {
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6); drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6);
} }
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126); this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126);
if(recipe != null && recipe.inputItem != null) { if(recipe != null && recipe.inputItem != null) {
for(int i = 0; i < recipe.inputItem.length; i++) { for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(chemplant.chemplantModule.inputSlots[i]); Slot slot = (Slot) this.inventorySlots.inventorySlots.get(chemplant.chemplantModule.inputSlots[i]);

View File

@ -8,6 +8,7 @@ import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.machine.ItemBlueprints; import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachinePUREX; import com.hbm.tileentity.machine.TileEntityMachinePUREX;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
@ -21,15 +22,15 @@ public class GUIMachinePUREX extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_purex.png"); private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_purex.png");
private TileEntityMachinePUREX purex; private TileEntityMachinePUREX purex;
public GUIMachinePUREX(InventoryPlayer invPlayer, TileEntityMachinePUREX tedf) { public GUIMachinePUREX(InventoryPlayer invPlayer, TileEntityMachinePUREX tedf) {
super(new ContainerMachinePUREX(invPlayer, tedf)); super(new ContainerMachinePUREX(invPlayer, tedf));
purex = tedf; purex = tedf;
this.xSize = 176; this.xSize = 176;
this.ySize = 256; this.ySize = 256;
} }
@Override @Override
public void drawScreen(int mouseX, int mouseY, float f) { public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f); super.drawScreen(mouseX, mouseY, f);
@ -38,7 +39,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
purex.inputTanks[i].renderTankInfo(this, mouseX, mouseY, guiLeft + 8 + i * 18, guiTop + 18, 16, 52); purex.inputTanks[i].renderTankInfo(this, mouseX, mouseY, guiLeft + 8 + i * 18, guiTop + 18, 16, 52);
} }
purex.outputTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 36, 16, 52); purex.outputTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, purex.power, purex.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, purex.power, purex.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
@ -46,32 +47,32 @@ public class GUIMachinePUREX extends GuiInfoContainer {
GenericRecipe recipe = (GenericRecipe) PUREXRecipes.INSTANCE.recipeNameMap.get(this.purex.purexModule.recipe); GenericRecipe recipe = (GenericRecipe) PUREXRecipes.INSTANCE.recipeNameMap.get(this.purex.purexModule.recipe);
this.func_146283_a(recipe.print(), mouseX, mouseY); this.func_146283_a(recipe.print(), mouseX, mouseY);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + "Click to set recipe", mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
} }
} }
} }
@Override @Override
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PUREXRecipes.INSTANCE, purex, purex.purexModule.recipe, 0, ItemBlueprints.grabPool(purex.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PUREXRecipes.INSTANCE, purex, purex.purexModule.recipe, 0, ItemBlueprints.grabPool(purex.slots[1]), this);
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int i, int j) { protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.purex.hasCustomInventoryName() ? this.purex.getInventoryName() : I18n.format(this.purex.getInventoryName()); String name = this.purex.hasCustomInventoryName() ? this.purex.getInventoryName() : I18n.format(this.purex.getInventoryName());
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = (int) (purex.power * 61 / purex.maxPower); int p = (int) (purex.power * 61 / purex.maxPower);
drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p); drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p);
@ -79,25 +80,25 @@ public class GUIMachinePUREX extends GuiInfoContainer {
int j = (int) Math.ceil(70 * purex.purexModule.progress); int j = (int) Math.ceil(70 * purex.purexModule.progress);
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
} }
GenericRecipe recipe = PUREXRecipes.INSTANCE.recipeNameMap.get(purex.purexModule.recipe); GenericRecipe recipe = PUREXRecipes.INSTANCE.recipeNameMap.get(purex.purexModule.recipe);
/// LEFT LED /// LEFT LED
if(purex.didProcess) { if(purex.didProcess) {
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6); drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6);
} else if(recipe != null) { } else if(recipe != null) {
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6); drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6);
} }
/// RIGHT LED /// RIGHT LED
if(purex.didProcess) { if(purex.didProcess) {
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6); drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6);
} else if(recipe != null && purex.power >= recipe.power) { } else if(recipe != null && purex.power >= recipe.power) {
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6); drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6);
} }
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126); this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126);
if(recipe != null && recipe.inputItem != null) { if(recipe != null && recipe.inputItem != null) {
for(int i = 0; i < recipe.inputItem.length; i++) { for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(purex.purexModule.inputSlots[i]); Slot slot = (Slot) this.inventorySlots.inventorySlots.get(purex.purexModule.inputSlots[i]);

View File

@ -35,20 +35,20 @@ public class GenericRecipe {
public boolean customLocalization = false; public boolean customLocalization = false;
protected String[] blueprintPools = null; protected String[] blueprintPools = null;
public String autoSwitchGroup = null; public String autoSwitchGroup = null;
public GenericRecipe(String name) { public GenericRecipe(String name) {
this.name = name; this.name = name;
} }
public boolean isPooled() { return blueprintPools != null; } public boolean isPooled() { return blueprintPools != null; }
public String[] getPools() { return this.blueprintPools; } public String[] getPools() { return this.blueprintPools; }
public boolean isPartOfPool(String lookingFor) { public boolean isPartOfPool(String lookingFor) {
if(!isPooled()) return false; if(!isPooled()) return false;
for(String pool : blueprintPools) if (pool.equals(lookingFor)) return true; for(String pool : blueprintPools) if (pool.equals(lookingFor)) return true;
return false; return false;
} }
public GenericRecipe setDuration(int duration) { this.duration = duration; return this; } public GenericRecipe setDuration(int duration) { this.duration = duration; return this; }
public GenericRecipe setPower(long power) { this.power = power; return this; } public GenericRecipe setPower(long power) { this.power = power; return this; }
public GenericRecipe setup(int duration, long power) { return this.setDuration(duration).setPower(power); } public GenericRecipe setup(int duration, long power) { return this.setDuration(duration).setPower(power); }
@ -68,13 +68,13 @@ public class GenericRecipe {
public GenericRecipe inputFluidsEx(FluidStack... input) { if(!GeneralConfig.enableExpensiveMode) return this; this.inputFluid = input; return this; } public GenericRecipe inputFluidsEx(FluidStack... input) { if(!GeneralConfig.enableExpensiveMode) return this; this.inputFluid = input; return this; }
public GenericRecipe outputItems(IOutput... output) { this.outputItem = output; return this; } public GenericRecipe outputItems(IOutput... output) { this.outputItem = output; return this; }
public GenericRecipe outputFluids(FluidStack... output) { this.outputFluid = output; return this; } public GenericRecipe outputFluids(FluidStack... output) { this.outputFluid = output; return this; }
public GenericRecipe outputItems(ItemStack... output) { public GenericRecipe outputItems(ItemStack... output) {
this.outputItem = new IOutput[output.length]; this.outputItem = new IOutput[output.length];
for(int i = 0; i < outputItem.length; i++) this.outputItem[i] = new ChanceOutput(output[i]); for(int i = 0; i < outputItem.length; i++) this.outputItem[i] = new ChanceOutput(output[i]);
return this; return this;
} }
public GenericRecipe setIconToFirstIngredient() { public GenericRecipe setIconToFirstIngredient() {
if(this.inputItem != null) { if(this.inputItem != null) {
List<ItemStack> stacks = this.inputItem[0].extractForNEI(); List<ItemStack> stacks = this.inputItem[0].extractForNEI();
@ -82,9 +82,9 @@ public class GenericRecipe {
} }
return this; return this;
} }
public ItemStack getIcon() { public ItemStack getIcon() {
if(icon == null) { if(icon == null) {
if(outputItem != null) { if(outputItem != null) {
if(outputItem[0] instanceof ChanceOutput) icon = ((ChanceOutput) outputItem[0]).stack.copy(); if(outputItem[0] instanceof ChanceOutput) icon = ((ChanceOutput) outputItem[0]).stack.copy();
@ -95,15 +95,15 @@ public class GenericRecipe {
icon = ItemFluidIcon.make(outputFluid[0]); icon = ItemFluidIcon.make(outputFluid[0]);
} }
} }
if(icon == null) icon = new ItemStack(ModItems.nothing); if(icon == null) icon = new ItemStack(ModItems.nothing);
return icon; return icon;
} }
public String getInternalName() { public String getInternalName() {
return this.name; return this.name;
} }
public String getLocalizedName() { public String getLocalizedName() {
String name = null; String name = null;
if(customLocalization) name = I18nUtil.resolveKey(this.name); if(customLocalization) name = I18nUtil.resolveKey(this.name);
@ -111,28 +111,57 @@ public class GenericRecipe {
if(this.nameWrapper != null) name = I18nUtil.resolveKey(this.nameWrapper, name); if(this.nameWrapper != null) name = I18nUtil.resolveKey(this.nameWrapper, name);
return name; return name;
} }
public List<String> print() { public List<String> print() {
List<String> list = new ArrayList(); List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName()); list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
// autoswitch group (two lines: label + "Enabled for")
if(this.autoSwitchGroup != null) { if(this.autoSwitchGroup != null) {
String[] lines = I18nUtil.resolveKeyArray("autoswitch", I18nUtil.resolveKey(this.autoSwitchGroup)); String groupNameLocalized = I18nUtil.resolveKey(this.autoSwitchGroup);
for(String line : lines) list.add(EnumChatFormatting.GOLD + line); list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("gui.recipe.autoswitch") + ": " + groupNameLocalized);
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("gui.recipe.enabledFor") + " " + groupNameLocalized);
} }
if(duration > 0) list.add(EnumChatFormatting.RED + "Duration: " + this.duration / 20D + "s");
if(power > 0) list.add(EnumChatFormatting.RED + "Consumption: " + BobMathUtil.getShortNumber(power) + "HE/t"); // duration (seconds)
list.add(EnumChatFormatting.BOLD + "Input:"); if(duration > 0) {
double seconds = this.duration / 20D;
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("gui.recipe.duration") + ": " + seconds + "s");
}
// power / consumption
if(power > 0) {
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("gui.recipe.consumption") + ": " + BobMathUtil.getShortNumber(power) + "HE/t");
}
// input label + items
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.recipe.input") + ":");
if(inputItem != null) for(AStack stack : inputItem) { if(inputItem != null) for(AStack stack : inputItem) {
ItemStack display = stack.extractForCyclingDisplay(20); ItemStack display = stack.extractForCyclingDisplay(20);
list.add(" " + EnumChatFormatting.GRAY + display.stackSize + "x " + display.getDisplayName()); list.add(" " + EnumChatFormatting.GRAY + display.stackSize + "x " + display.getDisplayName());
} }
if(inputFluid != null) for(FluidStack fluid : inputFluid) list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + (fluid.pressure == 0 ? "" : " at " + EnumChatFormatting.RED + fluid.pressure + " PU")); if(inputFluid != null) for(FluidStack fluid : inputFluid) {
list.add(EnumChatFormatting.BOLD + "Output:"); String mB = I18nUtil.resolveKey("gui.recipe.mB");
if(outputItem != null) for(IOutput output : outputItem) for(String line : output.getLabel()) list.add(" " + line); String pressurePart = fluid.pressure == 0 ? "" :
if(outputFluid != null) for(FluidStack fluid : outputFluid) list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + (fluid.pressure == 0 ? "" : " at " + EnumChatFormatting.RED + fluid.pressure + " PU")); " " + I18nUtil.resolveKey("gui.recipe.atPressure") + " " + EnumChatFormatting.RED + fluid.pressure + " PU";
list.add(" " + EnumChatFormatting.BLUE + fluid.fill + mB + " " + fluid.type.getLocalizedName() + pressurePart);
}
// output label + items
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.recipe.output") + ":");
if(outputItem != null) for(IOutput output : outputItem)
for(String line : output.getLabel()) list.add(" " + line);
if(outputFluid != null) for(FluidStack fluid : outputFluid) {
String mB = I18nUtil.resolveKey("gui.recipe.mB");
String pressurePart = fluid.pressure == 0 ? "" :
" " + I18nUtil.resolveKey("gui.recipe.atPressure") + " " + EnumChatFormatting.RED + fluid.pressure + " PU";
list.add(" " + EnumChatFormatting.BLUE + fluid.fill + mB + " " + fluid.type.getLocalizedName() + pressurePart);
}
return list; return list;
} }
/** Default impl only matches localized name substring, can be extended to include ingredients as well */ /** Default impl only matches localized name substring, can be extended to include ingredients as well */
public boolean matchesSearch(String substring) { public boolean matchesSearch(String substring) {
return getLocalizedName().toLowerCase(Locale.US).contains(substring.toLowerCase(Locale.US)); return getLocalizedName().toLowerCase(Locale.US).contains(substring.toLowerCase(Locale.US));

View File

@ -6270,4 +6270,15 @@ desc.gui.upgrade.overdrive= * §7Overdrive§r: Stacks to level 3
desc.gui.upgrade.power= * §1Power-Saving§r: Stacks to level 3 desc.gui.upgrade.power= * §1Power-Saving§r: Stacks to level 3
desc.gui.upgrade.speed= * §4Speed§r: Stacks to level 3 desc.gui.upgrade.speed= * §4Speed§r: Stacks to level 3
# Shared recipe labels
gui.recipe.duration=Duration
gui.recipe.consumption=Consumption
gui.recipe.input=Input
gui.recipe.output=Output
gui.recipe.mB=mB
gui.recipe.atPressure=at
gui.recipe.autoswitch=Auto-switch group
gui.recipe.enabledFor=Enabled for
gui.recipe.setRecipe=Click to set recipe
tile.oc_cable_paintable.name=Paintable Network Cable tile.oc_cable_paintable.name=Paintable Network Cable

View File

@ -6614,11 +6614,15 @@ desc.util.warhead=Боеголовка
desc.util.chip_inaccuracy=Неточность чипа desc.util.chip_inaccuracy=Неточность чипа
desc.util.fin_inaccuracy=Неточность стабилизатора desc.util.fin_inaccuracy=Неточность стабилизатора
gui.chemical.duration=Длительность: %s # Shared recipe labels
gui.chemical.consumption=Потребление: %s gui.recipe.duration=Длительность
gui.chemical.input=Вход: gui.recipe.consumption=Потребление
gui.chemical.output=Выход: gui.recipe.input=Вход
gui.chemical.click_to_set_recipe=Нажмите, чтобы выбрать рецепт gui.recipe.output=Выход
gui.recipe.mB=mB
gui.recipe.atPressure=при давлении в
gui.recipe.autoswitch=Группа автоматического переключения
gui.recipe.enabledFor=Включено для
gui.recipe.setRecipe=Нажмите, чтобы выбрать рецепт
// Last updated 23.08.2025 by Bufka2011, MrKimkimora and TactiCOOLHimZa // // Last updated 23.08.2025 by Bufka2011, MrKimkimora and TactiCOOLHimZa //