Skip to content

Commit

Permalink
remake GTRecipeWidget add oc button (#1063)
Browse files Browse the repository at this point in the history
* remake GTRecipeWidget add oc button

* update lang

* delete hardcode

* update zh_cn

* change name
  • Loading branch information
Arborsm authored and mikerooni committed Apr 8, 2024
1 parent 561e14d commit e833c40
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 94 deletions.
6 changes: 5 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,10 @@
"gtceu.multiblock.validation_failed": "˙sʇndʇno/sʇnduı ɟo ʇunoɯɐ pıןɐʌuI",
"gtceu.multiblock.waiting": "˙buıʇıɐʍ sı ǝuıɥɔɐW :⅁NINᴚⱯM",
"gtceu.multiblock.work_paused": "˙pǝsnɐԀ ʞɹoM",
"gtceu.oc.tooltip.0": "%s :uıW",
"gtceu.oc.tooltip.1": "ƆO ǝɥʇ ǝsıɐɹ oʇ ʞɔıןɔ ʇɟǝꞀ",
"gtceu.oc.tooltip.2": "ƆO ǝɥʇ ɹǝʍoן oʇ ʞɔıןɔ ʇɥbıᴚ",
"gtceu.oc.tooltip.3": "ƆO ǝɥʇ ʇǝsǝɹ oʇ ʞɔıןɔ ǝןppıW",
"gtceu.ore_washer": "ɹǝɥsɐM ǝɹO",
"gtceu.packer": "ɹǝʞɔɐԀ",
"gtceu.parallel_hatch_mk5": "˙ןǝןןɐɹɐd uı sǝdıɔǝɹ ㄣ oʇ dn unɹ oʇ sʍoןןⱯ",
Expand All @@ -3158,7 +3162,7 @@
"gtceu.recipe.cleanroom_sterile.display_name": "ɯooɹuɐǝןƆ ǝןıɹǝʇS",
"gtceu.recipe.dimensions": "%s :suoısuǝɯıᗡ",
"gtceu.recipe.duration": "sɔǝs ɟᄅ˙'% :uoıʇɐɹnᗡ",
"gtceu.recipe.eu": ")ɹ§%s( ʇ/∩Ǝ p'% :ǝbɐs∩",
"gtceu.recipe.eu": "ʇ/∩Ǝ p'% :ǝbɐs∩",
"gtceu.recipe.eu_inverted": "ʇ/∩Ǝ p'% :uoıʇɐɹǝuǝ⅁",
"gtceu.recipe.eu_to_start": "∩Ǝ%s :ʇɹɐʇS o⟘ ʎbɹǝuƎ",
"gtceu.recipe.explosive": "%s :ǝʌısoןdxƎ",
Expand Down
7 changes: 6 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,11 @@
"gtceu.multiblock.validation_failed": "Invalid amount of inputs/outputs.",
"gtceu.multiblock.waiting": "WARNING: Machine is waiting.",
"gtceu.multiblock.work_paused": "Work Paused.",
"gtceu.oc.tooltip.0": "Min: %s",
"gtceu.oc.tooltip.1": "Left click to increase the OC",
"gtceu.oc.tooltip.2": "Right click to decrease the OC",
"gtceu.oc.tooltip.3": "Middle click to reset the OC",
"gtceu.oc.tooltip.4": "Hold Shift to change by Perfect OC",
"gtceu.ore_washer": "Ore Washer",
"gtceu.packer": "Packer",
"gtceu.parallel_hatch_mk5": "Allows to run up to 4 recipes in parallel.",
Expand All @@ -3158,7 +3163,7 @@
"gtceu.recipe.cleanroom_sterile.display_name": "Sterile Cleanroom",
"gtceu.recipe.dimensions": "Dimensions: %s",
"gtceu.recipe.duration": "Duration: %,.2f secs",
"gtceu.recipe.eu": "Usage: %,d EU/t (%s§r)",
"gtceu.recipe.eu": "Usage: %,d EU/t",
"gtceu.recipe.eu_inverted": "Generation: %,d EU/t",
"gtceu.recipe.eu_to_start": "Energy To Start: %sEU",
"gtceu.recipe.explosive": "Explosive: %s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;

/**
* @author KilaBash
Expand Down Expand Up @@ -82,6 +81,12 @@ public class GTRecipeType implements RecipeType<GTRecipe> {
private CompoundTag customUICache;
@Getter
private final GTRecipeLookup lookup = new GTRecipeLookup(this);
@Setter
@Getter
private boolean offsetVoltageText = false;
@Setter
@Getter
private int voltageTextOffset = 20;

public GTRecipeType(ResourceLocation registryName, String group, RecipeType<?>... proxyRecipes) {
this.registryName = registryName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public class GTRecipeTypeUI {

private CompoundTag customUICache;
private Size jeiSize;
@Getter
private int originalWidth;

/**
* @param recipeType the recipemap corresponding to this ui
Expand Down Expand Up @@ -128,7 +130,8 @@ public Size getJEISize() {
Size size = this.jeiSize;
if(size == null) {
var originalSize = createEditableUITemplate(false, false).createDefault().getSize();
this.jeiSize = size = new Size(originalSize.width, getPropertyHeightShift() + 5 + originalSize.height);
this.originalWidth = originalSize.width;
this.jeiSize = size = new Size(Math.max(originalWidth, 150), getPropertyHeightShift() + 5 + originalSize.height);
}
return size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ public class GTRecipeTypes {
.setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY)
.setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, LEFT_TO_RIGHT)
.setMaxTooltips(4)
.setOffsetVoltageText(true)
.setSound(GTSoundEntries.COOLING);

public final static GTRecipeType ROCK_BREAKER_RECIPES = register("rock_breaker", ELECTRIC).setMaxIOSize(1, 4, 0, 0).setEUIO(IO.IN)
Expand Down Expand Up @@ -561,6 +562,7 @@ public class GTRecipeTypes {
public static final GTRecipeType FUSION_RECIPES = register("fusion_reactor", MULTIBLOCK).setMaxIOSize(0, 0, 2, 1).setEUIO(IO.IN)
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, LEFT_TO_RIGHT)
.setSound(GTSoundEntries.ARC)
.setOffsetVoltageText(true)
.addDataInfo(data -> LocalizationUtils.format("gtceu.recipe.eu_to_start", data.getLong("eu_to_start")));

public static final GTRecipeType DUMMY_RECIPES = new GTRecipeType(GTCEu.id("dummy"), DUMMY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public static void init(RegistrateLangProvider provider) {
provider.add("recipe.capability.fluid.name", "Fluid");
provider.add("recipe.capability.item.name", "Item");
provider.add("recipe.capability.su.name", "Create Stress");
multiLang(provider, "gtceu.oc.tooltip", "Min: %s", "Left click to increase the OC",
"Right click to decrease the OC", "Middle click to reset the OC", "Hold Shift to change by Perfect OC");

provider.add("recipe.condition.rpm.tooltip", "RPM: %d");
provider.add("recipe.condition.thunder.tooltip", "Thunder Level: %d");
Expand Down Expand Up @@ -940,7 +942,7 @@ public static void init(RegistrateLangProvider provider) {
provider.add("gtceu.universal.tooltip.requires_redstone", "§4Requires Redstone power");
provider.add("gtceu.universal.tooltip.deprecated", "§5WARNING: DEPRECATED. WILL BE REMOVED IN A FUTURE VERSION.§r");
provider.add("gtceu.recipe.total", "Total: %,d EU");
provider.add("gtceu.recipe.eu", "Usage: %,d EU/t (%s§r)");
provider.add("gtceu.recipe.eu", "Usage: %,d EU/t");
provider.add("gtceu.recipe.eu_inverted", "Generation: %,d EU/t");
provider.add("gtceu.recipe.duration", "Duration: %,.2f secs");
provider.add("gtceu.recipe.amperage", "Amperage: %,d");
Expand Down
Loading

0 comments on commit e833c40

Please sign in to comment.