Skip to content

Commit

Permalink
Sc/cherrypick 28.10.23 (#497)
Browse files Browse the repository at this point in the history
* fix: ore lang. (#493)

* fix: make manual compression recipes use shaped recipes, as per standard. (#494)
  • Loading branch information
screret authored Oct 28, 2023
1 parent 37ac5dc commit 5ac388e
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 43 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* fix fluid slot overflow
* fix assembly line recipe handling
* update zh_cn lang
* fix stone ores having broken translations
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.*;

import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.Conditions.*;
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.LoaderType.FABRIC;
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.LoaderType.FORGE;
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.LoaderType.*;

@Accessors(chain = true, fluent = true)
public class TagPrefix {
Expand All @@ -75,7 +71,7 @@ public static TagPrefix get(String name) {
return PREFIXES.get(name);
}

public static final TagPrefix ore = oreTagPrefix("ore")
public static final TagPrefix ore = oreTagPrefix("stone")
.langValue("%s Ore")
.materialIconType(MaterialIconType.ore)
.miningToolTag(BlockTags.MINEABLE_WITH_PICKAXE)
Expand Down Expand Up @@ -691,7 +687,7 @@ public static TagPrefix get(String name) {
.unificationEnabled(true);

// Prefix to determine which kind of Rock this is.
public static final TagPrefix stone = new TagPrefix("stone")
public static final TagPrefix rock = new TagPrefix("rock")
.defaultTagPath(FORGE, "%s")
.defaultTagPath(FABRIC, "%s")
.langValue("%s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ public class GTMachines {
.rotationState(RotationState.ALL)
.tier(LV)
.renderer(() -> new TieredHullMachineRenderer(LV, GTCEu.id("block/machine/ld_item_endpoint_machine")))
.tooltips(Component.translatable("gtceu.machine.endpoint.tooltip.1"),
Component.translatable("gtceu.machine.endpoint.tooltip.2"),
Component.translatable("gtceu.machine.endpoint.tooltip.3"))
.tooltips(LangHandler.getMultiLang("gtceu.machine.endpoint.tooltip").toArray(Component[]::new))
.tooltipBuilder((stack, tooltip) -> {
if (ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance > 0) {
tooltip.add(Component.translatable("gtceu.machine.endpoint.tooltip.min_length", ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,18 @@ public static void init() {
block.setIgnored(Blaze);
block.setIgnored(Lapotron);

stone.setIgnored(Marble);
stone.setIgnored(Granite, Blocks.GRANITE);
stone.setIgnored(Granite, Blocks.POLISHED_GRANITE);
stone.setIgnored(GraniteRed);
stone.setIgnored(Andesite, Blocks.ANDESITE);
stone.setIgnored(Andesite, Blocks.POLISHED_ANDESITE);
stone.setIgnored(Diorite, Blocks.DIORITE);
stone.setIgnored(Diorite, Blocks.POLISHED_DIORITE);
stone.setIgnored(Stone, Blocks.STONE);
stone.setIgnored(Netherrack, Blocks.NETHERRACK);
stone.setIgnored(Obsidian, Blocks.OBSIDIAN);
stone.setIgnored(Endstone, Blocks.END_STONE);
rock.setIgnored(Marble);
rock.setIgnored(Granite, Blocks.GRANITE);
rock.setIgnored(Granite, Blocks.POLISHED_GRANITE);
rock.setIgnored(GraniteRed);
rock.setIgnored(Andesite, Blocks.ANDESITE);
rock.setIgnored(Andesite, Blocks.POLISHED_ANDESITE);
rock.setIgnored(Diorite, Blocks.DIORITE);
rock.setIgnored(Diorite, Blocks.POLISHED_DIORITE);
rock.setIgnored(Stone, Blocks.STONE);
rock.setIgnored(Netherrack, Blocks.NETHERRACK);
rock.setIgnored(Obsidian, Blocks.OBSIDIAN);
rock.setIgnored(Endstone, Blocks.END_STONE);

crushed.addSecondaryMaterial(new MaterialStack(Stone, dust.materialAmount()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ public static void addShapedRecipe(Consumer<FinishedRecipe> provider, boolean wi
}
}
}
if (o instanceof String[] pattern) {
for (String s : pattern) {
builder.pattern(s);
for (Character c : TOOLS.keySet()) {
if (s.indexOf(c) >= 0) {
set.add(c.charValue());
}
}
}
}
if (o instanceof Character sign) {
var content = recipe[i + 1];
i++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.gregtechceu.gtceu.utils.GTUtil;
import com.lowdragmc.lowdraglib.side.fluid.FluidStack;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;

import java.util.ArrayList;
Expand Down Expand Up @@ -491,20 +492,21 @@ public static void processBlock(TagPrefix blockPrefix, Material material, DustPr
blockEntry = new UnificationEntry(dust, material);
}

ArrayList<Object> result = new ArrayList<>();
for (int index = 0; index < materialAmount / M; index++) {
result.add(blockEntry);
}

//do not allow handcrafting or uncrafting, extruding or alloy smelting of blacklisted blocks
if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_RECIPES)) {

//do not allow non-perfect square root material amounts
int size = (int) (materialAmount / M);
int sizeSqrt = Math.round(Mth.sqrt(size));
//do not allow handcrafting or uncrafting of blacklisted blocks
if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && !ConfigHolder.INSTANCE.recipes.disableManualCompression) {
VanillaRecipeHelper.addShapelessRecipe(provider, String.format("block_compress_%s", material), blockStack, result.toArray());
if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && !ConfigHolder.INSTANCE.recipes.disableManualCompression && sizeSqrt*sizeSqrt == size) {
String patternString = "B".repeat(Math.max(0, sizeSqrt));
String[] pattern = new String[sizeSqrt];
Arrays.fill(pattern, patternString);
VanillaRecipeHelper.addShapedRecipe(provider, String.format("block_compress_%s", material), blockStack, pattern, 'B', blockEntry);

VanillaRecipeHelper.addShapelessRecipe(provider, String.format("block_decompress_%s", material),
GTUtil.copyAmount((int) (materialAmount / M), ChemicalHelper.get(blockEntry.tagPrefix, blockEntry.material)),
GTUtil.copyAmount(size, ChemicalHelper.get(blockEntry.tagPrefix, blockEntry.material)),
new UnificationEntry(blockPrefix, material));
}

Expand Down
7 changes: 4 additions & 3 deletions fabric/src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1945,9 +1945,9 @@
"gtceu.machine.electromagnetic_separator.mv.tooltip": "ʇsǝɹ ǝɥʇ ɯoɹɟ sǝɹO ɔıʇǝubɐɯ ǝɥʇ buıʇɐɹɐdǝSㄥ§",
"gtceu.machine.electromagnetic_separator.uv.tooltip": "ɹǝןןǝdsıᗡ ℲWƎㄥ§",
"gtceu.machine.electromagnetic_separator.zpm.tooltip": "ɹǝzıɹobǝʇɐƆ WƎㄥ§",
"gtceu.machine.endpoint.tooltip.1": "˙ǝuıןǝdıd ɐ ǝʇɐǝɹɔ oʇ sʞɔoןq ㄥ§ǝdıԀ ǝɔuɐʇsıᗡ buoꞀɟ§ ɥʇıʍ ʇɔǝuuoƆ",
"gtceu.machine.endpoint.tooltip.2": "˙ʇuıodpuǝ ㄥ§ʇndʇnO Ɩɟ§ puɐ ㄥ§ʇnduI Ɩɟ§ ʎןʇɔɐxǝ ǝʌɐɥ ʇsnɯ sǝuıןǝdıԀ",
"gtceu.machine.endpoint.tooltip.3": "˙ㄥ§pǝpɐoן-ʞunɥɔɟ§ ǝq oʇ pǝǝu sʇuıodpuǝ ǝuıןǝdıd ʎןuO",
"gtceu.machine.endpoint.tooltip.0": "˙ǝuıןǝdıd ɐ ǝʇɐǝɹɔ oʇ sʞɔoןq ㄥ§ǝdıԀ ǝɔuɐʇsıᗡ buoꞀɟ§ ɥʇıʍ ʇɔǝuuoƆ",
"gtceu.machine.endpoint.tooltip.1": "˙ʇuıodpuǝ ㄥ§ʇndʇnO Ɩɟ§ puɐ ㄥ§ʇnduI Ɩɟ§ ʎןʇɔɐxǝ ǝʌɐɥ ʇsnɯ sǝuıןǝdıԀ",
"gtceu.machine.endpoint.tooltip.2": "˙ㄥ§pǝpɐoן-ʞunɥɔɟ§ ǝq oʇ pǝǝu sʇuıodpuǝ ǝuıןǝdıd ʎןuO",
"gtceu.machine.endpoint.tooltip.min_length": "sʞɔoןᗺ %dɟ§ :ǝɔuɐʇsıᗡ ʇuıodpuƎ ɯnɯıuıWq§",
"gtceu.machine.energy_converter.description": "ƎℲ puɐ ∩Ǝ uǝǝʍʇǝq ʎbɹǝuƎ sʇɹǝʌuoƆ",
"gtceu.machine.energy_converter.message_conversion_eu": "ǝʌıʇɐN %d :ʇnO '∩Ǝ %d Ɐ%d :uI '∩Ǝ buıʇɹǝʌuoƆ",
Expand Down Expand Up @@ -4287,6 +4287,7 @@
"tagprefix.red_sand": "ǝɹO %s puɐS pǝᴚ",
"tagprefix.refined_ore": "ǝɹO %s pǝuıɟǝᴚ",
"tagprefix.ring": "buıᴚ %s",
"tagprefix.rock": "%s",
"tagprefix.rod": "poᴚ %s",
"tagprefix.rotor": "ɹoʇoᴚ %s",
"tagprefix.round": "punoᴚ %s",
Expand Down
7 changes: 4 additions & 3 deletions fabric/src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1945,9 +1945,9 @@
"gtceu.machine.electromagnetic_separator.mv.tooltip": "§7Separating the magnetic Ores from the rest",
"gtceu.machine.electromagnetic_separator.uv.tooltip": "§7EMF Dispeller",
"gtceu.machine.electromagnetic_separator.zpm.tooltip": "§7EM Categorizer",
"gtceu.machine.endpoint.tooltip.1": "Connect with §fLong Distance Pipe§7 blocks to create a pipeline.",
"gtceu.machine.endpoint.tooltip.2": "Pipelines must have exactly §f1 Input§7 and §f1 Output§7 endpoint.",
"gtceu.machine.endpoint.tooltip.3": "Only pipeline endpoints need to be §fchunk-loaded§7.",
"gtceu.machine.endpoint.tooltip.0": "Connect with §fLong Distance Pipe§7 blocks to create a pipeline.",
"gtceu.machine.endpoint.tooltip.1": "Pipelines must have exactly §f1 Input§7 and §f1 Output§7 endpoint.",
"gtceu.machine.endpoint.tooltip.2": "Only pipeline endpoints need to be §fchunk-loaded§7.",
"gtceu.machine.endpoint.tooltip.min_length": "§bMinimum Endpoint Distance: §f%d Blocks",
"gtceu.machine.energy_converter.description": "Converts Energy between EU and FE",
"gtceu.machine.energy_converter.message_conversion_eu": "Converting EU, In: %dA %d EU, Out: %d Native",
Expand Down Expand Up @@ -4287,6 +4287,7 @@
"tagprefix.red_sand": "Red Sand %s Ore",
"tagprefix.refined_ore": "Refined %s Ore",
"tagprefix.ring": "%s Ring",
"tagprefix.rock": "%s",
"tagprefix.rod": "%s Rod",
"tagprefix.rotor": "%s Rotor",
"tagprefix.round": "%s Round",
Expand Down
7 changes: 4 additions & 3 deletions forge/src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1945,9 +1945,9 @@
"gtceu.machine.electromagnetic_separator.mv.tooltip": "ʇsǝɹ ǝɥʇ ɯoɹɟ sǝɹO ɔıʇǝubɐɯ ǝɥʇ buıʇɐɹɐdǝSㄥ§",
"gtceu.machine.electromagnetic_separator.uv.tooltip": "ɹǝןןǝdsıᗡ ℲWƎㄥ§",
"gtceu.machine.electromagnetic_separator.zpm.tooltip": "ɹǝzıɹobǝʇɐƆ WƎㄥ§",
"gtceu.machine.endpoint.tooltip.1": "˙ǝuıןǝdıd ɐ ǝʇɐǝɹɔ oʇ sʞɔoןq ㄥ§ǝdıԀ ǝɔuɐʇsıᗡ buoꞀɟ§ ɥʇıʍ ʇɔǝuuoƆ",
"gtceu.machine.endpoint.tooltip.2": "˙ʇuıodpuǝ ㄥ§ʇndʇnO Ɩɟ§ puɐ ㄥ§ʇnduI Ɩɟ§ ʎןʇɔɐxǝ ǝʌɐɥ ʇsnɯ sǝuıןǝdıԀ",
"gtceu.machine.endpoint.tooltip.3": "˙ㄥ§pǝpɐoן-ʞunɥɔɟ§ ǝq oʇ pǝǝu sʇuıodpuǝ ǝuıןǝdıd ʎןuO",
"gtceu.machine.endpoint.tooltip.0": "˙ǝuıןǝdıd ɐ ǝʇɐǝɹɔ oʇ sʞɔoןq ㄥ§ǝdıԀ ǝɔuɐʇsıᗡ buoꞀɟ§ ɥʇıʍ ʇɔǝuuoƆ",
"gtceu.machine.endpoint.tooltip.1": "˙ʇuıodpuǝ ㄥ§ʇndʇnO Ɩɟ§ puɐ ㄥ§ʇnduI Ɩɟ§ ʎןʇɔɐxǝ ǝʌɐɥ ʇsnɯ sǝuıןǝdıԀ",
"gtceu.machine.endpoint.tooltip.2": "˙ㄥ§pǝpɐoן-ʞunɥɔɟ§ ǝq oʇ pǝǝu sʇuıodpuǝ ǝuıןǝdıd ʎןuO",
"gtceu.machine.endpoint.tooltip.min_length": "sʞɔoןᗺ %dɟ§ :ǝɔuɐʇsıᗡ ʇuıodpuƎ ɯnɯıuıWq§",
"gtceu.machine.energy_converter.description": "ƎℲ puɐ ∩Ǝ uǝǝʍʇǝq ʎbɹǝuƎ sʇɹǝʌuoƆ",
"gtceu.machine.energy_converter.message_conversion_eu": "ǝʌıʇɐN %d :ʇnO '∩Ǝ %d Ɐ%d :uI '∩Ǝ buıʇɹǝʌuoƆ",
Expand Down Expand Up @@ -4287,6 +4287,7 @@
"tagprefix.red_sand": "ǝɹO %s puɐS pǝᴚ",
"tagprefix.refined_ore": "ǝɹO %s pǝuıɟǝᴚ",
"tagprefix.ring": "buıᴚ %s",
"tagprefix.rock": "%s",
"tagprefix.rod": "poᴚ %s",
"tagprefix.rotor": "ɹoʇoᴚ %s",
"tagprefix.round": "punoᴚ %s",
Expand Down
7 changes: 4 additions & 3 deletions forge/src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1945,9 +1945,9 @@
"gtceu.machine.electromagnetic_separator.mv.tooltip": "§7Separating the magnetic Ores from the rest",
"gtceu.machine.electromagnetic_separator.uv.tooltip": "§7EMF Dispeller",
"gtceu.machine.electromagnetic_separator.zpm.tooltip": "§7EM Categorizer",
"gtceu.machine.endpoint.tooltip.1": "Connect with §fLong Distance Pipe§7 blocks to create a pipeline.",
"gtceu.machine.endpoint.tooltip.2": "Pipelines must have exactly §f1 Input§7 and §f1 Output§7 endpoint.",
"gtceu.machine.endpoint.tooltip.3": "Only pipeline endpoints need to be §fchunk-loaded§7.",
"gtceu.machine.endpoint.tooltip.0": "Connect with §fLong Distance Pipe§7 blocks to create a pipeline.",
"gtceu.machine.endpoint.tooltip.1": "Pipelines must have exactly §f1 Input§7 and §f1 Output§7 endpoint.",
"gtceu.machine.endpoint.tooltip.2": "Only pipeline endpoints need to be §fchunk-loaded§7.",
"gtceu.machine.endpoint.tooltip.min_length": "§bMinimum Endpoint Distance: §f%d Blocks",
"gtceu.machine.energy_converter.description": "Converts Energy between EU and FE",
"gtceu.machine.energy_converter.message_conversion_eu": "Converting EU, In: %dA %d EU, Out: %d Native",
Expand Down Expand Up @@ -4287,6 +4287,7 @@
"tagprefix.red_sand": "Red Sand %s Ore",
"tagprefix.refined_ore": "Refined %s Ore",
"tagprefix.ring": "%s Ring",
"tagprefix.rock": "%s",
"tagprefix.rod": "%s Rod",
"tagprefix.rotor": "%s Rotor",
"tagprefix.round": "%s Round",
Expand Down

0 comments on commit 5ac388e

Please sign in to comment.