From 954803f951d6661748d3e2672f26d222dac6f749 Mon Sep 17 00:00:00 2001 From: Lue Date: Tue, 24 Dec 2024 11:25:36 -0500 Subject: [PATCH 01/24] Fix typo in temperature parameter of BlastProperty builder (#2636) --- .../data/chemical/material/properties/BlastProperty.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java index ef73ae5057..6b7a12a92e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java @@ -136,13 +136,13 @@ public static class Builder { public Builder() {} - public Builder temp(int tempurature) { - this.temp = tempurature; + public Builder temp(int temperature) { + this.temp = temperature; return this; } - public Builder temp(int tempurature, GasTier gasTier) { - this.temp = tempurature; + public Builder temp(int temperature, GasTier gasTier) { + this.temp = temperature; this.gasTier = gasTier; return this; } From ca303c5c98b88416f1e34167a4ea2660ea787bc2 Mon Sep 17 00:00:00 2001 From: Ghostipedia <46772882+Ghostipedia@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:59:09 -0500 Subject: [PATCH 02/24] Add High Pressure Variation of The Steam Miner Singleblock. (#2637) Co-authored-by: screret <68943070+screret@users.noreply.github.com> --- .../resources/assets/gtceu/lang/en_ud.json | 4 +-- .../resources/assets/gtceu/lang/en_us.json | 4 +-- .../gtceu/common/data/GTMachines.java | 34 ++++++++++-------- .../machine/steam/SteamMinerMachine.java | 6 ++-- .../recipe/misc/MetaTileEntityLoader.java | 19 ++++++---- .../gtceu/forge/ForgeCommonEventListener.java | 11 ++++++ .../overlay_back.png | Bin 0 -> 298 bytes .../overlay_down.mcmeta | 5 +++ .../overlay_down.png | Bin 0 -> 223 bytes .../overlay_front.png | Bin 0 -> 1911 bytes .../overlay_front.png.mcmeta | 5 +++ .../overlay_side.png | Bin 0 -> 301 bytes .../high_pressure_steam_miner/overlay_up.png | Bin 0 -> 237 bytes 13 files changed, 60 insertions(+), 28 deletions(-) create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_back.png create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.mcmeta create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.png create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png.mcmeta create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_side.png create mode 100644 src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_up.png diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 18580338c0..7c52c25c14 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -322,6 +322,7 @@ "block.gtceu.hp_steam_furnace": "ǝɔɐuɹnℲ ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", "block.gtceu.hp_steam_liquid_boiler": "ɹǝןıoᗺ pınbıꞀ ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", "block.gtceu.hp_steam_macerator": "ɹoʇɐɹǝɔɐW ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", + "block.gtceu.hp_steam_miner": "ɹǝuıW ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", "block.gtceu.hp_steam_rock_crusher": "ɹǝɥsnɹƆ ʞɔoᴚ ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", "block.gtceu.hp_steam_solar_boiler": "ɹǝןıoᗺ ɹɐןoS ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", "block.gtceu.hp_steam_solid_boiler": "ɹǝןıoᗺ pıןoS ɯɐǝʇS ǝɹnssǝɹԀ ɥbıH", @@ -574,6 +575,7 @@ "block.gtceu.lp_steam_furnace": "ǝɔɐuɹnℲ ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", "block.gtceu.lp_steam_liquid_boiler": "ɹǝןıoᗺ pınbıꞀ ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", "block.gtceu.lp_steam_macerator": "ɹoʇɐɹǝɔɐW ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", + "block.gtceu.lp_steam_miner": "ɹǝuıW ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", "block.gtceu.lp_steam_rock_crusher": "ɹǝɥsnɹƆ ʞɔoᴚ ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", "block.gtceu.lp_steam_solar_boiler": "ɹǝןıoᗺ ɹɐןoS ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", "block.gtceu.lp_steam_solid_boiler": "ɹǝןıoᗺ pıןoS ɯɐǝʇS ǝɹnssǝɹԀ ʍoꞀ", @@ -1088,7 +1090,6 @@ "block.gtceu.steam_large_turbine": "ǝuıqɹn⟘ ɯɐǝʇS ǝbɹɐꞀ", "block.gtceu.steam_liquid_boiler.bronze": "ɹǝןıoᗺ pınbıꞀ ɯɐǝʇS ןןɐɯS", "block.gtceu.steam_machine_casing": "buısɐƆ ǝuıɥɔɐW ɯɐǝʇS", - "block.gtceu.steam_miner": "ɹǝuıW ɯɐǝʇS", "block.gtceu.steam_output_bus": ")ɯɐǝʇS( snᗺ ʇndʇnO", "block.gtceu.steam_oven": "uǝʌO ɯɐǝʇS", "block.gtceu.steam_solid_boiler.bronze": "ɹǝןıoᗺ pıןoS ɯɐǝʇS ןןɐɯS", @@ -1742,7 +1743,6 @@ "config.gtceu.option.enableCleanroom": "ɯooɹuɐǝןƆǝןqɐuǝ", "config.gtceu.option.enableFEConverters": "sɹǝʇɹǝʌuoƆƎℲǝןqɐuǝ", "config.gtceu.option.enableMaintenance": "ǝɔuɐuǝʇuıɐWǝןqɐuǝ", - "config.gtceu.option.enableMoreDualHatchAbility": "ʎʇıןıqⱯɥɔʇɐHןɐnᗡǝɹoWǝןqɐuǝ", "config.gtceu.option.enableResearch": "ɥɔɹɐǝsǝᴚǝןqɐuǝ", "config.gtceu.option.enableTieredCasings": "sbuısɐƆpǝɹǝı⟘ǝןqɐuǝ", "config.gtceu.option.enableWorldAccelerators": "sɹoʇɐɹǝןǝɔɔⱯpןɹoMǝןqɐuǝ", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index b3fdb619c0..6c8d4c0ec4 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -322,6 +322,7 @@ "block.gtceu.hp_steam_furnace": "High Pressure Steam Furnace", "block.gtceu.hp_steam_liquid_boiler": "High Pressure Steam Liquid Boiler", "block.gtceu.hp_steam_macerator": "High Pressure Steam Macerator", + "block.gtceu.hp_steam_miner": "High Pressure Steam Miner", "block.gtceu.hp_steam_rock_crusher": "High Pressure Steam Rock Crusher", "block.gtceu.hp_steam_solar_boiler": "High Pressure Steam Solar Boiler", "block.gtceu.hp_steam_solid_boiler": "High Pressure Steam Solid Boiler", @@ -574,6 +575,7 @@ "block.gtceu.lp_steam_furnace": "Low Pressure Steam Furnace", "block.gtceu.lp_steam_liquid_boiler": "Low Pressure Steam Liquid Boiler", "block.gtceu.lp_steam_macerator": "Low Pressure Steam Macerator", + "block.gtceu.lp_steam_miner": "Low Pressure Steam Miner", "block.gtceu.lp_steam_rock_crusher": "Low Pressure Steam Rock Crusher", "block.gtceu.lp_steam_solar_boiler": "Low Pressure Steam Solar Boiler", "block.gtceu.lp_steam_solid_boiler": "Low Pressure Steam Solid Boiler", @@ -1088,7 +1090,6 @@ "block.gtceu.steam_large_turbine": "Large Steam Turbine", "block.gtceu.steam_liquid_boiler.bronze": "Small Steam Liquid Boiler", "block.gtceu.steam_machine_casing": "Steam Machine Casing", - "block.gtceu.steam_miner": "Steam Miner", "block.gtceu.steam_output_bus": "Output Bus (Steam)", "block.gtceu.steam_oven": "Steam Oven", "block.gtceu.steam_solid_boiler.bronze": "Small Steam Solid Boiler", @@ -1742,7 +1743,6 @@ "config.gtceu.option.enableCleanroom": "enableCleanroom", "config.gtceu.option.enableFEConverters": "enableFEConverters", "config.gtceu.option.enableMaintenance": "enableMaintenance", - "config.gtceu.option.enableMoreDualHatchAbility": "enableMoreDualHatchAbility", "config.gtceu.option.enableResearch": "enableResearch", "config.gtceu.option.enableTieredCasings": "enableTieredCasings", "config.gtceu.option.enableWorldAccelerators": "enableWorldAccelerators", diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java index 2970d1a2fa..bf33252a42 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java @@ -131,21 +131,25 @@ public class GTMachines { "alloy_smelter", GTRecipeTypes.ALLOY_SMELTER_RECIPES); public static final Pair STEAM_ROCK_CRUSHER = registerSimpleSteamMachines( "rock_crusher", GTRecipeTypes.ROCK_BREAKER_RECIPES); - public static final MachineDefinition STEAM_MINER = REGISTRATE - .machine("steam_miner", holder -> new SteamMinerMachine(holder, 320, 4, 0)) - .rotationState(RotationState.NON_Y_AXIS) - .langValue("Steam Miner") - .recipeType(DUMMY_RECIPES) - .tier(0) - .tooltips(Component.translatable("gtceu.universal.tooltip.uses_per_tick_steam", 16) - .append(ChatFormatting.GRAY + ", ") - .append(Component.translatable("gtceu.machine.miner.per_block", 320 / 20))) - .tooltipBuilder((item, tooltip) -> { - int maxArea = IMiner.getWorkingArea(4); - tooltip.add(Component.translatable("gtceu.universal.tooltip.working_area", maxArea, maxArea)); - }) - .renderer(() -> new SteamMinerRenderer(false, GTCEu.id("block/machines/steam_miner"))) - .register(); + public static final Pair STEAM_MINER = registerSteamMachines( + "steam_miner", + (holder, isHP) -> isHP ? new SteamMinerMachine(holder, 240, 6, 0, 32) : + new SteamMinerMachine(holder, 320, 4, 0, 16), + (isHP, builder) -> builder + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(DUMMY_RECIPES) + .tooltips(Component.translatable("gtceu.universal.tooltip.uses_per_tick_steam", isHP ? 32 : 16) + .append(ChatFormatting.GRAY + ", ") + .append(Component.translatable("gtceu.machine.miner.per_block", + isHP ? 240 / 20 : 280 / 20))) + .tooltipBuilder((item, tooltip) -> { + int maxArea = IMiner.getWorkingArea(isHP ? 6 : 4); + tooltip.add(Component.translatable("gtceu.universal.tooltip.working_area", maxArea, maxArea)); + }) + .renderer(() -> new SteamMinerRenderer(isHP, + isHP ? GTCEu.id("block/machines/high_pressure_steam_miner") : + GTCEu.id("block/machines/steam_miner"))) + .register()); ////////////////////////////////////// // *** SimpleTieredMachine ***// diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java index 9edc5d05c0..f6426d156d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java @@ -71,10 +71,10 @@ public class SteamMinerMachine extends SteamWorkableMachine implements IMiner, I @Nullable protected ISubscription exportItemSubs; - public SteamMinerMachine(IMachineBlockEntity holder, int speed, int maximumRadius, int fortune) { + public SteamMinerMachine(IMachineBlockEntity holder, int speed, int maximumRadius, int fortune, int energyPerTick) { super(holder, false, fortune, speed, maximumRadius); this.inventorySize = 4; - this.energyPerTick = 16; + this.energyPerTick = energyPerTick; this.importItems = createImportItemHandler(); this.exportItems = createExportItemHandler(); } @@ -89,7 +89,7 @@ public SteamMinerMachine(IMachineBlockEntity holder, int speed, int maximumRadiu return new SteamMinerLogic(this, fortune, speed, maxRadius); } throw new IllegalArgumentException( - "MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); + "MinerMachine need args [fortune, speed, maximumRadius] for initialization"); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java index 2dad649847..dab0320afd 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java @@ -524,12 +524,19 @@ public static void init(Consumer provider) { new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_miner", GTMachines.STEAM_MINER.asStack(), "DSD", - "SMS", "GSG", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'S', - new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze), 'D', - new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond), 'G', - new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Bronze)); - + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_miner_bronze", + GTMachines.STEAM_MINER.first().asStack(), + "DSD", "SMS", "GSG", + 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), + 'S', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze), + 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond), + 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_miner_steel", + GTMachines.STEAM_MINER.second().asStack(), "DSD", "SMS", "GSG", + 'M', GTMachines.STEAM_MINER.first().asStack(), + 'S', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TinAlloy), + 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond), + 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Steel)); // MULTI BLOCK CONTROLLERS VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_primitive_blast_furnace", GTMultiMachines.PRIMITIVE_BLAST_FURNACE.asStack(), "hRS", "PBR", "dRS", 'R', diff --git a/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java b/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java index 2edfabfc9e..9fa56ceb83 100644 --- a/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java +++ b/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java @@ -477,11 +477,22 @@ public static void remapIds(MissingMappingsEvent event) { if (mapping.getKey().equals(GTCEu.id("tungstensteel_coil_block"))) { mapping.remap(GTBlocks.COIL_RTMALLOY.get()); } + if (mapping.getKey().equals(GTCEu.id("steam_miner"))) { + mapping.remap(GTMachines.STEAM_MINER.first().getBlock()); + } }); event.getMappings(Registries.ITEM, GTCEu.MOD_ID).forEach(mapping -> { if (mapping.getKey().equals(GTCEu.id("tungstensteel_coil_block"))) { mapping.remap(GTBlocks.COIL_RTMALLOY.get().asItem()); } + if (mapping.getKey().equals(GTCEu.id("steam_miner"))) { + mapping.remap(GTMachines.STEAM_MINER.first().getItem()); + } + }); + event.getMappings(Registries.BLOCK_ENTITY_TYPE, GTCEu.MOD_ID).forEach(mapping -> { + if (mapping.getKey().equals(GTCEu.id("steam_miner"))) { + mapping.remap(GTMachines.STEAM_MINER.first().getBlockEntityType()); + } }); event.getMappings(Registries.BLOCK, "gregiceng").forEach(mapping -> { diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_back.png b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_back.png new file mode 100644 index 0000000000000000000000000000000000000000..eced5b8735c930f8090d1bdd4734046f9e0898f6 GIT binary patch literal 298 zcmV+_0oDGAP)rld+D(APhubPTSErEfK$vGXGzNZ-53VWkN@tt!!nF zy_|Gg+%$k}#^aGaoaf0W`1=}XGqKi6jL{T0=MWKMjHcji3*XUN zBZR;_&qnr6UDtvlgn;*+ZQE$A0d&=G3HE&lpp;??a?Zdn9$ZmMA%t+3^0NZpF literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.mcmeta b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.mcmeta new file mode 100644 index 0000000000..f201982c03 --- /dev/null +++ b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 8 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.png b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_down.png new file mode 100644 index 0000000000000000000000000000000000000000..bfcdac5e840b6cd518da2576c0f6f968c4126da2 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!4gjw#}Etuw-YaN9#G(Mxtu3>y+FOaNd5W+ z!zg`;gDc|SF6Td#_&|^SQscU1vhV*gr>0eEFBQ2s<@rU~D$;P; z%HV3Z&?4*8n-~w2&T!_KQk-{tW^RL7hoM)q?0@qH!DQ(d_dflU=6BIQ6l`^5&wK%p PR~S59{an^LB{Ts5itkRS literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png new file mode 100644 index 0000000000000000000000000000000000000000..52e24329b373b4eb1efc6c1c92a56fa1bd9fccb6 GIT binary patch literal 1911 zcmZux3rrJd96xm;0=~vHOoN_>VHCagdcC&Svz2Mfqt0T5sxYJBdiS-Qw7uH9LPe%L z#DP)K_%`t|S)!Sbh$c#$?__Q&hH0kY=5)$}E}I&od$C0KT`7o(P1=5s-~adh|G)pE z(V3q+B4K<2f*>R8dA0)hKU(?5$HCu8FJ7|Tn0}z+oU<+`vCj43 zw(Y5nwsh6>8P5(nfA=?CeYmPw+wyC%^NYk$i;9gOoyjn_Zo8IwZ|uloA#HM1`rRj2 zht^Np66pSS{<6#x2Uv5rNOsXv4j-7^IgOqA9+FAJ4@EaGwFw>ZJwOlba+F?#Cdl{ZGV1h=&Od-Im>Xaky|&`x9&ny zPu=~WE3dpdS5;t5`D*WHug@kgJ@sJ4wZG4AsCxZhO6J~QZmN0~j$|KOUmn?idl}-G z5L`L`hqlz#&egZSJ^WyNjZ0PdN&15)u5-e;UE;o#Gwv^9_ikR%U|+boT{|w996WZ3@)lmbJGCY`9EFnlDOjF|MK}XWgh7shwKLl5iT;!O; zaH3z$@}e84BmN*nBZxUG5@fkDAfs;J6#^FQ+1KYWRNyVxLcN1<1g)S{$g2#2!peLX zS6RlHcr0tihy-(lfed~ivuMQc3rI}Ff<=iLxK@re7#fAhWfrW+;Y6)s2%wajQWJP~ zL?|aQNP?o~5bt3MY&kI!xU*oTvK(YInu>}Fb%jnXhP)cB$z;+Hq=qDMh`^=g0hx{9 z0V%DQBt~Nc5*HGJvLFUfg_d=TVcCK~KYAVX2OW-n_J9=A0V<-2utAMhO=$dn#p@_q zlC#U9am<%@q9xbzAkY*5NeqWLkX;S}a$28xuHE76w^kzY3jSa;7N}bPBRtoS35G+y z=snMAfDiZ~nFM{(_G4wi^G2Ju{84VA?)N;aXBh;uLG5aW_jCanhjYjUG3l=V(tKk3AsCY=8p_4`fygki=s& z8aUeR#@#x?gHu3H;ckOThto7k6P(_|8Q<8?4GFOHSl>W@6doS((3HVVag-hh6iee2 zXENffn*=y-q_u$e=#2z$W2mAxGt+6eV5FLeZJj<=_J|?B1)C!T!jagiOYnn2nN=jx z8c5Pe8x4d(uh;3d#u#D&2uZMp6e=yDCMgW%IVJ}Zv9KTnKkEgWV8Dx^itY?_9SX=Q zMF$C^f-u$)U}Z7n5=EZ{Q#?ZzroLK*)!M6mo*+Tg@@OBR(NDA+3c<1gN3q)W323w; z8J6pPN@B|akHrqTQa0cPuw`Mj^umO9WQ5Suw3`P!&Qbl;5a0b1R za>I=F+DoEGu3$r8rWZyBgMh^m4Fb)GYN_hORg?lnD1y}DgaIdXE>g#k1f#5t3;{Et z84!zEqqOC~_{^GjNzscN(9XT1B5Dn11>8ZqzVV~%`bQWDKoLT4KpijR{({4;*>0QZ zqUUlcJ=J4o*VVMNJYO{$SE+_~H`hIC-&^I$-%)>s@V%C+LMw5K`3!N zrt(InmV_@t$_wz`ha4J&KB}c^kack@x+d&s9DFP%?Reo0{q>&4@#|CKs!I#rzqxT( aQWCPb+)ZE49(Pt5#`f%d+tFDiwf_T=IGU0G literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_front.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_side.png b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_side.png new file mode 100644 index 0000000000000000000000000000000000000000..3baa69ebde72af1c7b056adb50cd1112cb014970 GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkQ1HH| zi(`mI@6pK{`&tZmT;!L(zQmgwAZ6Du>Hqo%(v#FKO`D)+8m`K9TJO?bG4tNVH{|+t zcU$*0`+xWvX!api?z4?NL+$bB=HD;)b_&8nN!WAXf*(>boFDUuP{`JAho xHYKtin_<-~@%ZHRV`Wcg{M&Wv?*914{D*d>Y`LFZb_VEG22WQ%mvv4FO#poEc#Qx6 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_up.png b/src/main/resources/assets/gtceu/textures/block/machines/high_pressure_steam_miner/overlay_up.png new file mode 100644 index 0000000000000000000000000000000000000000..1017db7011644e2cd72cbc34ab0f2c6b1d540ee9 GIT binary patch literal 237 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!6r`^#}Etuw-YaN9#G(MxtzB!dq-QbMZ5J& zsdWpJZ^Rk621fmP-&_#5XM)79g^OP{8!mI28dM|ZrMX6P>A_+%*%OwNuSxY=PI#Pm z^h)E_ZHF587BHlhF!UPMl?yl}Z2msa`CXU}_nQw^O$zcmq!O8;cbvUydHmM%O$+C( fy!B41zC+Ki&PDi)+B$EbYZyFT{an^LB{Ts5(Ti8Q literal 0 HcmV?d00001 From c7509a3851c69faced2c3b61a601e30f25bcf71f Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:00:36 -0500 Subject: [PATCH 03/24] Fix Distillation Tower machines crashing (#2646) --- .../electric/DistillationTowerMachine.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java index c64a4e42ae..43fa62f87e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; @@ -76,16 +77,18 @@ public void onStructureFormed() { getDefinition().setPartSorter(Comparator.comparingInt(p -> p.self().getPos().getY())); getDefinition().setAllowExtendedFacing(false); super.onStructureFormed(); - var parts = getParts().stream() + final int startY = getPos().getY() + yOffset; + List parts = getParts().stream() .filter(part -> PartAbility.EXPORT_FLUIDS.isApplicable(part.self().getBlockState().getBlock())) + .filter(part -> part.self().getPos().getY() >= startY) .toList(); if (!parts.isEmpty()) { - // Loop from controller y + offset -> highest output hatch - int y = getPos().getY() + yOffset; + // Loop from controller y + offset -> the highest output hatch int maxY = parts.get(parts.size() - 1).self().getPos().getY(); - fluidOutputs = new ObjectArrayList<>(maxY - y); - for (int outputIndex = 0; y <= maxY; ++y) { + fluidOutputs = new ObjectArrayList<>(maxY - startY); + int outputIndex = 0; + for (int y = startY; y <= maxY; ++y) { if (parts.size() <= outputIndex) { fluidOutputs.add(VoidFluidHandler.INSTANCE); continue; @@ -93,14 +96,12 @@ public void onStructureFormed() { var part = parts.get(outputIndex); if (part.self().getPos().getY() == y) { - part.getRecipeHandlers().stream() + var handler = part.getRecipeHandlers().stream() .filter(IFluidHandler.class::isInstance) .findFirst() - .ifPresentOrElse(h -> { - fluidOutputs.add((IFluidHandler) h); - if (firstValid == null) firstValid = (IFluidHandler) h; - }, - () -> fluidOutputs.add(VoidFluidHandler.INSTANCE)); + .map(IFluidHandler.class::cast) + .orElse(VoidFluidHandler.INSTANCE); + addOutput(handler); outputIndex++; } else if (part.self().getPos().getY() > y) { fluidOutputs.add(VoidFluidHandler.INSTANCE); @@ -115,6 +116,11 @@ public void onStructureFormed() { } else onStructureInvalid(); } + private void addOutput(IFluidHandler handler) { + fluidOutputs.add(handler); + if (firstValid == null && handler != VoidFluidHandler.INSTANCE) firstValid = handler; + } + @Override public void onStructureInvalid() { fluidOutputs = null; @@ -178,7 +184,7 @@ public Iterator searchRecipe() { var recipeType = machine.getRecipeType(); if (recipeType == GTRecipeTypes.DISTILLERY_RECIPES) return super.searchRecipe(); - // Do recipe searching ourselves so we can match the outputs how we want + // Do recipe searching ourselves, so we can match the outputs how we want IRecipeCapabilityHolder holder = this.machine; if (!holder.hasProxies()) return null; var iterator = recipeType.getLookup().getRecipeIterator(holder, recipe -> !recipe.isFuel && From b8a414dc687d554802657c13696e937203328745 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:00:49 -0500 Subject: [PATCH 04/24] Fix Machine Recipe Modifiers (#2647) --- .../common/data/machines/GTMachineUtils.java | 6 ++--- .../common/data/machines/GTMultiMachines.java | 26 ++++++------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java index fb9c461d82..cab40911b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java @@ -27,7 +27,6 @@ import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; -import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder; import com.gregtechceu.gtceu.api.registry.registrate.MultiblockMachineBuilder; import com.gregtechceu.gtceu.client.renderer.machine.*; @@ -142,12 +141,11 @@ public static MachineDefinition[] registerSimpleMachines(String name, if (hasPollutionDebuff) { builder.recipeModifiers(GTRecipeModifiers.ENVIRONMENT_REQUIREMENT .apply(GTMedicalConditions.CARBON_MONOXIDE_POISONING, 100 * tier), - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + GTRecipeModifiers.OC_NON_PERFECT) .conditionalTooltip(defaultEnvironmentRequirement(), ConfigHolder.INSTANCE.gameplay.environmentalHazards); } else { - builder.recipeModifier( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)); + builder.recipeModifier(GTRecipeModifiers.OC_NON_PERFECT); } return builder .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java index cb651cde31..eee997423f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java @@ -16,7 +16,6 @@ import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; import com.gregtechceu.gtceu.api.pattern.Predicates; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; -import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; import com.gregtechceu.gtceu.client.renderer.machine.*; import com.gregtechceu.gtceu.client.util.TooltipHelper; import com.gregtechceu.gtceu.common.block.BoilerFireboxType; @@ -192,8 +191,7 @@ public class GTMultiMachines { ConfigHolder.INSTANCE.gameplay.environmentalHazards) .rotationState(RotationState.ALL) .recipeType(GTRecipeTypes.LARGE_CHEMICAL_RECIPES) - .recipeModifiers(GTRecipeModifiers.DEFAULT_ENVIRONMENT_REQUIREMENT, - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.PERFECT_OVERCLOCK_SUBTICK)) + .recipeModifiers(GTRecipeModifiers.DEFAULT_ENVIRONMENT_REQUIREMENT, GTRecipeModifiers.OC_PERFECT_SUBTICK) .appearanceBlock(CASING_PTFE_INERT) .pattern(definition -> { var casing = blocks(CASING_PTFE_INERT.get()).setMinGlobalLimited(10); @@ -259,8 +257,7 @@ public class GTMultiMachines { .multiblock("implosion_compressor", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.ALL) .recipeType(GTRecipeTypes.IMPLOSION_RECIPES) - .recipeModifiers( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK)) + .recipeModifiers(GTRecipeModifiers.OC_NON_PERFECT_SUBTICK) .appearanceBlock(CASING_STEEL_SOLID) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXX", "XXX", "XXX") @@ -280,9 +277,7 @@ public class GTMultiMachines { .multiblock("pyrolyse_oven", CoilWorkableElectricMultiblockMachine::new) .rotationState(RotationState.ALL) .recipeType(GTRecipeTypes.PYROLYSE_RECIPES) - .recipeModifiers( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK), - GTRecipeModifiers::pyrolyseOvenOverclock) + .recipeModifiers(GTRecipeModifiers::pyrolyseOvenOverclock) .appearanceBlock(MACHINE_CASING_ULV) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXX", "XXX", "XXX") @@ -336,9 +331,7 @@ public class GTMultiMachines { .multiblock("multi_smelter", CoilWorkableElectricMultiblockMachine::new) .rotationState(RotationState.ALL) .recipeTypes(GTRecipeTypes.FURNACE_RECIPES, GTRecipeTypes.ALLOY_SMELTER_RECIPES) - .recipeModifiers( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK), - GTRecipeModifiers::multiSmelterParallel) + .recipeModifiers(GTRecipeModifiers::multiSmelterParallel) .appearanceBlock(CASING_INVAR_HEATPROOF) .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.electric_furnace"), Component.translatable("gtceu.alloy_smelter"))) @@ -442,8 +435,7 @@ public class GTMultiMachines { .multiblock("distillation_tower", DistillationTowerMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.DISTILLATION_RECIPES) - .recipeModifiers( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK)) + .recipeModifiers(GTRecipeModifiers.OC_NON_PERFECT_SUBTICK) .appearanceBlock(CASING_STAINLESS_CLEAN) .pattern(definition -> { TraceabilityPredicate exportPredicate = abilities(PartAbility.EXPORT_FLUIDS_1X); @@ -508,8 +500,7 @@ public class GTMultiMachines { .langValue("Evaporation Tower") .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.EVAPORATION_RECIPES) - .recipeModifiers( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK)) + .recipeModifiers(GTRecipeModifiers.OC_NON_PERFECT_SUBTICK) .appearanceBlock(CASING_STAINLESS_EVAPORATION) .pattern(definition -> FactoryBlockPattern.start(RIGHT, BACK, UP) .aisle("FYF", "YYY", "FYF") @@ -540,8 +531,7 @@ public class GTMultiMachines { .multiblock("vacuum_freezer", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.ALL) .recipeType(GTRecipeTypes.VACUUM_RECIPES) - .recipeModifiers( - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK)) + .recipeModifiers(GTRecipeModifiers.OC_NON_PERFECT_SUBTICK) .appearanceBlock(CASING_ALUMINIUM_FROSTPROOF) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXX", "XXX", "XXX") @@ -563,7 +553,7 @@ public class GTMultiMachines { .recipeType(GTRecipeTypes.ASSEMBLY_LINE_RECIPES) .alwaysTryModifyRecipe(true) .recipeModifiers(GTRecipeModifiers.DEFAULT_ENVIRONMENT_REQUIREMENT, - GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK_SUBTICK)) + GTRecipeModifiers.OC_NON_PERFECT_SUBTICK) .appearanceBlock(CASING_STEEL_SOLID) .pattern(definition -> FactoryBlockPattern.start(BACK, UP, RIGHT) .aisle("FIF", "RTR", "SAG", "#Y#") From fec2b326e87bec15b27a18e66558e95c163924f4 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:01:03 -0500 Subject: [PATCH 05/24] Fix Smart Filter not saving mode (#2648) --- .../gtceu/api/cover/filter/FilterHandler.java | 3 ++- .../gtceu/api/cover/filter/SmartItemFilter.java | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java index c02ba23d84..c2b7ab437a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java @@ -148,7 +148,8 @@ private void loadFilterFromItem() { if (!this.filterItem.isEmpty()) { this.filter = loadFilter(this.filterItem); filter.setOnUpdated(this.onFilterUpdated); - if (this.filter instanceof SmartItemFilter smart && container instanceof CoverBehavior cover && + if (filter instanceof SmartItemFilter smart && + container instanceof CoverBehavior cover && cover.coverHolder instanceof MachineCoverContainer mcc) { var machine = MetaMachine.getMachine(mcc.getLevel(), mcc.getPos()); if (machine != null) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SmartItemFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SmartItemFilter.java index 5f38427621..dcd3d916dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SmartItemFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SmartItemFilter.java @@ -17,7 +17,6 @@ import net.minecraft.world.item.ItemStack; import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; -import lombok.Setter; import java.util.List; import java.util.function.Consumer; @@ -27,7 +26,6 @@ public class SmartItemFilter implements ItemFilter { protected Consumer itemWriter = filter -> {}; protected Consumer onUpdated = filter -> itemWriter.accept(filter); - @Setter private SmartFilteringMode filterMode = SmartFilteringMode.ELECTROLYZER; protected SmartItemFilter() {} @@ -58,6 +56,11 @@ public CompoundTag saveFilter() { return tag; } + private void setFilterMode(SmartFilteringMode filterMode) { + this.filterMode = filterMode; + onUpdated.accept(this); + } + @Override public WidgetGroup openConfigurator(int x, int y) { WidgetGroup group = new WidgetGroup(x, y, 18 * 3 + 25, 18 * 3); @@ -94,7 +97,7 @@ private int lookup(ItemStack itemStack) { public void setModeFromMachine(String machineName) { for (SmartFilteringMode mode : SmartFilteringMode.VALUES) { if (machineName.contains(mode.localeName)) { - this.filterMode = mode; + setFilterMode(mode); return; } } From 36b516ea8aa111aa3aaca877f289af63ffd10809 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:01:46 -0500 Subject: [PATCH 06/24] Fix `ModifierFunction` builder overwriting values (#2649) --- .../gtceu/api/recipe/modifier/ModifierFunction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java index 44f694d3a9..99d90ee1ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java @@ -151,10 +151,10 @@ public ModifierFunction build() { new HashMap<>(recipe.tickInputChanceLogics), new HashMap<>(recipe.tickOutputChanceLogics), newConditions, new ArrayList<>(recipe.ingredientActions), recipe.data, recipe.duration, recipe.isFuel, recipe.recipeCategory); - copied.parallels *= parallels; - copied.ocLevel += addOCs; + copied.parallels = recipe.parallels * parallels; + copied.ocLevel = recipe.ocLevel + addOCs; if (recipe.data.getBoolean("duration_is_total_cwu")) { - copied.duration = (int) Math.max(1, (copied.duration * (1f - 0.025f * addOCs))); + copied.duration = (int) Math.max(1, (recipe.duration * (1f - 0.025f * addOCs))); } else { copied.duration = Math.max(1, durationModifier.apply(recipe.duration)); } From 4a05108228b6af391a36088d6bc5ec482816cc38 Mon Sep 17 00:00:00 2001 From: Alex Loving Date: Thu, 26 Dec 2024 22:02:09 -0500 Subject: [PATCH 07/24] Add LEVEL state to PotionFluid (#2650) --- .../gtceu/common/fluid/potion/PotionFluid.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/fluid/potion/PotionFluid.java b/src/main/java/com/gregtechceu/gtceu/common/fluid/potion/PotionFluid.java index 1c509b2af8..5f5bd6259d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/fluid/potion/PotionFluid.java +++ b/src/main/java/com/gregtechceu/gtceu/common/fluid/potion/PotionFluid.java @@ -14,6 +14,8 @@ import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidStack; @@ -30,6 +32,13 @@ public PotionFluid(Properties properties) { super(properties .bucket(() -> Items.AIR) .block(() -> (LiquidBlock) Blocks.WATER)); + registerDefaultState(getStateDefinition().any().setValue(LEVEL, 7)); + } + + @Override + protected void createFluidStateDefinition(StateDefinition.Builder builder) { + super.createFluidStateDefinition(builder); + builder.add(LEVEL); } public static FluidStack of(int amount, Potion potion) { @@ -74,7 +83,7 @@ public boolean isSource(FluidState state) { @Override public int getAmount(FluidState state) { - return 0; + return state.getValue(LEVEL); } public static class PotionFluidType extends FluidType { From e7dcec9307b425b6622d7af6206254ec86d7b218 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:02:22 -0500 Subject: [PATCH 08/24] Fix KJS replacement order & custom json recipes (#2653) --- .../integration/kjs/recipe/GTRecipeSchema.java | 13 +++++++++++++ .../recipe/components/CapabilityMapComponent.java | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java index 2624c94489..ee8ba12f19 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java @@ -55,6 +55,7 @@ import lombok.Setter; import lombok.experimental.Accessors; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -875,6 +876,18 @@ public GTRecipeJS stationResearch(UnaryOperator createRecipe() { if (onSave != null) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java index 6c1cb5c50d..441d5e3f11 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java @@ -15,8 +15,8 @@ import dev.latvian.mods.kubejs.recipe.ReplacementMatch; import dev.latvian.mods.kubejs.recipe.component.ComponentRole; import dev.latvian.mods.kubejs.recipe.component.RecipeComponent; +import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; -import java.util.HashSet; import java.util.Set; public record CapabilityMapComponent(boolean isOutput) implements RecipeComponent { @@ -77,7 +77,7 @@ public CapabilityMap read(RecipeJS recipe, Object from) { GTRegistries.RECIPE_CAPABILITIES.get(key) != null) { RecipeCapability cap = GTRegistries.RECIPE_CAPABILITIES.get(key); var pair = GTRecipeComponents.VALID_CAPS.get(cap); - Set result = new HashSet<>(); + Set result = new ObjectLinkedOpenHashSet<>(); JsonArray value = GsonHelper.getAsJsonArray(json, key, new JsonArray()); for (int i = 0; i < value.size(); ++i) { result.add((isOutput ? pair.getSecond() : pair.getFirst()).read(recipe, value.get(i))); From 132d68553d774eb53d9c4823edb8155115319de3 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:02:32 -0500 Subject: [PATCH 09/24] Fix Cleanroom floor check (#2654) --- .../multiblock/electric/CleanroomMachine.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java index 267b6be956..9f2075f6e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java @@ -30,6 +30,8 @@ import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.common.machine.electric.HullMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.generator.LargeCombustionEngineMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.generator.LargeTurbineMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.DiodePartMachine; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.CokeOvenMachine; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitiveBlastFurnaceMachine; @@ -276,7 +278,7 @@ public void updateStructureDimensions() { public boolean isBlockEdge(@NotNull Level world, @NotNull BlockPos.MutableBlockPos pos, @NotNull Direction direction) { var state = world.getBlockState(pos.move(direction)); - return state == GTBlocks.PLASTCRETE.getDefaultState() || state == GTBlocks.CLEANROOM_GLASS.getDefaultState(); + return state == getCasingState() || state == getGlassState(); } /** @@ -288,7 +290,7 @@ public boolean isBlockEdge(@NotNull Level world, @NotNull BlockPos.MutableBlockP public boolean isBlockFloor(@NotNull Level world, @NotNull BlockPos.MutableBlockPos pos, @NotNull Direction direction) { var state = world.getBlockState(pos.move(direction)); - return state.is(CustomTags.CLEANROOM_FLOORS); + return state == getCasingState() || state == getGlassState() || state.is(CustomTags.CLEANROOM_FLOORS); } @NotNull @@ -450,19 +452,21 @@ public boolean addCache() { }; } - protected boolean isMachineBanned(MetaMachine metaTileEntity) { + protected boolean isMachineBanned(MetaMachine machine) { // blacklisted machines: mufflers and all generators, miners/drills, primitives - if (metaTileEntity instanceof ICleanroomProvider) return true; - if (metaTileEntity instanceof IMufflerMachine) return true; - if (metaTileEntity instanceof SimpleGeneratorMachine) return true; - // todo: enable checks when these are added? - // if (metaTileEntity instanceof FuelMultiblockController) return true; - if (metaTileEntity instanceof LargeMinerMachine) return true; - if (metaTileEntity instanceof FluidDrillMachine) return true; - // if (metaTileEntity instanceof MetaTileEntityCentralMonitor) return true; - if (metaTileEntity instanceof CokeOvenMachine) return true; - if (metaTileEntity instanceof PrimitiveBlastFurnaceMachine) return true; - return metaTileEntity instanceof PrimitivePumpMachine; + if (machine instanceof ICleanroomProvider) return true; + if (machine instanceof IMufflerMachine) return true; + if (machine instanceof SimpleGeneratorMachine) return true; + if (machine instanceof LargeCombustionEngineMachine) return true; + if (machine instanceof LargeTurbineMachine) return true; + + if (machine instanceof LargeMinerMachine) return true; + if (machine instanceof FluidDrillMachine) return true; + if (machine instanceof BedrockOreMinerMachine) return true; + + if (machine instanceof CokeOvenMachine) return true; + if (machine instanceof PrimitiveBlastFurnaceMachine) return true; + return machine instanceof PrimitivePumpMachine; } @Override From 6f70051a55ccf6b4c115cdbdec335045d501ab03 Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Fri, 27 Dec 2024 17:07:49 -0700 Subject: [PATCH 10/24] Remove leftover Create RecipeType (#2628) --- .../com/gregtechceu/gtceu/common/data/GTRecipeTypes.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index 390c30953e..627855cf05 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -42,8 +42,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.ModLoader; -import org.jetbrains.annotations.Nullable; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -673,12 +671,6 @@ public class GTRecipeTypes { public static final GTRecipeType DUMMY_RECIPES = register("dummy", DUMMY) .setXEIVisible(false); - ////////////////////////////////////// - // ****** Integration *******// - ////////////////////////////////////// - @Nullable - public static GTRecipeType CREATE_MIXER_RECIPES; - public static GTRecipeType register(String name, String group, RecipeType... proxyRecipes) { var recipeType = new GTRecipeType(GTCEu.id(name), group, proxyRecipes); GTRegistries.register(BuiltInRegistries.RECIPE_TYPE, recipeType.registryName, recipeType); From ccfc72606d4cf9ff00ea444ff602204b21ef342f Mon Sep 17 00:00:00 2001 From: Spicierspace153 <21964509+Spicierspace153@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:08:31 -0700 Subject: [PATCH 11/24] Fix Overclocking Logic not using correct tier for OCs (#2661) Co-authored-by: spaceboi153 --- .../gtceu/api/recipe/OverclockingLogic.java | 2 +- .../jade/provider/RecipeLogicProvider.java | 29 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java index 762bd598a2..1129a6eca4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java @@ -69,7 +69,7 @@ static OverclockingLogic create(double durationFactor, double voltageFactor, boo if (EUt == 0) return ModifierFunction.IDENTITY; int recipeTier = GTUtil.getTierByVoltage(EUt); - int maximumTier = GTUtil.getTierByVoltage(maxVoltage); + int maximumTier = GTUtil.getOCTierByVoltage(maxVoltage); int OCs = maximumTier - recipeTier; if (recipeTier == GTValues.ULV) OCs--; if (OCs == 0) return ModifierFunction.IDENTITY; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java index ba09037ef6..655b979272 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.machine.steam.SimpleSteamMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; +import com.gregtechceu.gtceu.client.util.TooltipHelper; import com.gregtechceu.gtceu.common.machine.multiblock.steam.SteamParallelMultiblockMachine; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; @@ -16,6 +17,7 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -25,6 +27,8 @@ import snownee.jade.api.ITooltip; import snownee.jade.api.config.IPluginConfig; +import static net.minecraft.ChatFormatting.*; + public class RecipeLogicProvider extends CapabilityBlockProvider { public RecipeLogicProvider() { @@ -81,19 +85,32 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, } if (EUt > 0) { - Component text; + MutableComponent text; if (isSteam) { text = Component.literal(FormattingUtil.formatNumbers(EUt)).withStyle(ChatFormatting.GREEN) .append(Component.literal(" mB/t").withStyle(ChatFormatting.RESET)); } else { - var tier = GTUtil.getTierByVoltage(EUt); + var tier = GTUtil.getOCTierByVoltage(EUt); + text = Component.literal(FormattingUtil.formatNumbers(EUt)).withStyle(ChatFormatting.RED) .append(Component.literal(" EU/t").withStyle(ChatFormatting.RESET) - .append(Component.literal(" (").withStyle(ChatFormatting.GREEN) - .append(Component.literal(GTValues.VNF[tier]) - .withStyle(style -> style.withColor(GTValues.VC[tier]))) - .append(Component.literal(")").withStyle(ChatFormatting.GREEN)))); + .append(Component.literal(" (").withStyle(ChatFormatting.GREEN))); + if (tier < GTValues.TIER_COUNT) { + text = text.append(Component.literal(GTValues.VNF[tier]) + .withStyle(style -> style.withColor(GTValues.VC[tier]))); + } else { + int speed = tier - 14; + text = text.append(Component + .literal("MAX") + .withStyle(style -> style.withColor(TooltipHelper.rainbowColor(speed))) + .append(Component.literal("+") + .withStyle(style -> style.withColor(GTValues.VC[speed])) + .append(Component.literal(FormattingUtil.formatNumbers(tier - 14))) + .withStyle(style -> style.withColor(GTValues.VC[speed])))); + + } + text = text.append(Component.literal(")").withStyle(ChatFormatting.GREEN)); } if (isInput) { From fc324904f6d0428359ba794144c1d05ac1e352aa Mon Sep 17 00:00:00 2001 From: Lue Date: Fri, 27 Dec 2024 19:08:55 -0500 Subject: [PATCH 12/24] Fix Steam and Plasma turbines requiring mufflers (#2655) --- .../gtceu/common/data/machines/GTMachineUtils.java | 11 ++++++++++- .../gtceu/common/data/machines/GTMultiMachines.java | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java index cab40911b5..194495cebb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java @@ -578,6 +578,15 @@ public static MultiblockMachineDefinition registerLargeTurbine(String name, int Supplier gear, ResourceLocation casingTexture, ResourceLocation overlayModel) { + return registerLargeTurbine(name, tier, recipeType, casing, gear, casingTexture, overlayModel, true); + } + + public static MultiblockMachineDefinition registerLargeTurbine(String name, int tier, GTRecipeType recipeType, + Supplier casing, + Supplier gear, + ResourceLocation casingTexture, + ResourceLocation overlayModel, + boolean needsMuffler) { return REGISTRATE.multiblock(name, holder -> new LargeTurbineMachine(holder, tier)) .rotationState(RotationState.ALL) .recipeType(recipeType) @@ -609,7 +618,7 @@ public static MultiblockMachineDefinition registerLargeTurbine(String name, int .or(abilities(PartAbility.OUTPUT_ENERGY)).setExactLimit(1)) .where('H', blocks(casing.get()) .or(autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, true)) - .or(autoAbilities(true, true, false))) + .or(autoAbilities(true, needsMuffler, false))) .build()) .recoveryItems( () -> new ItemLike[] { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java index eee997423f..d99011ee95 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java @@ -919,20 +919,23 @@ public class GTMultiMachines { GTRecipeTypes.STEAM_TURBINE_FUELS, CASING_STEEL_TURBINE, CASING_STEEL_GEARBOX, GTCEu.id("block/casings/mechanic/machine_casing_turbine_steel"), - GTCEu.id("block/multiblock/generator/large_steam_turbine")); + GTCEu.id("block/multiblock/generator/large_steam_turbine"), + false); public static final MultiblockMachineDefinition LARGE_GAS_TURBINE = registerLargeTurbine("gas_large_turbine", EV, GTRecipeTypes.GAS_TURBINE_FUELS, CASING_STAINLESS_TURBINE, CASING_STAINLESS_STEEL_GEARBOX, GTCEu.id("block/casings/mechanic/machine_casing_turbine_stainless_steel"), - GTCEu.id("block/multiblock/generator/large_gas_turbine")); + GTCEu.id("block/multiblock/generator/large_gas_turbine"), + true); public static final MultiblockMachineDefinition LARGE_PLASMA_TURBINE = registerLargeTurbine("plasma_large_turbine", IV, GTRecipeTypes.PLASMA_GENERATOR_FUELS, CASING_TUNGSTENSTEEL_TURBINE, CASING_TUNGSTENSTEEL_GEARBOX, GTCEu.id("block/casings/mechanic/machine_casing_turbine_tungstensteel"), - GTCEu.id("block/multiblock/generator/large_plasma_turbine")); + GTCEu.id("block/multiblock/generator/large_plasma_turbine"), + false); public static final MultiblockMachineDefinition ACTIVE_TRANSFORMER = REGISTRATE .multiblock("active_transformer", ActiveTransformerMachine::new) From 7e0f78dadb5655f2a39ade2506901ec7e4c50f28 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sat, 28 Dec 2024 02:09:35 +0200 Subject: [PATCH 13/24] Fix oil spouts not updating the fluid on generation (#2659) --- .../java/com/gregtechceu/gtceu/common/commands/GTCommands.java | 2 +- .../gtceu/common/worldgen/feature/FluidSproutFeature.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java b/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java index 13d213bd4c..ff0f9fb037 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java +++ b/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java @@ -94,7 +94,7 @@ public static void register(CommandDispatcher dispatcher, Co .then(argument("vein", GTRegistryArgument.registry(GTRegistries.ORE_VEINS, ResourceLocation.class)) .executes(context -> GTCommands.placeVein(context, - context.getSource().getEntityOrException().blockPosition())) + BlockPos.containing(context.getSource().getPosition()))) .then(argument("position", BlockPosArgument.blockPos()) .executes(context -> GTCommands.placeVein(context, BlockPosArgument.getBlockPos(context, "position"))))))); diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java index be3a4ccadd..e9899a7ef8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java @@ -46,7 +46,7 @@ public boolean place(FeaturePlaceContext context) { if (config.fluid().isSame(Fluids.EMPTY)) { return false; } - int surfaceHeight = level.getHeight(Heightmap.Types.OCEAN_FLOOR_WG, blockpos.getX(), blockpos.getZ()); + int surfaceHeight = level.getHeight(Heightmap.Types.WORLD_SURFACE_WG, blockpos.getX(), blockpos.getZ()); if (blockpos.getY() >= surfaceHeight) { return false; } @@ -126,6 +126,7 @@ public void setBlock(BlockPos.MutableBlockPos mutablePos, int currentX, int curr int sectionZ = SectionPos.sectionRelative(currentZ); levelchunksection.setBlockState(sectionX, sectionY, sectionZ, config.fluid().defaultFluidState().createLegacyBlock(), false); + level.getChunk(mutablePos).markPosForPostprocessing(mutablePos); placedAmount.add(1); } From 23e7bcbabc5cba36b588fc016de17fdb8863f62b Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Fri, 27 Dec 2024 19:09:48 -0500 Subject: [PATCH 14/24] Add Production Efficiency Modifier (#2621) --- .../gtceu/api/machine/trait/RecipeLogic.java | 9 ++- .../recipe/modifier/EfficiencyModifier.java | 76 +++++++++++++++++++ .../api/recipe/modifier/ModifierFunction.java | 18 +++-- .../electric/DistillationTowerMachine.java | 2 + .../integration/kjs/GregTechKubeJSPlugin.java | 5 +- 5 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/EfficiencyModifier.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index 464b64f8af..7989ddc2b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -75,6 +75,10 @@ public enum Status { @Persisted @DescSynced protected GTRecipe lastRecipe; + @Getter + @Persisted + @DescSynced + protected int consecutiveRecipes = 0; // Consecutive recipes that have been run /** * safe, it is the origin recipe before {@link IRecipeLogicMachine#fullModifyRecipe(GTRecipe)}' * which can be found @@ -139,6 +143,7 @@ public void resetRecipeLogic() { recipeDirty = false; lastRecipe = null; lastOriginRecipe = null; + consecutiveRecipes = 0; progress = 0; duration = 0; isActive = false; @@ -358,6 +363,7 @@ public void setupRecipe(GTRecipe recipe) { if (handleFuelRecipe()) { if (!machine.beforeWorking(recipe)) { setStatus(Status.IDLE); + consecutiveRecipes = 0; progress = 0; duration = 0; isActive = false; @@ -368,7 +374,6 @@ public void setupRecipe(GTRecipe recipe) { if (lastRecipe != null && !recipe.equals(lastRecipe)) { chanceCaches.clear(); } - recipeDirty = false; lastRecipe = recipe; setStatus(Status.WORKING); @@ -457,6 +462,7 @@ public boolean isHasNotEnoughEnergy() { public void onRecipeFinish() { machine.afterWorking(); if (lastRecipe != null) { + consecutiveRecipes++; lastRecipe.postWorking(this.machine); handleRecipeIO(lastRecipe, IO.OUT); if (machine.alwaysTryModifyRecipe()) { @@ -484,6 +490,7 @@ public void onRecipeFinish() { } else { setStatus(Status.IDLE); } + consecutiveRecipes = 0; progress = 0; duration = 0; isActive = false; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/EfficiencyModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/EfficiencyModifier.java new file mode 100644 index 0000000000..74390e4ccf --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/EfficiencyModifier.java @@ -0,0 +1,76 @@ +package com.gregtechceu.gtceu.api.recipe.modifier; + +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; + +import com.google.common.base.Preconditions; +import org.jetbrains.annotations.NotNull; + +/** + * Recipe Modifier that scales recipe duration based on the number of times the recipe has been consecutively run + * Multiplies duration by a base amount, then by a multiplicative amount relative to the number of runs, up to a set + * limit + */ +public class EfficiencyModifier implements RecipeModifier { + + private final double baseMultiplier; + private final double efficiency; + private final double hardCap; + private final double heuristic; + + private EfficiencyModifier(double baseMultiplier, double efficiency, double hardCap) { + Preconditions.checkArgument(baseMultiplier > 0, "Base multiplier must be > 0: %s", baseMultiplier); + Preconditions.checkArgument(efficiency > 0, "Efficiency must be > 0: %s", efficiency); + Preconditions.checkArgument(hardCap >= 0, "Hard cap must be >= 0: %s", hardCap); + this.baseMultiplier = baseMultiplier; + this.efficiency = efficiency; + this.hardCap = hardCap; + this.heuristic = 300 * efficiency * efficiency; + } + + /** + * Creates an Efficiency Modifier with the given parameters + * + * @param baseMultiplier base duration multiplier to be applied to the recipe + * @param efficiency multiplier to be applied per consecutive recipe run + * @param hardCap limit on how low the duration can be multiplied + * @return Efficiency Modifier + */ + public static EfficiencyModifier of(double baseMultiplier, double efficiency, double hardCap) { + return new EfficiencyModifier(baseMultiplier, efficiency, hardCap); + } + + public static EfficiencyModifier of(double baseMultiplier, double efficiency) { + return of(baseMultiplier, efficiency, 0.5); + } + + public static EfficiencyModifier of(double efficiency) { + return of(2, efficiency, 0.5); + } + + /** + * Efficiency recipe modifier + *

+ * Duration will be multiplied by base × efficiencyruns + * + * @param machine an {@link IRecipeLogicMachine} + * @param recipe recipe + * @return Efficiency Modifier + */ + @Override + public @NotNull ModifierFunction getModifier(@NotNull MetaMachine machine, @NotNull GTRecipe recipe) { + if (!(machine instanceof IRecipeLogicMachine rlm)) { + return RecipeModifier.nullWrongType(IRecipeLogicMachine.class, machine); + } + if (recipe.duration <= 1) return ModifierFunction.IDENTITY; + int runs = rlm.getRecipeLogic().getConsecutiveRecipes(); + double mult; + // Heuristic to not do insane floating point math - if you need more than this to get to the cap, seek help + if (runs > heuristic) mult = hardCap; + else mult = Math.max(hardCap, baseMultiplier * Math.pow(efficiency, runs)); + return ModifierFunction.builder() + .durationMultiplier(mult) + .build(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java index 99d90ee1ac..79faf4a813 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java @@ -34,8 +34,14 @@ @FunctionalInterface public interface ModifierFunction { - ModifierFunction NULL = r -> null; - ModifierFunction IDENTITY = r -> r; + /** + * Use this static to denote that the recipe should be cancelled + */ + ModifierFunction NULL = recipe -> null; + /** + * Use this static to denote that the recipe doesn't get modified + */ + ModifierFunction IDENTITY = recipe -> recipe; /** * Applies this modifier to the passed recipe @@ -54,7 +60,7 @@ public interface ModifierFunction { * @return The composed function of {@code this.apply(before.apply(recipe))} */ default ModifierFunction compose(@NotNull ModifierFunction before) { - return r -> applySafe(before.apply(r)); + return recipe -> applySafe(before.apply(recipe)); } /** @@ -64,7 +70,7 @@ default ModifierFunction compose(@NotNull ModifierFunction before) { * @return The composed function of {@code after.apply(this.apply(recipe))} */ default ModifierFunction andThen(@NotNull ModifierFunction after) { - return r -> after.applySafe(apply(r)); + return recipe -> after.applySafe(apply(recipe)); } private GTRecipe applySafe(@Nullable GTRecipe recipe) { @@ -167,8 +173,8 @@ public ModifierFunction build() { }; } - private Map, List> applyAllButEU(ContentModifier cm, - Map, List> contents) { + private static Map, List> applyAllButEU(ContentModifier cm, + Map, List> contents) { Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var cap = entry.getKey(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java index 43fa62f87e..94fdd023c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java @@ -269,6 +269,7 @@ public void onRecipeFinish() { lastRecipe.matchTickRecipe(this.machine).isSuccess() && lastRecipe.checkConditions(this).isSuccess()) { setupRecipe(lastRecipe); + if (isActive) consecutiveRecipes++; } else { if (suspendAfterFinish) { setStatus(Status.SUSPEND); @@ -276,6 +277,7 @@ public void onRecipeFinish() { } else { setStatus(Status.IDLE); } + consecutiveRecipes = 0; progress = 0; duration = 0; isActive = false; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java index b35c1d05c3..b3ddb3c532 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java @@ -267,6 +267,7 @@ public void registerBindings(BindingsEvent event) { event.add("GTMedicalConditions", GTMedicalConditions.class); event.add("GTRecipeModifiers", GTRecipeModifiers.class); event.add("OverclockingLogic", OverclockingLogic.class); + event.add("MachineModifiers", MachineModifiers.class); event.add("ModifierFunction", ModifierFunction.class); event.add("RecipeCapability", RecipeCapability.class); event.add("ChanceLogic", ChanceLogic.class); @@ -293,10 +294,6 @@ public void registerBindings(BindingsEvent event) { event.add("GTLayerPattern", GTLayerPattern.class); event.add("GTDikeBlockDefinition", DikeVeinGenerator.DikeBlockDefinition.class); event.add("GTOres", GTOres.class); - event.add("GTRecipeModifiers", GTRecipeModifiers.class); - event.add("OverclockingLogic", OverclockingLogic.class); - event.add("ModifierFunction", ModifierFunction.class); - event.add("MachineModifiers", MachineModifiers.class); event.add("GTWorldGenLayers", WorldGenLayers.class); // MaterialColor stuff, for TagPrefix } From 550b8657b86c7bd37b4008197a9ac926807fb259 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Fri, 27 Dec 2024 19:17:09 -0500 Subject: [PATCH 15/24] Fix furnace recipe serialization (#2657) --- .../gtceu/api/recipe/category/GTRecipeCategory.java | 6 ++++++ .../gtceu/common/data/GTRecipeCategories.java | 9 --------- .../gregtechceu/gtceu/integration/emi/GTEMIPlugin.java | 3 +-- .../integration/emi/recipe/GTRecipeEMICategory.java | 2 +- .../gregtechceu/gtceu/integration/jei/GTJEIPlugin.java | 3 +-- .../integration/jei/recipe/GTRecipeJEICategory.java | 2 +- .../gregtechceu/gtceu/integration/rei/GTREIPlugin.java | 4 +--- .../integration/rei/recipe/GTRecipeREICategory.java | 2 +- 8 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java index 2d532d81ce..76e128733f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; +import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; @@ -69,6 +70,11 @@ public void addRecipe(GTRecipe recipe) { recipeType.addToCategoryMap(this, recipe); } + public boolean shouldRegisterDisplays() { + return (isXEIVisible || Platform.isDevEnv()) && + this != GTRecipeTypes.FURNACE_RECIPES.getCategory(); + } + @Override public boolean equals(Object obj) { if (this == obj) return true; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java index 5ff36d3e8e..c006b57c6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java @@ -14,12 +14,6 @@ public class GTRecipeCategories { - // Alias for recipes that shouldn't be in the category registry - public static final GTRecipeCategory DUMMY = GTRecipeTypes.DUMMY_RECIPES.getCategory(); - // Alias for recipes you don't want visible in XEI - public static final GTRecipeCategory HIDDEN = register("hidden", GTRecipeTypes.DUMMY_RECIPES) - .setXEIVisible(false); - public static final GTRecipeCategory ARC_FURNACE_RECYCLING = register("arc_furnace_recycling", GTRecipeTypes.ARC_FURNACE_RECIPES) .setIcon(GuiTextures.ARC_FURNACE_RECYCLING_CATEGORY); @@ -45,9 +39,6 @@ public static GTRecipeCategory register(String categoryName, @NotNull GTRecipeTy } public static void init() { - // Remove these categories, so they don't get registered in XEI at all, dev or not - GTRegistries.RECIPE_CATEGORIES.remove(DUMMY.registryKey); - GTRegistries.RECIPE_CATEGORIES.remove(GTRecipeTypes.FURNACE_RECIPES.getCategory().registryKey); if (GTCEu.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistries.RECIPE_CATEGORIES.getRegistryName()); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java index f4218557fb..0e7cb10572 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java @@ -23,7 +23,6 @@ import com.gregtechceu.gtceu.integration.emi.recipe.GTRecipeEMICategory; import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.modular.ModularUIContainer; import net.minecraft.core.registries.BuiltInRegistries; @@ -58,7 +57,7 @@ public void register(EmiRegistry registry) { if (ConfigHolder.INSTANCE.machines.doBedrockOres) registry.addCategory(GTBedrockOreEmiCategory.CATEGORY); for (GTRecipeCategory category : GTRegistries.RECIPE_CATEGORIES) { - if (Platform.isDevEnv() || category.isXEIVisible()) { + if (category.shouldRegisterDisplays()) { registry.addCategory(GTRecipeEMICategory.CATEGORIES.apply(category)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java index 7a456e0321..e03963e9ec 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java @@ -32,7 +32,7 @@ private GTRecipeEMICategory(GTRecipeCategory category) { public static void registerDisplays(EmiRegistry registry) { for (GTRecipeCategory category : GTRegistries.RECIPE_CATEGORIES) { - if (!category.isXEIVisible() && !Platform.isDevEnv()) continue; + if (!category.shouldRegisterDisplays()) continue; var type = category.getRecipeType(); if (category == type.getCategory()) type.buildRepresentativeRecipes(); EmiRecipeCategory emiCategory = CATEGORIES.apply(category); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java index 5eb9c6fd08..057ad27640 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java @@ -20,7 +20,6 @@ import com.gregtechceu.gtceu.integration.jei.subtype.PotionFluidSubtypeInterpreter; import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.registries.BuiltInRegistries; @@ -70,7 +69,7 @@ public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { if (ConfigHolder.INSTANCE.machines.doBedrockOres) registry.addRecipeCategories(new GTBedrockOreInfoCategory(jeiHelpers)); for (GTRecipeCategory category : GTRegistries.RECIPE_CATEGORIES) { - if (Platform.isDevEnv() || category.isXEIVisible()) { + if (category.shouldRegisterDisplays()) { registry.addRecipeCategories(new GTRecipeJEICategory(jeiHelpers, category)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java index 92aacb790d..6a3555d6aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java @@ -50,7 +50,7 @@ public GTRecipeJEICategory(IJeiHelpers helpers, public static void registerRecipes(IRecipeRegistration registration) { for (GTRecipeCategory category : GTRegistries.RECIPE_CATEGORIES) { - if (!category.isXEIVisible() && !Platform.isDevEnv()) continue; + if (!category.shouldRegisterDisplays()) continue; var type = category.getRecipeType(); if (category == type.getCategory()) type.buildRepresentativeRecipes(); var wrapped = type.getRecipesInCategory(category).stream() diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java index 7bbefdcf36..4fe582bdff 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java @@ -18,8 +18,6 @@ import com.gregtechceu.gtceu.integration.rei.orevein.GTOreVeinDisplayCategory; import com.gregtechceu.gtceu.integration.rei.recipe.GTRecipeREICategory; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.alchemy.Potion; @@ -60,7 +58,7 @@ public void registerCategories(CategoryRegistry registry) { if (ConfigHolder.INSTANCE.machines.doBedrockOres) registry.add(new GTBedrockOreDisplayCategory()); for (GTRecipeCategory category : GTRegistries.RECIPE_CATEGORIES) { - if (Platform.isDevEnv() || category.isXEIVisible()) { + if (category.shouldRegisterDisplays()) { registry.add(new GTRecipeREICategory(category)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java index e7a437f784..61624c20be 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java @@ -46,7 +46,7 @@ public GTRecipeREICategory(@NotNull GTRecipeCategory category) { public static void registerDisplays(DisplayRegistry registry) { for (GTRecipeCategory category : GTRegistries.RECIPE_CATEGORIES) { - if (!category.isXEIVisible() && !Platform.isDevEnv()) continue; + if (!category.shouldRegisterDisplays()) continue; var type = category.getRecipeType(); if (category == type.getCategory()) type.buildRepresentativeRecipes(); var identifier = CATEGORIES.apply(category); From 149a70dac7554c1b22a307e36e6c32da372c6d04 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Sat, 28 Dec 2024 00:11:41 -0500 Subject: [PATCH 16/24] Fix MultiParts not calling `removeFromController` on unload (#2663) --- .../gtceu/api/machine/multiblock/part/MultiblockPartMachine.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java index 89e82d16e9..0b45dccd39 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java @@ -85,6 +85,7 @@ public void onUnload() { for (BlockPos pos : controllerPositions) { if (level instanceof ServerLevel && level.isLoaded(pos) && MetaMachine.getMachine(level, pos) instanceof IMultiController controller) { + removedFromController(controller); controller.onPartUnload(); } } From 6e87d7f49d066b5e42d7219db326961e5c72a6f7 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Fri, 27 Dec 2024 22:11:49 -0700 Subject: [PATCH 17/24] Fix Stone Variant maceration having conflicting recipes (#2664) --- .../java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java | 3 ++- .../gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java index 9a2174fa51..e21b9e58fe 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java @@ -708,7 +708,7 @@ public static TagPrefix get(String name) { .defaultTagPath("%s") .langValue("%s") .miningToolTag(BlockTags.MINEABLE_WITH_PICKAXE) - .unificationEnabled(true) + .unificationEnabled(false) .generateBlock(true) // generate a block but not really, for TagPrefix#setIgnoredBlock .generationCondition((material) -> false); @@ -867,6 +867,7 @@ public record BlockProperties(Supplier> renderType, private long materialAmount = -1; @Setter + @Getter private boolean unificationEnabled; @Setter private boolean generateItem; diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java index 8a3634bae6..03bebb55d2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java @@ -114,7 +114,7 @@ private static void registerMaceratorRecycling(Consumer provider UnificationEntry entry = ChemicalHelper.getUnificationEntry(input.getItem()); TagKey inputTag = null; - if (entry != null) { + if (entry != null && entry.tagPrefix.unificationEnabled()) { inputTag = ChemicalHelper.getTag(entry.tagPrefix, entry.material); } From 22391bdfc47af0aa8dc09cec8fe1a84d941fbc17 Mon Sep 17 00:00:00 2001 From: marisathewitch Date: Sat, 28 Dec 2024 09:12:47 +0400 Subject: [PATCH 18/24] update ru_ru.json (#2662) Co-authored-by: Western01 --- .../resources/assets/gtceu/lang/ru_ru.json | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/resources/assets/gtceu/lang/ru_ru.json b/src/main/resources/assets/gtceu/lang/ru_ru.json index e7257e0a29..59d0beaf20 100644 --- a/src/main/resources/assets/gtceu/lang/ru_ru.json +++ b/src/main/resources/assets/gtceu/lang/ru_ru.json @@ -1409,15 +1409,15 @@ "cover.machine_controller.redstone": "Минимальный Редстоун сигнал: %d", "cover.machine_controller.title": "Настройки контроллера механизма", "cover.tag_filter.info.0": "§bПринимает сложные выражения", - "cover.tag_filter.info.1": "& = И", - "cover.tag_filter.info.2": "| = ИЛИ", - "cover.tag_filter.info.3": "^ = XOR", - "cover.tag_filter.info.4": "! = НЕ", - "cover.tag_filter.info.5": "() для указания приоритета", - "cover.tag_filter.info.6": "* для подстановочного знака", - "cover.tag_filter.info.7": "§bПример:", - "cover.tag_filter.info.8": "§6dust*Gold | (plate* & !*Double*)", - "cover.tag_filter.info.9": "Подходит для всей золотой пыли всех размеров или всех пластин, но не для двойных пластин", + "cover.tag_filter.info.1": "§6a & b§r = И", + "cover.tag_filter.info.2": "§6a | b§r = ИЛИ", + "cover.tag_filter.info.3": "§6a ^ b§r = XOR", + "cover.tag_filter.info.4": "§6!a§r = НЕ", + "cover.tag_filter.info.5": "§6(a)§r для указания приоритета", + "cover.tag_filter.info.6": "§6*§r для подстановочного знака", + "cover.tag_filter.info.7": "§6$§r для не отмеченных", + "cover.tag_filter.info.8": "§bТэги идут в формате 'namespace:tag/subtype'.", + "cover.tag_filter.info.9": "Предполагается пространство имен «forge:», если оно не указано.", "cover.tag_filter.matches": "Предмет совпадает", "cover.tag_filter.matches_not": "Предмет не совпадает", "cover.tag_filter.test_slot.info": "Вставьте элемент, чтобы проверить, соответствует ли он выражению фильтра", @@ -4021,7 +4021,7 @@ "material.gtceu.yellow_limonite": "Желтый лимонит", "material.gtceu.ytterbium": "Иттербий", "material.gtceu.yttrium": "Иттрий", - "material.gtceu.yttrium_barium_cuprate": "Купрат иттрий-барийя", + "material.gtceu.yttrium_barium_cuprate": "Оксид иттрия-бария-меди", "material.gtceu.zeolite": "Цеолит", "material.gtceu.zeron_100": "Zeron-100", "material.gtceu.zinc": "Цинк", @@ -5510,5 +5510,18 @@ "gtceu.direction.tooltip.down": "Снизу", "gtceu.direction.tooltip.front": "Спереди", "gtceu.direction.tooltip.left": "Слева", - "item.toggle.advanced.info.tooltip": "§8" + "item.toggle.advanced.info.tooltip": "§8", + "cover.shutter.message.enabled": "Затвор закрыт", + "cover.shutter.message.disabled": "Затвор открыт", + "block.gtceu.lp_steam_miner": "Паровой шахтер низкого давления", + "block.gtceu.hp_steam_miner": "Паровой шахтер высокого давления", + "cover.tag_filter.info.11": "Это соответствует всей золотой пыли или всем микросхемам, кроме LV вотьтажа.", + "gtceu.journeymap.options.layers.bedrock_fluids": "Показать бедроковые залежи жидкости", + "cover.tag_filter.info.10": "§bНапример: §6*dusts/gold | (gtceu:circuits & !*lv)", + "fluid.gtceu.potion": "Зелье", + "gtceu.forming_press.naming.named": "§oНеназванный предмет", + "gtceu.forming_press.naming.press": "§oНеназванный пресс", + "gtceu.forming_press.naming.to_name": "§oПредмет в название", + "gtceu.rei.group.potion_fluids": "Жидкости зелий", + "material.gtceu.blackstone": "Чернит" } From c4ee920cdac5fd7b387cbce11f5ed86927844f3b Mon Sep 17 00:00:00 2001 From: Natanaelel <43886350+Natanaelel@users.noreply.github.com> Date: Sat, 28 Dec 2024 19:20:36 +0100 Subject: [PATCH 19/24] Fix bucket being voided by TankWidget with not enough space (#2643) --- .../com/gregtechceu/gtceu/api/gui/widget/TankWidget.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java index b896b030e7..349ec88d5c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java @@ -537,11 +537,14 @@ private int tryClickContainer(boolean isShiftKeyDown) { boolean performedEmptying = false; ItemStack drainedResult = ItemStack.EMPTY; for (int i = 0; i < maxAttempts; i++) { - FluidActionResult result = FluidUtil.tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, + int remainingCapacity = fluidTank.getTankCapacity(tank) - fluidTank.getFluidInTank(tank).getAmount(); + FluidActionResult result = FluidUtil.tryEmptyContainer(currentStack, fluidTank, remainingCapacity, null, false); if (!result.isSuccess()) break; + ItemStack remainingStack = FluidUtil - .tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); + .tryEmptyContainer(currentStack, fluidTank, remainingCapacity, null, true) + .getResult(); performedEmptying = true; currentStack.shrink(1); From 80ffd9c5b5379ce748a2fe671acd481f87c641ea Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Sun, 29 Dec 2024 10:34:54 -0500 Subject: [PATCH 20/24] Change pipes to force connections to covers (#2666) --- .../gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java | 6 ++++++ .../gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java | 6 ++++++ .../gtceu/common/cover/ComputerMonitorCover.java | 5 +++++ .../gregtechceu/gtceu/common/cover/FluidFilterCover.java | 3 +-- .../com/gregtechceu/gtceu/common/cover/StorageCover.java | 4 ++++ .../gtceu/common/cover/detector/DetectorCover.java | 5 +++++ 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java index 150658d437..4dfca277d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -270,6 +270,12 @@ public void setConnection(Direction side, boolean connected, boolean fromNeighbo pipeTile.getPipeType().getClass() != this.getPipeType().getClass()) { return; } + + if (!connected) { + var cover = getCoverContainer().getCoverAtSide(side); + if (cover != null && cover.canPipePassThrough()) return; + } + connections = withSideConnection(connections, side, connected); updateNetworkConnection(side, connected); diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java index eefa7b00e2..4dfec36022 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java @@ -186,6 +186,7 @@ public CoverBehavior getCoverAtSide(Direction side) { } public void setCoverAtSide(@Nullable CoverBehavior coverBehavior, Direction side) { + var previousCover = getCoverAtSide(side); switch (side) { case UP -> up = coverBehavior; case SOUTH -> south = coverBehavior; @@ -196,6 +197,11 @@ public void setCoverAtSide(@Nullable CoverBehavior coverBehavior, Direction side } if (coverBehavior != null) { coverBehavior.getSyncStorage().markAllDirty(); + if (coverBehavior.canPipePassThrough()) { + pipeTile.setConnection(side, true, false); + } + } else if (previousCover != null && previousCover.canPipePassThrough()) { + pipeTile.setConnection(side, false, false); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java index 3fc282952b..86b0837504 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java @@ -12,5 +12,10 @@ public ComputerMonitorCover(CoverDefinition definition, ICoverable coverHolder, super(definition, coverHolder, attachedSide); } + @Override + public boolean canPipePassThrough() { + return false; + } + // No implementation here, this cover is just for decorative purposes } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java index 2060c3dc32..8dd355d749 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java @@ -21,7 +21,6 @@ import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidUtil; import lombok.Getter; import lombok.Setter; @@ -61,7 +60,7 @@ public void setFilterMode(FilterMode filterMode) { @Override public boolean canAttach() { - return FluidUtil.getFluidHandler(coverHolder.getLevel(), coverHolder.getPos(), attachedSide).isPresent(); + return coverHolder.getFluidHandlerCap(attachedSide, false) != null; } public FluidFilter getFluidFilter() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/StorageCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/StorageCover.java index fb049a1609..6c6a5b640c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/StorageCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/StorageCover.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfigurator; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; +import com.gregtechceu.gtceu.api.machine.MachineCoverContainer; import com.gregtechceu.gtceu.api.transfer.item.CustomItemStackHandler; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; @@ -50,11 +51,13 @@ public int getSlotLimit(int slot) { } @Override + @NotNull public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } @Override + @NotNull public List getAdditionalDrops() { var list = super.getAdditionalDrops(); for (int slot = 0; slot < SIZE; slot++) { @@ -65,6 +68,7 @@ public List getAdditionalDrops() { @Override public boolean canAttach() { + if (!(coverHolder instanceof MachineCoverContainer)) return false; for (var dir : Direction.values()) { if (coverHolder.hasCover(dir) && coverHolder.getCoverAtSide(dir) instanceof StorageCover) return false; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java index c30ef9b1fc..f141fee3b4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java @@ -98,4 +98,9 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han public boolean canConnectRedstone() { return true; } + + @Override + public boolean canPipePassThrough() { + return false; + } } From c2448cd0f64e4c6ea1102b13d786b75958fc3ab2 Mon Sep 17 00:00:00 2001 From: kross <135918757+krossgg@users.noreply.github.com> Date: Sun, 29 Dec 2024 10:39:13 -0500 Subject: [PATCH 21/24] Add multiblock constructors to KJS + lang (#2667) --- .../registrate/MultiblockMachineBuilder.java | 12 ++++++- .../integration/kjs/GregTechKubeJSPlugin.java | 2 ++ .../machine/KJSSteamMachineBuilder.java | 2 +- .../machine/KJSTieredMultiblockBuilder.java | 4 ++- .../kjs/helpers/MachineConstructors.java | 34 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/integration/kjs/helpers/MachineConstructors.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java index 1b7871508a..2da6530b57 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.registry.registrate; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.IMachineBlock; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.data.RotationState; @@ -42,6 +43,7 @@ import com.tterrag.registrate.builders.ItemBuilder; import com.tterrag.registrate.util.nullness.NonNullConsumer; import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; +import dev.latvian.mods.kubejs.client.LangEventJS; import dev.latvian.mods.rhino.util.HideFromJS; import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Getter; @@ -376,6 +378,14 @@ public MultiblockMachineBuilder onBlockEntityRegister(NonNullConsumer Date: Sun, 29 Dec 2024 08:41:10 -0700 Subject: [PATCH 22/24] Updates registrate dependency (#2625) Co-authored-by: spaceboi153 --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index fd8df091af..1b9d439f69 100644 --- a/settings.gradle +++ b/settings.gradle @@ -29,7 +29,7 @@ dependencyResolutionManagement { // Forge def forgeVersion = "47.1.47" - def registrateForgeVersion = "MC1.20-1.3.3" + def registrateForgeVersion = "MC1.20-1.3.11" def topForgeVersion = "1.20.1-10.0.1-3" def jadeForgeVersion = "11.6.3" def curiosForgeVersion = "5.9.1" From 4f4cb8ba35c8aa264b68dcfb47276b6daa682230 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 29 Dec 2024 15:58:28 +0000 Subject: [PATCH 23/24] RELEASE for 1.20.1 (#2669) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ gradle.properties | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7889ce58a0..caac6378ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # ChangeLog +## Version [v1.6.2](https://github.com/GregTechCEu/GregTech-Modern/compare/v1.6.1-1.20.1...v1.6.2-1.20.1) +### Added + +- Add High Pressure Variation of The Steam Miner Singleblock. by @Ghostipedia in [#2637](https://github.com/GregTechCEu/GregTech-Modern/pull/2637) +- Add Production Efficiency Modifier by @krossgg in [#2621](https://github.com/GregTechCEu/GregTech-Modern/pull/2621) +- Add multiblock constructors to KJS + lang by @krossgg in [#2667](https://github.com/GregTechCEu/GregTech-Modern/pull/2667) +- Updates registrate dependency by @Spicierspace153 in [#2625](https://github.com/GregTechCEu/GregTech-Modern/pull/2625) + +### Fixed + +- Fix Distillation Tower machines crashing by @krossgg in [#2646](https://github.com/GregTechCEu/GregTech-Modern/pull/2646) +- Fix Machine Recipe Modifiers by @krossgg in [#2647](https://github.com/GregTechCEu/GregTech-Modern/pull/2647) +- Fix Smart Filter not saving mode by @krossgg in [#2648](https://github.com/GregTechCEu/GregTech-Modern/pull/2648) +- Fix builder overwriting values by @krossgg in [#2649](https://github.com/GregTechCEu/GregTech-Modern/pull/2649) +- Add LEVEL state to PotionFluid by @loving2 in [#2650](https://github.com/GregTechCEu/GregTech-Modern/pull/2650) +- Fix KJS replacement order & custom json recipes by @krossgg in [#2653](https://github.com/GregTechCEu/GregTech-Modern/pull/2653) +- Fix Cleanroom floor check by @krossgg in [#2654](https://github.com/GregTechCEu/GregTech-Modern/pull/2654) +- Fix Overclocking Logic not using correct tier for OCs by @Spicierspace153 in [#2661](https://github.com/GregTechCEu/GregTech-Modern/pull/2661) +- Fix Steam and Plasma turbines requiring mufflers by @Luexa in [#2655](https://github.com/GregTechCEu/GregTech-Modern/pull/2655) +- Fix oil spouts not updating the fluid on generation by @screret in [#2659](https://github.com/GregTechCEu/GregTech-Modern/pull/2659) +- Fix furnace recipe serialization by @krossgg in [#2657](https://github.com/GregTechCEu/GregTech-Modern/pull/2657) +- Fix MultiParts not calling on unload by @krossgg in [#2663](https://github.com/GregTechCEu/GregTech-Modern/pull/2663) +- Fix Stone Variant maceration having conflicting recipes by @YoungOnionMC in [#2664](https://github.com/GregTechCEu/GregTech-Modern/pull/2664) +- Fix bucket being voided by TankWidget with not enough space by @Natanaelel in [#2643](https://github.com/GregTechCEu/GregTech-Modern/pull/2643) +- Change pipes to force connections to covers by @krossgg in [#2666](https://github.com/GregTechCEu/GregTech-Modern/pull/2666) + +### Changed + +- Fix typo in temperature parameter of BlastProperty builder by @Luexa in [#2636](https://github.com/GregTechCEu/GregTech-Modern/pull/2636) +- update ru_ru.json by @marisathewitch in [#2662](https://github.com/GregTechCEu/GregTech-Modern/pull/2662) + + ## Version [v1.6.1](https://github.com/GregTechCEu/GregTech-Modern/compare/v1.6.0-1.20.1...v1.6.1-1.20.1) ### Added diff --git a/gradle.properties b/gradle.properties index e9cb817536..ca86758304 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx6G # Mod Info mod_id = gtceu mod_name = GregTech -mod_version = 1.6.2 +mod_version = 1.6.3 mod_description = GregTech CE Unofficial, ported from 1.12.2 mod_license = LGPL-3.0 license mod_url = https://github.com/GregTechCEu/GregTech-Modern/ From a1622c19d3dfc4aab337e145f2afb946feabe9a8 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sat, 4 Jan 2025 02:41:01 -0700 Subject: [PATCH 24/24] Add durability-based decomposition to Rotors and Tools (#2623) --- .../resources/assets/gtceu/lang/en_ud.json | 2 + .../resources/assets/gtceu/lang/en_us.json | 2 + .../gtceu/api/item/tool/GTToolType.java | 30 ++++- .../gtceu/common/data/GTRecipeTypes.java | 8 +- .../trait/customlogic/ArcFurnaceLogic.java | 126 ++++++++++++++++++ .../trait/customlogic/MaceratorLogic.java | 121 +++++++++++++++++ .../gtceu/data/lang/MachineLang.java | 4 + 7 files changed, 286 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java create mode 100644 src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 7c52c25c14..13e1a4484e 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -2128,6 +2128,8 @@ "gtceu.arc_furnace": "ǝɔɐuɹnℲ ɔɹⱯ", "gtceu.assembler": "ɹǝןqɯǝssⱯ", "gtceu.assembly_line": "ǝuıꞀ ʎןqɯǝssⱯ", + "gtceu.auto_decomp.rotor": "ɹoʇoᴚ ǝuıqɹn⟘", + "gtceu.auto_decomp.tool": "ןooʇ ɔıɹʇɔǝןǝ-uoN", "gtceu.autoclave": "ǝʌɐןɔoʇnⱯ", "gtceu.battery_buffer.average_input": "ʇ/∩Ǝ %s :ʇnduı ǝbɐɹǝʌⱯ", "gtceu.battery_buffer.average_output": "ʇ/∩Ǝ %s :ʇndʇno ǝbɐɹǝʌⱯ", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 6c8d4c0ec4..a1693ab3d4 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -2128,6 +2128,8 @@ "gtceu.arc_furnace": "Arc Furnace", "gtceu.assembler": "Assembler", "gtceu.assembly_line": "Assembly Line", + "gtceu.auto_decomp.rotor": "Turbine Rotor", + "gtceu.auto_decomp.tool": "Non-electric tool", "gtceu.autoclave": "Autoclave", "gtceu.battery_buffer.average_input": "Average input: %s EU/t", "gtceu.battery_buffer.average_output": "Average output: %s EU/t", diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java index bcf22fb8f6..66bb6bf54d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java @@ -48,6 +48,7 @@ public class GTToolType { .toolStats(b -> b.attacking().attackDamage(3.0F).attackSpeed(-2.4F)) .constructor(GTSwordItem::create) .toolClassNames("sword") + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType PICKAXE = GTToolType.builder("pickaxe") .toolTag(TagUtil.createItemTag("pickaxes", true)) @@ -56,6 +57,7 @@ public class GTToolType { .toolStats(b -> b.blockBreaking().attackDamage(1.0F).attackSpeed(-2.8F) .behaviors(TorchPlaceBehavior.INSTANCE)) .toolClassNames("pickaxe") + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType SHOVEL = GTToolType.builder("shovel") .toolTag(TagUtil.createItemTag("shovels", true)) @@ -64,6 +66,7 @@ public class GTToolType { b -> b.blockBreaking().attackDamage(1.5F).attackSpeed(-3.0F).behaviors(GrassPathBehavior.INSTANCE)) .constructor(GTShovelItem::create) .toolClassNames("shovel") + .materialAmount(GTValues.M) .build(); public static final GTToolType AXE = GTToolType.builder("axe") .toolTag(TagUtil.createItemTag("axes", true)) @@ -74,6 +77,7 @@ public class GTToolType { ScrapeBehavior.INSTANCE, WaxOffBehavior.INSTANCE)) .constructor(GTAxeItem::create) .toolClassNames("axe") + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType HOE = GTToolType.builder("hoe") .toolTag(TagUtil.createItemTag("hoes", true)) @@ -81,6 +85,7 @@ public class GTToolType { .toolStats(b -> b.cannotAttack().attackSpeed(-1.0F).behaviors(HoeGroundBehavior.INSTANCE)) .constructor(GTHoeItem::create) .toolClassNames("hoe") + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType MINING_HAMMER = GTToolType.builder("mining_hammer") @@ -91,6 +96,7 @@ public class GTToolType { .durabilityMultiplier(3.0F) .behaviors(TorchPlaceBehavior.INSTANCE)) .toolClasses(GTToolType.PICKAXE) + .materialAmount(6 * GTValues.M) .build(); public static final GTToolType SPADE = GTToolType.builder("spade") .toolTag(TagUtil.createItemTag("tools/spades", false)) @@ -100,6 +106,7 @@ public class GTToolType { .durabilityMultiplier(3.0F) .behaviors(GrassPathBehavior.INSTANCE)) .toolClasses(GTToolType.SHOVEL) + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType SCYTHE = GTToolType.builder("scythe") .toolTag(TagUtil.createItemTag("tools/scythes", false)) @@ -112,6 +119,7 @@ public class GTToolType { .constructor(GTHoeItem::create) .toolClassNames("scythe") .toolClasses(GTToolType.HOE) + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType SAW = GTToolType.builder("saw") @@ -122,6 +130,7 @@ public class GTToolType { .behaviors(HarvestIceBehavior.INSTANCE)) .sound(GTSoundEntries.SAW_TOOL) .symbol('s') + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType HARD_HAMMER = GTToolType.builder("hammer") .toolTag(TagUtil.createItemTag("tools/hammers", false)) @@ -133,6 +142,7 @@ public class GTToolType { .sound(GTSoundEntries.FORGE_HAMMER) .symbol('h') .toolClasses(GTToolType.PICKAXE) + .materialAmount(6 * GTValues.M) .build(); public static final GTToolType SOFT_MALLET = GTToolType.builder("mallet") .toolTag(TagUtil.createItemTag("tools/mallets", false)) @@ -140,6 +150,7 @@ public class GTToolType { .behaviors(ToolModeSwitchBehavior.INSTANCE)) .sound(GTSoundEntries.SOFT_MALLET_TOOL) .symbol('r') + .materialAmount(6 * GTValues.M) .build(); public static final GTToolType WRENCH = GTToolType.builder("wrench") .toolTag(TagUtil.createItemTag("tools/wrenches", false)) @@ -151,6 +162,7 @@ public class GTToolType { ToolModeSwitchBehavior.INSTANCE)) .sound(GTSoundEntries.WRENCH_TOOL, true) .symbol('w') + .materialAmount(4 * GTValues.M) .build(); public static final GTToolType FILE = GTToolType.builder("file") .toolTag(TagUtil.createItemTag("tools/files", false)) @@ -158,6 +170,7 @@ public class GTToolType { .cannotAttack().attackSpeed(-2.4F)) .sound(GTSoundEntries.FILE_TOOL) .symbol('f') + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType CROWBAR = GTToolType.builder("crowbar") .toolTag(TagUtil.createItemTag("tools/crowbars", false)) @@ -167,6 +180,7 @@ public class GTToolType { .sneakBypassUse().behaviors(RotateRailBehavior.INSTANCE)) .sound(new ExistingSoundEntry(SoundEvents.ITEM_BREAK, SoundSource.BLOCKS), true) .symbol('c') + .materialAmount(3 * GTValues.M / 2) .build(); public static final GTToolType SCREWDRIVER = GTToolType.builder("screwdriver") .toolTag(TagUtil.createItemTag("tools/screwdrivers", false)) @@ -175,12 +189,14 @@ public class GTToolType { .behaviors(new EntityDamageBehavior(3.0F, Spider.class))) .sound(GTSoundEntries.SCREWDRIVER_TOOL) .symbol('d') + .materialAmount(GTValues.M) .build(); public static final GTToolType MORTAR = GTToolType.builder("mortar") .toolTag(TagUtil.createItemTag("tools/mortars", false)) .toolStats(b -> b.crafting().damagePerCraftingAction(2).cannotAttack().attackSpeed(-2.4F)) .sound(GTSoundEntries.MORTAR_TOOL) .symbol('m') + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType WIRE_CUTTER = GTToolType.builder("wire_cutter") .toolTag(TagUtil.createItemTag("tools/wire_cutters", false)) @@ -189,6 +205,7 @@ public class GTToolType { .damagePerCraftingAction(4).attackDamage(-1.0F).attackSpeed(-2.4F)) .sound(GTSoundEntries.WIRECUTTER_TOOL, true) .symbol('x') + .materialAmount(4 * GTValues.M) // 3 plates + 2 rods .build(); public static final GTToolType KNIFE = GTToolType.builder("knife") .toolTag(TagUtil.createItemTag("tools/knives", false)) @@ -197,12 +214,14 @@ public class GTToolType { .constructor(GTSwordItem::create) .symbol('k') .toolClasses(GTToolType.SWORD) + .materialAmount(GTValues.M) .build(); public static final GTToolType BUTCHERY_KNIFE = GTToolType.builder("butchery_knife") .toolTag(TagUtil.createItemTag("tools/butchery_knives", false)) .toolStats(b -> b.attacking().attackDamage(1.5F).attackSpeed(-1.3F) .defaultEnchantment(Enchantments.MOB_LOOTING, 3)) .constructor(GTSwordItem::create) + .materialAmount(4 * GTValues.M) .build(); // public static GTToolType GRAFTER = new GTToolType("grafter", 1, 1, GTCEu.id("item/tools/handle_hammer"), // GTCEu.id("item/tools/hammer")); @@ -426,7 +445,7 @@ public class GTToolType { public final SoundEntry soundEntry; public final boolean playSoundOnBlockDestroy; public final Character symbol; - + public final long materialAmount; public final IGTToolDefinition toolDefinition; public final ToolConstructor constructor; public final int electricTier; @@ -434,7 +453,8 @@ public class GTToolType { public GTToolType(String name, String idFormat, Character symbol, Set toolClasses, IGTToolDefinition toolDefinition, ToolConstructor constructor, List> harvestTags, List> itemTags, ResourceLocation modelLocation, Set toolClassNames, - @Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy, int electricTier) { + @Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy, int electricTier, + long materialAmount) { this.name = name; this.idFormat = idFormat; this.symbol = symbol; @@ -449,6 +469,7 @@ public GTToolType(String name, String idFormat, Character symbol, Set GTMachines.MACERATOR[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_MACERATE_STEAM, LEFT_TO_RIGHT) + .addCustomRecipeLogic(new MaceratorLogic()) .setSound(GTSoundEntries.MACERATOR); public final static GTRecipeType CANNER_RECIPES = register("canner", ELECTRIC).setMaxIOSize(2, 2, 1, 1) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java new file mode 100644 index 0000000000..5a129b8ca3 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java @@ -0,0 +1,126 @@ +package com.gregtechceu.gtceu.common.machine.trait.customlogic; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder; +import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.item.tool.GTToolType; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.common.data.GTItems; +import com.gregtechceu.gtceu.common.data.GTMaterialItems; +import com.gregtechceu.gtceu.common.data.GTMaterials; +import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.wrapper.CombinedInvWrapper; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Objects; + +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.ARC_FURNACE_RECIPES; + +public class ArcFurnaceLogic implements GTRecipeType.ICustomRecipeLogic { + + @Override + public @Nullable GTRecipe createCustomRecipe(IRecipeCapabilityHolder holder) { + var itemInputs = Objects + .requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP), + ArrayList::new) + .stream() + .filter(IItemHandlerModifiable.class::isInstance) + .map(IItemHandlerModifiable.class::cast) + .toArray(IItemHandlerModifiable[]::new); + + var inputs = new CombinedInvWrapper(itemInputs); + var stack = inputs.getStackInSlot(0); + + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + if (turbineBehaviour != null) { + float durability = 1.f - (float) turbineBehaviour.getPartDamage(stack) / + (float) turbineBehaviour.getPartMaxDurability(stack); + return applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + } + + if (stack.getItem() instanceof IGTTool tool && !tool.isElectric()) { + float durability = (float) (tool.getTotalMaxDurability(stack) - stack.getDamageValue() + 1) / + (tool.getTotalMaxDurability(stack) + 1); + return applyDurabilityRecipe("tool_decomp", stack, tool.getMaterial(), + (float) (tool.getToolType().materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + } + + return null; + } + + public @Nullable GTRecipe applyDurabilityRecipe(String id, ItemStack inputStack, @NotNull Material mat, + float fullAmount, float durability, long voltage, + int durationFactor) { + if (!mat.hasProperty(PropertyKey.INGOT)) + return null; + + var material = mat.getProperty(PropertyKey.INGOT); + var materialArc = material.getArcSmeltingInto(); + + float outputAmount = (durability * fullAmount); + int dustAmount = (int) outputAmount; + int leftover = (int) ((outputAmount - (float) dustAmount) * 9.f); + + if (dustAmount == 0 && leftover == 0) + return null; + + var builder = ARC_FURNACE_RECIPES.recipeBuilder(id + "/" + mat.getName()) + .inputItems(inputStack) + .inputFluids(GTMaterials.Oxygen.getFluid((int) (materialArc.getMass() * outputAmount) * durationFactor)) + .EUt(voltage) + .duration((int) (materialArc.getMass() * outputAmount) * durationFactor); + + if (dustAmount > 0) { + builder.outputItems(ingot, materialArc, dustAmount); + } + if (leftover > 0) { + builder.outputItems(nugget, materialArc, leftover); + } + + return builder.buildRawRecipe(); + } + + @Override + public void buildRepresentativeRecipes() { + ItemStack stack = GTItems.TURBINE_ROTOR.asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.rotor")); + GTRecipe rotorRecipe; + GTRecipe pickaxeRecipe; + float durability = 0.69f; + // noinspection ConstantConditions + TurbineRotorBehaviour.getBehaviour(stack).setPartMaterial(stack, GTMaterials.Iron); + TurbineRotorBehaviour.getBehaviour(stack).setPartDamage(stack, 8928); + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + + rotorRecipe = applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + rotorRecipe.setId(rotorRecipe.getId().withPrefix("/")); + + stack = GTMaterialItems.TOOL_ITEMS.get(GTMaterials.Iron, GTToolType.PICKAXE).asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.tool")); + stack.setDamageValue(79); + pickaxeRecipe = applyDurabilityRecipe("tool_decomp", stack, GTMaterials.Iron, + (float) (GTToolType.PICKAXE.materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + + pickaxeRecipe.setId(pickaxeRecipe.getId().withPrefix("/")); + ARC_FURNACE_RECIPES.addToMainCategory(pickaxeRecipe); + ARC_FURNACE_RECIPES.addToMainCategory(rotorRecipe); + GTRecipeType.ICustomRecipeLogic.super.buildRepresentativeRecipes(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java new file mode 100644 index 0000000000..a599517b16 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java @@ -0,0 +1,121 @@ +package com.gregtechceu.gtceu.common.machine.trait.customlogic; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder; +import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.item.tool.GTToolType; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.common.data.GTItems; +import com.gregtechceu.gtceu.common.data.GTMaterialItems; +import com.gregtechceu.gtceu.common.data.GTMaterials; +import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.wrapper.CombinedInvWrapper; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Objects; + +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.MACERATOR_RECIPES; + +public class MaceratorLogic implements GTRecipeType.ICustomRecipeLogic { + + @Override + public @Nullable GTRecipe createCustomRecipe(IRecipeCapabilityHolder holder) { + var itemInputs = Objects + .requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP), + ArrayList::new) + .stream() + .filter(IItemHandlerModifiable.class::isInstance) + .map(IItemHandlerModifiable.class::cast) + .toArray(IItemHandlerModifiable[]::new); + + var inputs = new CombinedInvWrapper(itemInputs); + var stack = inputs.getStackInSlot(0); + + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + if (turbineBehaviour != null) { + float durability = 1.f - (float) turbineBehaviour.getPartDamage(stack) / + (float) turbineBehaviour.getPartMaxDurability(stack); + return applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + } + + if (stack.getItem() instanceof IGTTool tool && !tool.isElectric()) { + float durability = (float) (tool.getTotalMaxDurability(stack) - stack.getDamageValue() + 1) / + (tool.getTotalMaxDurability(stack) + 1); + return applyDurabilityRecipe("tool_decomp", stack, tool.getMaterial(), + (float) (tool.getToolType().materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + } + + return null; + } + + public @Nullable GTRecipe applyDurabilityRecipe(String id, ItemStack inputStack, @NotNull Material mat, + float fullAmount, float durability, long voltage, + int durationFactor) { + float outputAmount = (durability * fullAmount); + int dustAmount = (int) outputAmount; + int leftover = (int) ((outputAmount - (float) dustAmount) * 36.f); + TagPrefix tag = leftover % 4 >= leftover % 9 ? dustSmall : dustTiny; + int leftAmount = leftover % 4 >= leftover % 9 ? leftover / 9 : leftover / 4; + + if (dustAmount == 0 && leftAmount == 0) + return null; + + var builder = MACERATOR_RECIPES.recipeBuilder(id + "/" + mat.getName()) + .inputItems(inputStack) + .EUt(voltage) + .duration((int) (mat.getMass() * outputAmount) * durationFactor); + + if (dustAmount > 0) { + builder.outputItems(dust, mat, dustAmount); + } + if (leftAmount > 0) { + builder.outputItems(tag, mat, leftAmount); + } + + return builder.buildRawRecipe(); + } + + @Override + public void buildRepresentativeRecipes() { + ItemStack stack = GTItems.TURBINE_ROTOR.asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.rotor")); + GTRecipe rotorRecipe; + GTRecipe pickaxeRecipe; + float durability = 0.75f; + // noinspection ConstantConditions + TurbineRotorBehaviour.getBehaviour(stack).setPartMaterial(stack, GTMaterials.Iron); + TurbineRotorBehaviour.getBehaviour(stack).setPartDamage(stack, 8928); + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + + rotorRecipe = applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + rotorRecipe.setId(rotorRecipe.getId().withPrefix("/")); + + stack = GTMaterialItems.TOOL_ITEMS.get(GTMaterials.Iron, GTToolType.PICKAXE).asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.tool")); + stack.setDamageValue(79); + pickaxeRecipe = applyDurabilityRecipe("tool_decomp", stack, GTMaterials.Iron, + (float) (GTToolType.PICKAXE.materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + + pickaxeRecipe.setId(pickaxeRecipe.getId().withPrefix("/")); + MACERATOR_RECIPES.addToMainCategory(pickaxeRecipe); + MACERATOR_RECIPES.addToMainCategory(rotorRecipe); + GTRecipeType.ICustomRecipeLogic.super.buildRepresentativeRecipes(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java index 367d156e20..4f1dff814f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java @@ -415,6 +415,10 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.scanner.copy_stick_empty", "§oEmpty Stick"); provider.add("gtceu.scanner.copy_stick_to", "§oCopy of Stick"); + // rotor/tool recipes + provider.add("gtceu.auto_decomp.rotor", "Turbine Rotor"); + provider.add("gtceu.auto_decomp.tool", "Non-electric tool"); + // HPCA Components provider.add("gtceu.machine.hpca.empty_component.tooltip", "Just for filling space"); provider.add("gtceu.machine.hpca.heat_sink_component.tooltip", "Free cooling! Is anything free?");