From 195bed9d68077d0ae9cc5b6284027725ff7b4f2e Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Wed, 21 Jan 2026 10:34:03 +0100 Subject: [PATCH 01/78] Add check to not cache invalid recipes (#4486) --- .../com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java | 4 ++++ 1 file changed, 4 insertions(+) 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 2b97ff75302..1483937c722 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 @@ -344,6 +344,10 @@ protected void handleSearchingRecipes(@NotNull Iterator matches) { if (checkMatchedRecipeAvailable(match)) return; + if (!matchRecipe(match).isSuccess()) { + continue; + } + // cache matching recipes. if (lastFailedMatches == null) { lastFailedMatches = new ArrayList<>(); From 02bfeb48bfc73640c274b6582529ca7236402d91 Mon Sep 17 00:00:00 2001 From: lilpaladin1 Date: Sat, 24 Jan 2026 08:23:15 -0600 Subject: [PATCH 02/78] Remove BlockEntity Check in MinerLogic (#4488) --- .../gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java index d9a4e62ea21..688d4a5df17 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java @@ -551,7 +551,6 @@ private LinkedList getBlocksToMine() { BlockPos blockPos = new BlockPos(x, y, z); BlockState state = level.getBlockState(blockPos); if (state.getDestroySpeed(level, blockPos) >= 0 && - level.getBlockEntity(blockPos) == null && state.is(Tags.Blocks.ORES)) { blocks.addLast(blockPos); } From 29dfe0335bc80acb2b3e5eb6500be5b558c68f68 Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Sun, 25 Jan 2026 18:18:42 +0100 Subject: [PATCH 03/78] Fix autogenerating mortar recipes (#4498) --- docs/content/Modpacks/Changes/v7.5.0.md | 3 +++ .../data/recipe/generated/ToolRecipeHandler.java | 12 +++++++++--- .../gtceu/data/recipe/misc/CustomToolRecipes.java | 15 --------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index 898852884bc..5be1593ff4b 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -23,3 +23,6 @@ You also need to adjust the generics of `getType()` and `createTemplate()` to ma ## Machine & Cover Copy/Paste System A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers. + +## Mortar Recipe Fix +Previously, adding GTToolType.MORTAR to your tool did not automatically generate the recipe. This has been fixed. If you previously generated a recipe using this, you need to remove your manual recipe. \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java index 2139209ef0b..79f2bf28a5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java @@ -25,6 +25,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.block.Blocks; import com.tterrag.registrate.util.entry.ItemEntry; import it.unimi.dsi.fastutil.ints.Int2ReferenceArrayMap; @@ -63,14 +64,19 @@ public static void run(@NotNull Consumer provider, @NotNull Mate } private static void processTool(@NotNull Consumer provider, @NotNull Material material) { + ItemStack stick = new ItemStack(Items.STICK); + MaterialEntry ingot = new MaterialEntry( + material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, material); + addToolRecipe(provider, material, GTToolType.MORTAR, false, + " I ", "SIS", "SSS", + 'I', ingot, + 'S', new ItemStack(Blocks.STONE)); + if (!material.shouldGenerateRecipesFor(plate)) { return; } - ItemStack stick = new ItemStack(Items.STICK); MaterialEntry plate = new MaterialEntry(TagPrefix.plate, material); - MaterialEntry ingot = new MaterialEntry( - material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, material); if (material.hasFlag(GENERATE_PLATE)) { addToolRecipe(provider, material, GTToolType.MINING_HAMMER, true, diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CustomToolRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CustomToolRecipes.java index 2d94a1c84ca..a5510ac10c5 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CustomToolRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CustomToolRecipes.java @@ -130,7 +130,6 @@ private static void registerPowerUnitRecipes(@NotNull Consumer p private static void registerCustomToolRecipes(@NotNull Consumer provider) { registerFlintToolRecipes(provider); - registerMortarRecipes(provider); registerSoftToolRecipes(provider); registerElectricRecipes(provider); @@ -178,20 +177,6 @@ private static void registerFlintToolRecipes(@NotNull Consumer p 'S', stick); } - private static void registerMortarRecipes(@NotNull Consumer provider) { - for (Material material : new Material[] { - GTMaterials.Bronze, GTMaterials.Iron, GTMaterials.Invar, GTMaterials.Steel, - GTMaterials.DamascusSteel, GTMaterials.CobaltBrass, GTMaterials.WroughtIron }) { - - addToolRecipe(provider, material, GTToolType.MORTAR, false, - " I ", "SIS", "SSS", - 'I', - new MaterialEntry(material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, - material), - 'S', new ItemStack(Blocks.STONE)); - } - } - private static void registerSoftToolRecipes(@NotNull Consumer provider) { final ItemStack stick = new ItemStack(Items.STICK); From 258f72b6aaa0ef95d5755fa294ac43b12b660263 Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Mon, 26 Jan 2026 16:21:08 +0100 Subject: [PATCH 04/78] Add testing mention to github template (#4503) --- .github/pull_request_template.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 34fece61126..4132c1a42cb 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,6 +9,9 @@ _Any implementations in this PR that should be carefully looked over, or that co _A short description of what this PR added/fixed/changed/removed._ _For correct linking of issues please use any of the Closes/Fixes/Resolves keywords. Example: When a PR is fixing a bug use "Fixes: #number-of-bug"_ +## How Was This Tested +_This section is for screenshots, code snippets or descriptions of how the PR was tested in code or in game to ensure correctness._ + ## Additional Information _This section is for screenshots to demonstrate any GUI or rendering changes, or any other additional information that reviewers should be aware of._ From 388e46897fddd80672e4d49b430b4a2ad96ce6c0 Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Mon, 26 Jan 2026 21:50:00 +0100 Subject: [PATCH 05/78] Replace mandatory air with any in blast chiler structure (#4502) --- .../gregtechceu/gtceu/common/data/machines/GCYMMachines.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java index 8ece01ec0cb..e793954c8f5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java @@ -923,7 +923,7 @@ public static void init() {} .pattern(definition -> FactoryBlockPattern.start() .aisle("XXXXXXX#KKK", "XXXXXXX#KVK", "XXXXXXX#KVK", "XXXXXXX#KVK", "XXXXXXX#KKK", "XXXXXXX####", "XXXXXXX####") .aisle("XXXXXXX#KVK", "XPPPPPPPPPV", "XPAPAPX#VPV", "XPPPPPPPPPV", "XPAPAPX#KVK", "XPPPPPX####", "XXXXXXX####") - .aisle("XXXXXXX#KVK", "XPAPAPXAVPV", "XAAAAAX#VPV", "XPAAAPX#VPV", "XAAAAAX#KVK", "XPAPAPX####", "XXXXXXX####") + .aisle("XXXXXXX#KVK", "XPAPAPX#VPV", "XAAAAAX#VPV", "XPAAAPX#VPV", "XAAAAAX#KVK", "XPAPAPX####", "XXXXXXX####") .aisle("XXXXXXX#KVK", "XPAPAPPPPPV", "XAAAAAX#VPV", "XPAAAPPPPPV", "XAAAAAX#KVK", "XPAPAPX####", "XXXXXXX####") .aisle("XXXXXXX#KKK", "XPPPPPX#KVK", "XPA#APX#KVK", "XPAAAPX#KVK", "XPAAAPX#KKK", "XPPPPPX####", "XXXXXXX####") .aisle("#XXXXX#####", "#XXSXX#####", "#XGGGX#####", "#XGGGX#####", "#XGGGX#####", "#XXXXX#####", "###########") From 0dfe9b9556604ee70aaad07e41fe4cbab7fdd565 Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Mon, 26 Jan 2026 21:50:16 +0100 Subject: [PATCH 06/78] Fix CME with parts and partpositions when calling getParts in addedToController (#4505) --- .../api/machine/multiblock/MultiblockControllerMachine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java index cc5535e2fbb..44a162c65a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java @@ -187,13 +187,13 @@ public void onStructureFormed() { } } this.parts.sort(getPartSorter()); + updatePartPositions(); for (var part : parts) { if (part instanceof IParallelHatch pHatch) { parallelHatch = pHatch; } part.addedToController(this); } - updatePartPositions(); } @Override From 97847f73e68b6c2b14b020fe7d8cd3f7c66b4448 Mon Sep 17 00:00:00 2001 From: Phoenixvine <82596737+Phoenixvine32908@users.noreply.github.com> Date: Tue, 27 Jan 2026 09:09:38 -0500 Subject: [PATCH 07/78] Rename method for adding tool enchantments (#4510) --- docs/content/Modpacks/Materials-and-Elements/Tool-Creation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/Modpacks/Materials-and-Elements/Tool-Creation.md b/docs/content/Modpacks/Materials-and-Elements/Tool-Creation.md index cd5a6dac2ab..55bc0cc865f 100644 --- a/docs/content/Modpacks/Materials-and-Elements/Tool-Creation.md +++ b/docs/content/Modpacks/Materials-and-Elements/Tool-Creation.md @@ -59,7 +59,7 @@ The builder has the same arguments as the constructor, and can have chained meth - `ignoreCraftingTools()` - Disable crafting tools being made from this Material. -- `addEnchantmentForTools(Enchantment enchantment, int level)` +- `.enchantment(Enchantment enchantment, int level)` - Enchantment is the default enchantment applied on tool creation. Level is the level of said enchantment. - `enchantability(int enchantability)` @@ -82,7 +82,7 @@ Here is an example of using the builder in a material: ] ) .unbreakable() - .addEnchantmentForTools(silk_touch, 1) + .enchantment(SILK_TOUCH, 1) .build() ) }); From 3f7e588f6704e09b42e27d8767fc06d46413cb35 Mon Sep 17 00:00:00 2001 From: Phoenixvine <82596737+Phoenixvine32908@users.noreply.github.com> Date: Wed, 28 Jan 2026 11:18:10 -0500 Subject: [PATCH 08/78] Lamp predicates. (#4511) Co-authored-by: Ghostipedia / Caitlynn <46772882+Ghostipedia@users.noreply.github.com> Co-authored-by: Jurre Groenendijk Co-authored-by: Gustavo <77560533+gustovafing@users.noreply.github.com> --- docs/content/Modpacks/Changes/v7.5.0.md | 7 ++++- .../gtceu/api/pattern/Predicates.java | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index 5be1593ff4b..8480fd6014d 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -25,4 +25,9 @@ You also need to adjust the generics of `getType()` and `createTemplate()` to ma A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers. ## Mortar Recipe Fix -Previously, adding GTToolType.MORTAR to your tool did not automatically generate the recipe. This has been fixed. If you previously generated a recipe using this, you need to remove your manual recipe. \ No newline at end of file +Previously, adding GTToolType.MORTAR to your tool did not automatically generate the recipe. This has been fixed. If you previously generated a recipe using this, you need to remove your manual recipe. + +## Lamp Predicates +Previously, lamps were not useable with the terminal in multiblocks. There are new lamp predicates that will help solve this problem. +The predicate to use all lamps is: `Predicates.anyLamp()` +The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java index 413a17137ee..962b35c3579 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java @@ -17,6 +17,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.block.BatteryBlock; import com.gregtechceu.gtceu.common.block.CoilBlock; +import com.gregtechceu.gtceu.common.block.LampBlock; import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; import com.gregtechceu.gtceu.common.machine.multiblock.electric.PowerSubstationMachine; import com.gregtechceu.gtceu.config.ConfigHolder; @@ -25,11 +26,13 @@ import net.minecraft.network.chat.Component; import net.minecraft.tags.TagKey; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; +import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.RegistryEntry; import org.apache.commons.lang3.ArrayUtils; @@ -38,6 +41,8 @@ import java.util.function.Supplier; import static com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties.ACTIVE; +import static com.gregtechceu.gtceu.common.data.GTBlocks.BORDERLESS_LAMPS; +import static com.gregtechceu.gtceu.common.data.GTBlocks.LAMPS; import static com.gregtechceu.gtceu.common.machine.multiblock.electric.PowerSubstationMachine.PMC_BATTERY_HEADER; public class Predicates { @@ -100,6 +105,32 @@ public static TraceabilityPredicate air() { return new TraceabilityPredicate(SimplePredicate.AIR); } + @SafeVarargs + public static TraceabilityPredicate lamps(BlockEntry... lampEntries) { + return new TraceabilityPredicate(blockWorldState -> { + BlockState state = blockWorldState.getBlockState(); + for (BlockEntry entry : lampEntries) { + if (state.is(entry.get())) return true; + } + return false; + }, () -> Arrays.stream(lampEntries) + .map(entry -> new BlockInfo(entry.get().defaultBlockState(), null)) + .toArray(BlockInfo[]::new)); + } + + public static TraceabilityPredicate anyLamp() { + List> all = new ArrayList<>(); + all.addAll(LAMPS.values()); + all.addAll(BORDERLESS_LAMPS.values()); + return lamps(all.toArray(BlockEntry[]::new)); + } + + private static final Map LAMPS_BY_COLOR = new EnumMap<>(DyeColor.class); + + public static TraceabilityPredicate lampsByColor(DyeColor color) { + return LAMPS_BY_COLOR.computeIfAbsent(color, c -> lamps(LAMPS.get(c), BORDERLESS_LAMPS.get(c))); + } + public static TraceabilityPredicate abilities(PartAbility... abilities) { return blocks(Arrays.stream(abilities).map(PartAbility::getAllBlocks).flatMap(Collection::stream) .toArray(Block[]::new)); From de443c19bba82ce68168d43a3c27272b34c065a6 Mon Sep 17 00:00:00 2001 From: remakefactory <215389873+remakefactory@users.noreply.github.com> Date: Thu, 29 Jan 2026 18:48:04 +0800 Subject: [PATCH 09/78] fix Same uuid (#4483) --- .../gtceu/api/item/armor/ArmorComponentItem.java | 4 +--- .../gtceu/api/item/armor/IArmorLogic.java | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java index 428b2a658df..5579e039564 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java @@ -28,9 +28,7 @@ import org.jetbrains.annotations.NotNullByDefault; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; import java.util.function.Consumer; @NotNullByDefault diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java index c67bb1ca296..3ae5f075c83 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java @@ -26,13 +26,13 @@ public interface IArmorLogic { - UUID ATTACK_DAMAGE_MODIFIER = UUID.fromString("648D7064-6A60-4F59-8ABE-C2C23A6DD7A9"); - UUID ATTACK_SPEED_MODIFIER = UUID.fromString("FA233E1C-4180-4288-B05C-BCCE9785ACA3"); + UUID ATTACK_DAMAGE_MODIFIER = UUID.fromString("2adb6ae9-df4d-4a45-bb07-8553dd4b6832"); + UUID ATTACK_SPEED_MODIFIER = UUID.fromString("876a7cd1-aec0-4ae5-ae3f-e951d5f1965a"); EnumMap ARMOR_MODIFIER_UUID_PER_TYPE = Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B")); - map.put(ArmorItem.Type.LEGGINGS, UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D")); - map.put(ArmorItem.Type.CHESTPLATE, UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E")); - map.put(ArmorItem.Type.HELMET, UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")); + map.put(ArmorItem.Type.BOOTS, UUID.fromString("be2b5c6e-bb5d-4675-a6be-c6c488a437f5")); + map.put(ArmorItem.Type.LEGGINGS, UUID.fromString("435c34aa-0c5b-442d-abb0-d1c984c894f9")); + map.put(ArmorItem.Type.CHESTPLATE, UUID.fromString("77d81693-63cc-4593-977d-8e0391d94a77")); + map.put(ArmorItem.Type.HELMET, UUID.fromString("cc839692-3a33-4907-a114-21fa0a18184c")); }); default void addToolComponents(ArmorComponentItem item) {} From 5ad5f7cb9fc1a9fe9c60b54b8c90cff1f87c5564 Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Thu, 29 Jan 2026 20:26:01 +0100 Subject: [PATCH 10/78] Fix invalid comparison in dimension condition (#4518) --- .../gtceu/common/recipe/condition/DimensionCondition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java index 84b2f9d86c8..d046376bdd0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java @@ -82,7 +82,7 @@ public SlotWidget setupDimensionMarkers(int xOffset, int yOffset) { @Override public boolean testCondition(@NotNull GTRecipe recipe, @NotNull RecipeLogic recipeLogic) { Level level = recipeLogic.machine.self().getLevel(); - return level != null && dimension.equals(level.dimension().location()); + return level != null && dimension.location().equals(level.dimension().location()); } @Override From f21fd8be6eda2e97555e782b5b90559a233f6ded Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Thu, 29 Jan 2026 23:05:33 +0200 Subject: [PATCH 11/78] Fix LWJGL and FastUtil sources (#4520) --- gradle/scripts/repositories.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gradle/scripts/repositories.gradle b/gradle/scripts/repositories.gradle index 0b84ea42783..d0546c95ce2 100644 --- a/gradle/scripts/repositories.gradle +++ b/gradle/scripts/repositories.gradle @@ -1,6 +1,14 @@ repositories { mavenLocal() mavenCentral() + // force gradle to download FastUtil & LWJGL from the central maven so we can get source artifacts + exclusiveContent { // Force + forRepository { mavenCentral() } + filter { + includeGroup("it.unimi.dsi") + includeGroup("org.lwjgl") + } + } maven { // JEI name = "Jared's Maven" From c04379a94b3a69891a8fc20c1764dbc63d72f9f0 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Thu, 29 Jan 2026 23:10:09 +0200 Subject: [PATCH 12/78] Fix wireless_transmitter_cover_test not working on systems where the decimal separator isn't a dot (#4521) --- .../com/gregtechceu/gtceu/common/data/GTPlaceholders.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java index 35a707c549c..78df4b96671 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java @@ -711,10 +711,11 @@ public MultiLineComponent apply(PlaceholderContext ctx, 1000000000L, "B", 1000000000000L, "T"); long max = 1; - for (Long i : suffixes.keySet()) { + for (long i : suffixes.keySet()) { if (n >= i && max < i) max = i; } - return MultiLineComponent.literal("%.2f%s".formatted(((double) n) / max, suffixes.get(max))); + return MultiLineComponent.literal(String.format(Locale.ROOT, "%.2f%s", + ((double) n) / max, suffixes.get(max))); } }); PlaceholderHandler.addPlaceholder(new Placeholder("click") { From 7b7ac4420db2050b3b06743fc79c427415b6be20 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 1 Feb 2026 00:22:48 +0200 Subject: [PATCH 13/78] Pipe model rework (#4283) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gustavo <77560533+gustovafing@users.noreply.github.com> --- docs/content/Modpacks/Changes/v7.4.0.md | 1 - docs/content/Modpacks/Changes/v7.5.0.md | 55 +- .../gtceu/blockstates/huge_duct_pipe.json | 7 + .../gtceu/blockstates/large_duct_pipe.json | 7 + .../gtceu/blockstates/normal_duct_pipe.json | 7 + .../gtceu/blockstates/normal_laser_pipe.json | 10 + .../blockstates/normal_optical_pipe.json | 10 + .../gtceu/blockstates/small_duct_pipe.json | 7 + .../gtceu/models/block/huge_duct_pipe.json | 55 ++ .../gtceu/models/block/large_duct_pipe.json | 55 ++ .../gtceu/models/block/normal_duct_pipe.json | 55 ++ .../gtceu/models/block/normal_laser_pipe.json | 55 ++ .../block/normal_laser_pipe_active.json | 55 ++ .../models/block/normal_optical_pipe.json | 55 ++ .../block/normal_optical_pipe_active.json | 55 ++ .../block/pipe/huge_duct_pipe/center.json | 47 ++ .../block/pipe/huge_duct_pipe/connection.json | 48 ++ .../block/pipe/large_duct_pipe/center.json | 47 ++ .../pipe/large_duct_pipe/connection.json | 48 ++ .../block/pipe/normal_duct_pipe/center.json | 47 ++ .../pipe/normal_duct_pipe/connection.json | 48 ++ .../block/pipe/normal_laser_pipe/center.json | 86 ++++ .../pipe/normal_laser_pipe/center_active.json | 6 + .../pipe/normal_laser_pipe/connection.json | 79 +++ .../normal_laser_pipe/connection_active.json | 6 + .../pipe/normal_optical_pipe/center.json | 86 ++++ .../normal_optical_pipe/center_active.json | 6 + .../pipe/normal_optical_pipe/connection.json | 79 +++ .../connection_active.json | 6 + .../pipe/restrictor/down/thickness_12.0.json | 33 ++ .../pipe/restrictor/down/thickness_14.0.json | 33 ++ .../pipe/restrictor/down/thickness_6.0.json | 33 ++ .../pipe/restrictor/down/thickness_8.0.json | 33 ++ .../pipe/restrictor/east/thickness_12.0.json | 33 ++ .../pipe/restrictor/east/thickness_14.0.json | 33 ++ .../pipe/restrictor/east/thickness_6.0.json | 33 ++ .../pipe/restrictor/east/thickness_8.0.json | 33 ++ .../pipe/restrictor/north/thickness_12.0.json | 33 ++ .../pipe/restrictor/north/thickness_14.0.json | 33 ++ .../pipe/restrictor/north/thickness_6.0.json | 33 ++ .../pipe/restrictor/north/thickness_8.0.json | 33 ++ .../pipe/restrictor/south/thickness_12.0.json | 33 ++ .../pipe/restrictor/south/thickness_14.0.json | 33 ++ .../pipe/restrictor/south/thickness_6.0.json | 33 ++ .../pipe/restrictor/south/thickness_8.0.json | 33 ++ .../pipe/restrictor/up/thickness_12.0.json | 33 ++ .../pipe/restrictor/up/thickness_14.0.json | 33 ++ .../pipe/restrictor/up/thickness_6.0.json | 33 ++ .../pipe/restrictor/up/thickness_8.0.json | 33 ++ .../pipe/restrictor/west/thickness_12.0.json | 33 ++ .../pipe/restrictor/west/thickness_14.0.json | 33 ++ .../pipe/restrictor/west/thickness_6.0.json | 33 ++ .../pipe/restrictor/west/thickness_8.0.json | 33 ++ .../block/pipe/small_duct_pipe/center.json | 47 ++ .../pipe/small_duct_pipe/connection.json | 48 ++ .../gtceu/models/block/small_duct_pipe.json | 55 ++ .../gtceu/models/item/huge_duct_pipe.json | 49 ++ .../gtceu/models/item/large_duct_pipe.json | 49 ++ .../gtceu/models/item/normal_duct_pipe.json | 49 ++ .../gtceu/models/item/normal_laser_pipe.json | 80 +++ .../models/item/normal_optical_pipe.json | 80 +++ .../gtceu/models/item/small_duct_pipe.json | 49 ++ .../java/com/gregtechceu/gtceu/GTCEu.java | 2 + .../gtceu/api/block/MaterialPipeBlock.java | 18 - .../gtceu/api/block/PipeBlock.java | 46 +- .../blockentity/MetaMachineBlockEntity.java | 6 +- .../gtceu/api/item/DuctPipeBlockItem.java | 30 -- .../gtceu/api/item/LampBlockItem.java | 80 ++- .../gtceu/api/item/LaserPipeBlockItem.java | 15 +- .../gtceu/api/item/MaterialPipeBlockItem.java | 13 +- .../gtceu/api/item/OpticalPipeBlockItem.java | 29 -- .../api/machine/IMachineBlockEntity.java | 5 - .../registry/registrate/GTBlockBuilder.java | 9 + .../registry/registrate/MachineBuilder.java | 7 +- .../provider/GTBlockstateProvider.java | 11 +- .../gregtechceu/gtceu/client/ClientProxy.java | 59 +++ .../gtceu/client/model/BaseBakedModel.java | 6 +- .../gtceu/client/model/GTModelProperties.java | 16 + .../model/IBlockEntityRendererBakedModel.java | 8 +- .../gtceu/client/model/PipeModel.java | 357 ------------- .../client/model/machine/MachineModel.java | 46 +- .../model/machine/MachineModelLoader.java | 2 +- .../multipart/MultiPartBakedModel.java | 15 +- .../machine/variant/MultiVariantModel.java | 4 +- .../client/model/pipe/ActivablePipeModel.java | 169 +++++++ .../client/model/pipe/BakedPipeModel.java | 152 ++++++ .../gtceu/client/model/pipe/PipeModel.java | 377 ++++++++++++++ .../client/model/pipe/PipeModelLoader.java | 62 +++ .../client/model/pipe/UnbakedPipeModel.java | 71 +++ .../gtceu/client/model/pipe/package-info.java | 7 + .../BlockEntityWithBERModelRenderer.java | 6 +- .../renderer/block/LampItemRenderer.java | 54 ++ .../client/renderer/block/LampRenderer.java | 49 -- .../renderer/block/OreBlockRenderer.java | 12 +- .../renderer/block/PipeBlockRenderer.java | 149 ------ .../gtceu/common/block/CableBlock.java | 9 +- .../gtceu/common/block/DuctPipeBlock.java | 19 +- .../gtceu/common/block/FluidPipeBlock.java | 7 +- .../gtceu/common/block/ItemPipeBlock.java | 7 +- .../gtceu/common/block/LampBlock.java | 26 +- .../gtceu/common/block/LaserPipeBlock.java | 39 +- .../gtceu/common/block/OpticalPipeBlock.java | 43 +- .../common/blockentity/CableBlockEntity.java | 4 - .../blockentity/DuctPipeBlockEntity.java | 6 +- .../blockentity/ItemPipeBlockEntity.java | 4 - .../blockentity/LaserPipeBlockEntity.java | 69 +-- .../blockentity/OpticalPipeBlockEntity.java | 39 +- .../gtceu/common/commands/GTCommands.java | 2 +- .../gtceu/common/data/GTBlockEntities.java | 8 +- .../gtceu/common/data/GTBlocks.java | 10 +- .../gtceu/common/data/models/GTModels.java | 8 + .../common/pipelike/cable/Insulation.java | 34 +- .../common/pipelike/duct/DuctPipeType.java | 7 - .../pipelike/fluidpipe/FluidPipeType.java | 30 +- .../common/pipelike/item/ItemPipeType.java | 29 +- .../core/mixins/client/ModelManagerMixin.java | 22 +- .../data/model/builder/PipeModelBuilder.java | 477 ++++++++++++++++++ .../gtceu/data/pack/GTDynamicDataPack.java | 2 +- .../data/pack/GTDynamicResourcePack.java | 116 ++--- .../event/RegisterDynamicResourcesEvent.java | 12 + .../integration/kjs/GregTechKubeJSPlugin.java | 16 - .../com/gregtechceu/gtceu/utils/GTMath.java | 67 +++ .../com/gregtechceu/gtceu/utils/GTUtil.java | 2 + ...er.java => RuntimeBlockstateProvider.java} | 20 +- .../gtceu/utils/memoization/GTMemoizer.java | 42 +- .../function/MemoizedBiFunction.java | 11 + .../function/MemoizedFunction.java | 9 + .../function/MemoizedTriFunction.java | 11 + .../textures/block/pipe/pipe_optical_side.png | Bin 280 -> 298 bytes .../block/pipe/pipe_optical_side_overlay.png | Bin 0 -> 113 bytes .../pipe/pipe_optical_side_overlay_active.png | Bin 0 -> 197 bytes ...ipe_optical_side_overlay_active.png.mcmeta | 5 + 132 files changed, 4422 insertions(+), 1108 deletions(-) create mode 100644 src/generated/resources/assets/gtceu/blockstates/huge_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/blockstates/large_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/blockstates/normal_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/blockstates/normal_laser_pipe.json create mode 100644 src/generated/resources/assets/gtceu/blockstates/normal_optical_pipe.json create mode 100644 src/generated/resources/assets/gtceu/blockstates/small_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/block/huge_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/block/large_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/block/normal_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/block/normal_laser_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/block/normal_laser_pipe_active.json create mode 100644 src/generated/resources/assets/gtceu/models/block/normal_optical_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/block/normal_optical_pipe_active.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_12.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_14.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_6.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_8.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_12.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_14.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_6.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_8.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_12.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_14.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_6.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_8.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_12.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_14.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_6.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_8.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_12.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_14.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_6.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_8.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_12.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_14.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_6.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_8.0.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json create mode 100644 src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json create mode 100644 src/generated/resources/assets/gtceu/models/block/small_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/item/huge_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/item/large_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/item/normal_duct_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/item/normal_laser_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/item/normal_optical_pipe.json create mode 100644 src/generated/resources/assets/gtceu/models/item/small_duct_pipe.json delete mode 100644 src/main/java/com/gregtechceu/gtceu/api/item/DuctPipeBlockItem.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModelLoader.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/pipe/UnbakedPipeModel.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/model/pipe/package-info.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampRenderer.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/pack/event/RegisterDynamicResourcesEvent.java rename src/main/java/com/gregtechceu/gtceu/utils/data/{RuntimeBlockStateProvider.java => RuntimeBlockstateProvider.java} (64%) create mode 100644 src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedBiFunction.java create mode 100644 src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedFunction.java create mode 100644 src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedTriFunction.java create mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay.png create mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png create mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png.mcmeta diff --git a/docs/content/Modpacks/Changes/v7.4.0.md b/docs/content/Modpacks/Changes/v7.4.0.md index 766793617d0..b12d7e98444 100644 --- a/docs/content/Modpacks/Changes/v7.4.0.md +++ b/docs/content/Modpacks/Changes/v7.4.0.md @@ -24,4 +24,3 @@ to `roll(RecipeCapability cap, List chancedEntries, ChanceBoostFunction boostFunction, int recipeTier, int chanceTier, Object2IntMap cache, int times)` (The chance roll function now also requires the RecipeCapability that is currently being processed to be passed in.) - diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index 8480fd6014d..efe36c8eadb 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -4,9 +4,11 @@ title: "Version 7.5.0" # Updating from `7.4.1` to `7.5.0` +## Machine Builder Generics +We have added a second Generic argument to our (Multiblock)MachineBuilder. This effectively means that anywhere where you used to store a partially finished `MachineBuilder`, you now need to store a `MachineBuilder`. The same holds for `MultiblockMachineBuilder`. -## MachineBuilder Generics -We have added a second Generic argument to our (Multiblock)MachineBuilder. This effectively means that anywhere where you used to store a partially finished `MachineBuilder`, you now need to store a `MachineBuilder`. The same holds for `MultiblockMachineBuilder`. +## Machine & Cover Copy/Paste System +A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers. ## RecipeCondition Generics We have added a Generic argument to `RecipeCondition` describing the condition. @@ -20,14 +22,53 @@ You also need to adjust the generics of `getType()` and `createTemplate()` to ma - public RecipeCondition createTemplate() { + public ExampleCondition createTemplate() { ``` - -## Machine & Cover Copy/Paste System -A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers. - ## Mortar Recipe Fix Previously, adding GTToolType.MORTAR to your tool did not automatically generate the recipe. This has been fixed. If you previously generated a recipe using this, you need to remove your manual recipe. +## Pipe rendering changes +_This is only relevant to add-on mods with custom pipe types._ +Addons with custom pipe implementations will have to tweak their code slightly to function with the new rendering code (see example below). + +```patch +-public final PipeModel model = new PipeModel(pipeType.getThickness(), () -> [side texture], () -> [end texture], null, null); +-@Getter +-private final PipeBlockRenderer renderer = new PipeBlockRenderer(model); + + ... + + @Override +-public PipeModel getPipeModel() { +- return model; ++public PipeModel createPipeModel(GTBlockstateProvider provider) { ++ return new PipeModel(this, pipeType.getThickness(), [side texture], [end texture], provider); + } +``` +If your pipe is generated from a material property (or equivalent), you should also call `PipeModel#dynamicModel()` +to have models be generated at runtime. +If so, must also add a **Mod bus** event listener for `RegisterDynamicResourcesEvent`, like so: +```java +@SubscribeEvent +public static void registerDynamicResources(RegisterDynamicResourcesEvent event) { + for (var block : MyBlocks.MY_PIPE_BLOCKS) block.get().createPipeModel(RuntimeExistingFileHelper.INSTANCE).dynamicModel(); +} +``` +Replace `MyBlocks.MY_PIPE_BLOCKS` with a reference to your pipe block array/map value collection. + + +Conversely, if the pipe is **not** generated, but has a constant set of variants (such as optical fiber cables or laser pipes), +you should **NOT** use `PipeModel#dynamicModel()` and instead set the model with `GTBlockBuilder#gtBlockstate` as such: +```java + // on your pipe block builder + ... = REGISTRATE.block(...) + .properties(...) + .gtBlockstate(GTModels::createPipeBlockModel) + ...more builder things... + .item(...) + .model(NonNullBiConsumer.noop()) + ...more builder things... +``` + ## Lamp Predicates Previously, lamps were not useable with the terminal in multiblocks. There are new lamp predicates that will help solve this problem. The predicate to use all lamps is: `Predicates.anyLamp()` -The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. \ No newline at end of file +The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. diff --git a/src/generated/resources/assets/gtceu/blockstates/huge_duct_pipe.json b/src/generated/resources/assets/gtceu/blockstates/huge_duct_pipe.json new file mode 100644 index 00000000000..583340f5ea7 --- /dev/null +++ b/src/generated/resources/assets/gtceu/blockstates/huge_duct_pipe.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "gtceu:block/huge_duct_pipe" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/blockstates/large_duct_pipe.json b/src/generated/resources/assets/gtceu/blockstates/large_duct_pipe.json new file mode 100644 index 00000000000..8ddcee59f5a --- /dev/null +++ b/src/generated/resources/assets/gtceu/blockstates/large_duct_pipe.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "gtceu:block/large_duct_pipe" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/blockstates/normal_duct_pipe.json b/src/generated/resources/assets/gtceu/blockstates/normal_duct_pipe.json new file mode 100644 index 00000000000..c12030e7f2f --- /dev/null +++ b/src/generated/resources/assets/gtceu/blockstates/normal_duct_pipe.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "gtceu:block/normal_duct_pipe" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/blockstates/normal_laser_pipe.json b/src/generated/resources/assets/gtceu/blockstates/normal_laser_pipe.json new file mode 100644 index 00000000000..7b77d7b3adb --- /dev/null +++ b/src/generated/resources/assets/gtceu/blockstates/normal_laser_pipe.json @@ -0,0 +1,10 @@ +{ + "variants": { + "active=false": { + "model": "gtceu:block/normal_laser_pipe" + }, + "active=true": { + "model": "gtceu:block/normal_laser_pipe_active" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/blockstates/normal_optical_pipe.json b/src/generated/resources/assets/gtceu/blockstates/normal_optical_pipe.json new file mode 100644 index 00000000000..dcda4258ec6 --- /dev/null +++ b/src/generated/resources/assets/gtceu/blockstates/normal_optical_pipe.json @@ -0,0 +1,10 @@ +{ + "variants": { + "active=false": { + "model": "gtceu:block/normal_optical_pipe" + }, + "active=true": { + "model": "gtceu:block/normal_optical_pipe_active" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/blockstates/small_duct_pipe.json b/src/generated/resources/assets/gtceu/blockstates/small_duct_pipe.json new file mode 100644 index 00000000000..146f5c42cfb --- /dev/null +++ b/src/generated/resources/assets/gtceu/blockstates/small_duct_pipe.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "gtceu:block/small_duct_pipe" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/huge_duct_pipe.json b/src/generated/resources/assets/gtceu/models/block/huge_duct_pipe.json new file mode 100644 index 00000000000..e737cf69235 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/huge_duct_pipe.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/huge_duct_pipe/center", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/huge_duct_pipe/center" + }, + "down": { + "model": "gtceu:block/pipe/huge_duct_pipe/connection" + }, + "east": { + "model": "gtceu:block/pipe/huge_duct_pipe/connection", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/huge_duct_pipe/connection", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/huge_duct_pipe/connection", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/huge_duct_pipe/connection", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/huge_duct_pipe/connection", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_14.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_14.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_14.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_14.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_14.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_14.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/large_duct_pipe.json b/src/generated/resources/assets/gtceu/models/block/large_duct_pipe.json new file mode 100644 index 00000000000..a988ebb1438 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/large_duct_pipe.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/large_duct_pipe/center", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/large_duct_pipe/center" + }, + "down": { + "model": "gtceu:block/pipe/large_duct_pipe/connection" + }, + "east": { + "model": "gtceu:block/pipe/large_duct_pipe/connection", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/large_duct_pipe/connection", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/large_duct_pipe/connection", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/large_duct_pipe/connection", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/large_duct_pipe/connection", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_12.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_12.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_12.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_12.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_12.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_12.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/normal_duct_pipe.json b/src/generated/resources/assets/gtceu/models/block/normal_duct_pipe.json new file mode 100644 index 00000000000..c17c8d7154b --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/normal_duct_pipe.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/normal_duct_pipe/center", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/normal_duct_pipe/center" + }, + "down": { + "model": "gtceu:block/pipe/normal_duct_pipe/connection" + }, + "east": { + "model": "gtceu:block/pipe/normal_duct_pipe/connection", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/normal_duct_pipe/connection", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/normal_duct_pipe/connection", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/normal_duct_pipe/connection", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/normal_duct_pipe/connection", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_8.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_8.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_8.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_8.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_8.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_8.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/normal_laser_pipe.json b/src/generated/resources/assets/gtceu/models/block/normal_laser_pipe.json new file mode 100644 index 00000000000..164e2ac6fe6 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/normal_laser_pipe.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/normal_laser_pipe/center", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/normal_laser_pipe/center" + }, + "down": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection" + }, + "east": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_6.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_6.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_6.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_6.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_6.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_6.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/normal_laser_pipe_active.json b/src/generated/resources/assets/gtceu/models/block/normal_laser_pipe_active.json new file mode 100644 index 00000000000..ac6d70b010c --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/normal_laser_pipe_active.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/normal_laser_pipe/center_active", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/normal_laser_pipe/center_active" + }, + "down": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection_active" + }, + "east": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection_active", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection_active", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection_active", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection_active", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/normal_laser_pipe/connection_active", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_6.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_6.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_6.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_6.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_6.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_6.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/normal_optical_pipe.json b/src/generated/resources/assets/gtceu/models/block/normal_optical_pipe.json new file mode 100644 index 00000000000..e03e782ac34 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/normal_optical_pipe.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/normal_optical_pipe/center", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/normal_optical_pipe/center" + }, + "down": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection" + }, + "east": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_6.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_6.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_6.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_6.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_6.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_6.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/normal_optical_pipe_active.json b/src/generated/resources/assets/gtceu/models/block/normal_optical_pipe_active.json new file mode 100644 index 00000000000..2a727149bb7 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/normal_optical_pipe_active.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/normal_optical_pipe/center_active", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/normal_optical_pipe/center_active" + }, + "down": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection_active" + }, + "east": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection_active", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection_active", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection_active", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection_active", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/normal_optical_pipe/connection_active", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_6.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_6.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_6.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_6.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_6.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_6.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json new file mode 100644 index 00000000000..6318ac6c5b3 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json @@ -0,0 +1,47 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 1, + 1, + 1 + ], + "to": [ + 15, + 15, + 15 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json new file mode 100644 index 00000000000..b5f34317735 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json @@ -0,0 +1,48 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 1, + 0, + 1 + ], + "to": [ + 15, + 1, + 15 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json new file mode 100644 index 00000000000..26aeac6acf3 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json @@ -0,0 +1,47 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 2, + 2, + 2 + ], + "to": [ + 14, + 14, + 14 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json new file mode 100644 index 00000000000..e5504c54c2b --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json @@ -0,0 +1,48 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 2, + 0, + 2 + ], + "to": [ + 14, + 2, + 14 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json new file mode 100644 index 00000000000..55bac017a34 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json @@ -0,0 +1,47 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 4, + 4, + 4 + ], + "to": [ + 12, + 12, + 12 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json new file mode 100644 index 00000000000..c004f0de717 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json @@ -0,0 +1,48 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 4, + 0, + 4 + ], + "to": [ + 12, + 4, + 12 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json new file mode 100644 index 00000000000..0cc3032c0e5 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json @@ -0,0 +1,86 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 5 + ], + "to": [ + 11, + 11, + 11 + ] + }, + { + "faces": { + "down": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "east": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "up": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + 4.998, + 4.998 + ], + "to": [ + 11.002, + 11.002, + 11.002 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_laser_in", + "side": "gtceu:block/pipe/pipe_laser_side", + "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json new file mode 100644 index 00000000000..18781c339d2 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json @@ -0,0 +1,6 @@ +{ + "parent": "gtceu:block/pipe/normal_laser_pipe/center", + "textures": { + "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay_emissive" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json new file mode 100644 index 00000000000..7dc25d11fdd --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json @@ -0,0 +1,79 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 0, + 5 + ], + "to": [ + 11, + 5, + 11 + ] + }, + { + "faces": { + "east": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + -0.002, + 4.998 + ], + "to": [ + 11.002, + 5.002, + 11.002 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_laser_in", + "side": "gtceu:block/pipe/pipe_laser_side", + "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json new file mode 100644 index 00000000000..a9170249dab --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json @@ -0,0 +1,6 @@ +{ + "parent": "gtceu:block/pipe/normal_laser_pipe/connection", + "textures": { + "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay_emissive" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json new file mode 100644 index 00000000000..c5356268055 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json @@ -0,0 +1,86 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 5 + ], + "to": [ + 11, + 11, + 11 + ] + }, + { + "faces": { + "down": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "east": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "up": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + 4.998, + 4.998 + ], + "to": [ + 11.002, + 11.002, + 11.002 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_optical_in", + "side": "gtceu:block/pipe/pipe_optical_side", + "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json new file mode 100644 index 00000000000..ac513d036e5 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json @@ -0,0 +1,6 @@ +{ + "parent": "gtceu:block/pipe/normal_optical_pipe/center", + "textures": { + "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay_active" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json new file mode 100644 index 00000000000..b7ee34bd7f4 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json @@ -0,0 +1,79 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 0, + 5 + ], + "to": [ + 11, + 5, + 11 + ] + }, + { + "faces": { + "east": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + -0.002, + 4.998 + ], + "to": [ + 11.002, + 5.002, + 11.002 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_optical_in", + "side": "gtceu:block/pipe/pipe_optical_side", + "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json new file mode 100644 index 00000000000..224c446f985 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json @@ -0,0 +1,6 @@ +{ + "parent": "gtceu:block/pipe/normal_optical_pipe/connection", + "textures": { + "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay_active" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_12.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_12.0.json new file mode 100644 index 00000000000..5b9c48b1c26 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_12.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 1.997, + 0, + 1.997 + ], + "to": [ + 14.002999, + 1.997, + 14.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_14.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_14.0.json new file mode 100644 index 00000000000..416426ed097 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_14.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 0.997, + 0, + 0.997 + ], + "to": [ + 15.002999, + 0.997, + 15.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_6.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_6.0.json new file mode 100644 index 00000000000..f4b1b636e25 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_6.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 4.997, + 0, + 4.997 + ], + "to": [ + 11.002999, + 4.997, + 11.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_8.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_8.0.json new file mode 100644 index 00000000000..a3d058279fb --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/down/thickness_8.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 3.997, + 0, + 3.997 + ], + "to": [ + 12.002999, + 3.997, + 12.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_12.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_12.0.json new file mode 100644 index 00000000000..2da815fb976 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_12.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 14.002999, + 1.997, + 1.997 + ], + "to": [ + 16, + 14.002999, + 14.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_14.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_14.0.json new file mode 100644 index 00000000000..37f0d67af2b --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_14.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 15.002999, + 0.997, + 0.997 + ], + "to": [ + 16, + 15.002999, + 15.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_6.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_6.0.json new file mode 100644 index 00000000000..ec6b20399be --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_6.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 11.002999, + 4.997, + 4.997 + ], + "to": [ + 16, + 11.002999, + 11.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_8.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_8.0.json new file mode 100644 index 00000000000..1d959d45a40 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/east/thickness_8.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 12.002999, + 3.997, + 3.997 + ], + "to": [ + 16, + 12.002999, + 12.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_12.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_12.0.json new file mode 100644 index 00000000000..8868df86dae --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_12.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 1.997, + 1.997, + 0 + ], + "to": [ + 14.002999, + 14.002999, + 1.997 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_14.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_14.0.json new file mode 100644 index 00000000000..4cd0913b8d2 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_14.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 0.997, + 0.997, + 0 + ], + "to": [ + 15.002999, + 15.002999, + 0.997 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_6.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_6.0.json new file mode 100644 index 00000000000..c3e00fbaf0b --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_6.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 4.997, + 4.997, + 0 + ], + "to": [ + 11.002999, + 11.002999, + 4.997 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_8.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_8.0.json new file mode 100644 index 00000000000..5b9a9154025 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/north/thickness_8.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 3.997, + 3.997, + 0 + ], + "to": [ + 12.002999, + 12.002999, + 3.997 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_12.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_12.0.json new file mode 100644 index 00000000000..cbdb82d87be --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_12.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 1.997, + 1.997, + 14.002999 + ], + "to": [ + 14.002999, + 14.002999, + 16 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_14.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_14.0.json new file mode 100644 index 00000000000..83a2616c294 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_14.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 0.997, + 0.997, + 15.002999 + ], + "to": [ + 15.002999, + 15.002999, + 16 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_6.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_6.0.json new file mode 100644 index 00000000000..eaa3a5d4466 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_6.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 4.997, + 4.997, + 11.002999 + ], + "to": [ + 11.002999, + 11.002999, + 16 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_8.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_8.0.json new file mode 100644 index 00000000000..4c807280980 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/south/thickness_8.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "east": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 3.997, + 3.997, + 12.002999 + ], + "to": [ + 12.002999, + 12.002999, + 16 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_12.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_12.0.json new file mode 100644 index 00000000000..258ac3ed5c5 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_12.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 1.997, + 14.002999, + 1.997 + ], + "to": [ + 14.002999, + 16, + 14.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_14.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_14.0.json new file mode 100644 index 00000000000..8b6bee1a4e7 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_14.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 0.997, + 15.002999, + 0.997 + ], + "to": [ + 15.002999, + 16, + 15.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_6.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_6.0.json new file mode 100644 index 00000000000..4d07bcf8535 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_6.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 4.997, + 11.002999, + 4.997 + ], + "to": [ + 11.002999, + 16, + 11.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_8.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_8.0.json new file mode 100644 index 00000000000..9269e828d47 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/up/thickness_8.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "east": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "west": { + "texture": "#restrictor" + } + }, + "from": [ + 3.997, + 12.002999, + 3.997 + ], + "to": [ + 12.002999, + 16, + 12.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_12.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_12.0.json new file mode 100644 index 00000000000..84b76eea7fa --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_12.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 0, + 1.997, + 1.997 + ], + "to": [ + 1.997, + 14.002999, + 14.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_14.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_14.0.json new file mode 100644 index 00000000000..b0d3d796931 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_14.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 0, + 0.997, + 0.997 + ], + "to": [ + 0.997, + 15.002999, + 15.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_6.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_6.0.json new file mode 100644 index 00000000000..61dcdbf9677 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_6.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 0, + 4.997, + 4.997 + ], + "to": [ + 4.997, + 11.002999, + 11.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_8.0.json b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_8.0.json new file mode 100644 index 00000000000..cca985d934d --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/restrictor/west/thickness_8.0.json @@ -0,0 +1,33 @@ +{ + "elements": [ + { + "faces": { + "down": { + "texture": "#restrictor" + }, + "north": { + "texture": "#restrictor" + }, + "south": { + "texture": "#restrictor" + }, + "up": { + "texture": "#restrictor" + } + }, + "from": [ + 0, + 3.997, + 3.997 + ], + "to": [ + 3.997, + 12.002999, + 12.002999 + ] + } + ], + "textures": { + "restrictor": "gtceu:block/pipe/blocked/pipe_blocked" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json new file mode 100644 index 00000000000..98a31bc47ef --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json @@ -0,0 +1,47 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 5 + ], + "to": [ + 11, + 11, + 11 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json new file mode 100644 index 00000000000..569180a1fba --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json @@ -0,0 +1,48 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 0, + 5 + ], + "to": [ + 11, + 5, + 11 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/small_duct_pipe.json b/src/generated/resources/assets/gtceu/models/block/small_duct_pipe.json new file mode 100644 index 00000000000..bf4e30317f4 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/block/small_duct_pipe.json @@ -0,0 +1,55 @@ +{ + "parent": "gtceu:block/pipe/small_duct_pipe/center", + "loader": "gtceu:pipe", + "parts": { + "center": { + "model": "gtceu:block/pipe/small_duct_pipe/center" + }, + "down": { + "model": "gtceu:block/pipe/small_duct_pipe/connection" + }, + "east": { + "model": "gtceu:block/pipe/small_duct_pipe/connection", + "x": 90, + "y": 270 + }, + "north": { + "model": "gtceu:block/pipe/small_duct_pipe/connection", + "x": 90, + "y": 180 + }, + "south": { + "model": "gtceu:block/pipe/small_duct_pipe/connection", + "x": 90 + }, + "up": { + "model": "gtceu:block/pipe/small_duct_pipe/connection", + "x": 180 + }, + "west": { + "model": "gtceu:block/pipe/small_duct_pipe/connection", + "x": 90, + "y": 90 + } + }, + "restrictors": { + "down": { + "model": "gtceu:block/pipe/restrictor/down/thickness_6.0" + }, + "east": { + "model": "gtceu:block/pipe/restrictor/east/thickness_6.0" + }, + "north": { + "model": "gtceu:block/pipe/restrictor/north/thickness_6.0" + }, + "south": { + "model": "gtceu:block/pipe/restrictor/south/thickness_6.0" + }, + "up": { + "model": "gtceu:block/pipe/restrictor/up/thickness_6.0" + }, + "west": { + "model": "gtceu:block/pipe/restrictor/west/thickness_6.0" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/huge_duct_pipe.json b/src/generated/resources/assets/gtceu/models/item/huge_duct_pipe.json new file mode 100644 index 00000000000..6446bb669a9 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/huge_duct_pipe.json @@ -0,0 +1,49 @@ +{ + "parent": "gtceu:block/pipe/huge_duct_pipe/center", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#end", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#end", + "tintindex": 1 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 1, + 1, + 0 + ], + "to": [ + 15, + 15, + 16 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/large_duct_pipe.json b/src/generated/resources/assets/gtceu/models/item/large_duct_pipe.json new file mode 100644 index 00000000000..8ce685ee51f --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/large_duct_pipe.json @@ -0,0 +1,49 @@ +{ + "parent": "gtceu:block/pipe/large_duct_pipe/center", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#end", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#end", + "tintindex": 1 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 2, + 2, + 0 + ], + "to": [ + 14, + 14, + 16 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/normal_duct_pipe.json b/src/generated/resources/assets/gtceu/models/item/normal_duct_pipe.json new file mode 100644 index 00000000000..3b362236c0f --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/normal_duct_pipe.json @@ -0,0 +1,49 @@ +{ + "parent": "gtceu:block/pipe/normal_duct_pipe/center", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#end", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#end", + "tintindex": 1 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 4, + 4, + 0 + ], + "to": [ + 12, + 12, + 16 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/normal_laser_pipe.json b/src/generated/resources/assets/gtceu/models/item/normal_laser_pipe.json new file mode 100644 index 00000000000..112eb3bf581 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/normal_laser_pipe.json @@ -0,0 +1,80 @@ +{ + "parent": "gtceu:block/pipe/normal_laser_pipe/center", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#end", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#end", + "tintindex": 1 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 0 + ], + "to": [ + 11, + 11, + 16 + ] + }, + { + "faces": { + "down": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "east": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "up": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + 4.998, + -0.002 + ], + "to": [ + 11.002, + 11.002, + 16.002 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_laser_in", + "side": "gtceu:block/pipe/pipe_laser_side", + "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/normal_optical_pipe.json b/src/generated/resources/assets/gtceu/models/item/normal_optical_pipe.json new file mode 100644 index 00000000000..d57881dac07 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/normal_optical_pipe.json @@ -0,0 +1,80 @@ +{ + "parent": "gtceu:block/pipe/normal_optical_pipe/center", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#end", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#end", + "tintindex": 1 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 0 + ], + "to": [ + 11, + 11, + 16 + ] + }, + { + "faces": { + "down": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "east": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "up": { + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + 4.998, + -0.002 + ], + "to": [ + 11.002, + 11.002, + 16.002 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_optical_in", + "side": "gtceu:block/pipe/pipe_optical_side", + "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/small_duct_pipe.json b/src/generated/resources/assets/gtceu/models/item/small_duct_pipe.json new file mode 100644 index 00000000000..52c2a00a7ee --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/small_duct_pipe.json @@ -0,0 +1,49 @@ +{ + "parent": "gtceu:block/pipe/small_duct_pipe/center", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#end", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#end", + "tintindex": 1 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 0 + ], + "to": [ + 11, + 11, + 16 + ] + } + ], + "textures": { + "end": "gtceu:block/pipe/pipe_duct_in", + "side": "gtceu:block/pipe/pipe_duct_side" + } +} \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/GTCEu.java b/src/main/java/com/gregtechceu/gtceu/GTCEu.java index fee2fc2b308..e7b1de43d39 100644 --- a/src/main/java/com/gregtechceu/gtceu/GTCEu.java +++ b/src/main/java/com/gregtechceu/gtceu/GTCEu.java @@ -32,6 +32,8 @@ public class GTCEu { public static final String NAME = "GregTechCEu"; public static final Logger LOGGER = LogManager.getLogger(NAME); + public static final Path GTCEU_FOLDER = getGameDir().resolve("gtceu"); + public GTCEu() { GTCEu.init(); GTCEuAPI.instance = this; diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java index 07d640a090f..e47f1e862ec 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java @@ -3,8 +3,6 @@ import com.gregtechceu.gtceu.api.blockentity.IPaintable; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.pipenet.*; -import com.gregtechceu.gtceu.client.model.PipeModel; -import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; @@ -28,14 +26,10 @@ public abstract class MaterialPipeBlock< extends PipeBlock { public final Material material; - public final PipeBlockRenderer renderer; - public final PipeModel model; public MaterialPipeBlock(Properties properties, PipeType pipeType, Material material) { super(properties, pipeType); this.material = material; - this.model = createPipeModel(); - this.renderer = new PipeBlockRenderer(this.model); } @OnlyIn(Dist.CLIENT) @@ -57,11 +51,6 @@ public int tinted(BlockState blockState, @Nullable BlockAndTintGetter level, @Nu return index == 0 || index == 1 ? material.getMaterialRGB() : -1; } - @Override - protected PipeModel getPipeModel() { - return model; - } - @Override public final NodeDataType createRawData(BlockState pState, @Nullable ItemStack pStack) { return createMaterialData(); @@ -80,11 +69,6 @@ public NodeDataType createProperties(IPipeNode pipeTile) protected abstract NodeDataType createProperties(PipeType pipeType, Material material); - @Override - public @Nullable PipeBlockRenderer getRenderer(BlockState state) { - return renderer; - } - @Override public final NodeDataType getFallbackType() { return createMaterialData(); @@ -92,8 +76,6 @@ public final NodeDataType getFallbackType() { protected abstract NodeDataType createMaterialData(); - protected abstract PipeModel createPipeModel(); - @Override public String getDescriptionId() { return pipeType.getTagPrefix().getUnlocalizedName(material); diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java index c4079b9f324..a77fbb5cc62 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java @@ -13,17 +13,16 @@ import com.gregtechceu.gtceu.api.pipenet.IPipeType; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; import com.gregtechceu.gtceu.api.pipenet.PipeNet; -import com.gregtechceu.gtceu.client.model.PipeModel; -import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; import com.gregtechceu.gtceu.common.item.CoverPlaceBehavior; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; +import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -62,10 +61,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.joml.Vector3f; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.util.*; import javax.annotation.ParametersAreNonnullByDefault; @@ -74,19 +72,32 @@ @MethodsReturnNonnullByDefault public abstract class PipeBlock & IPipeType, NodeDataType, WorldPipeNetType extends LevelPipeNet>> extends Block - implements EntityBlock, IBlockRendererProvider, SimpleWaterloggedBlock { + implements EntityBlock, SimpleWaterloggedBlock { public final PipeType pipeType; + protected final Map shapes = new IdentityHashMap<>(); + public PipeBlock(Properties properties, PipeType pipeType) { super(properties); this.pipeType = pipeType; registerDefaultState(defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, false)); + + float min = (16 - pipeType.getThickness() * 16) / 2f; + float max = min + pipeType.getThickness() * 16; + shapes.put(null, Block.box(min, min, min, max, max, max)); + for (Direction dir : GTUtil.DIRECTIONS) { + var coords = GTMath.getCoordinates(dir, min, max); + Vector3f minCoord = coords.getLeft(); + Vector3f maxCoord = coords.getRight(); + shapes.put(dir, Block.box(minCoord.x, minCoord.y, minCoord.z, maxCoord.x, maxCoord.y, maxCoord.z)); + } } @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { - super.createBlockStateDefinition(builder.add(BlockStateProperties.WATERLOGGED)); + super.createBlockStateDefinition(builder); + builder.add(BlockStateProperties.WATERLOGGED); } @Override @@ -129,11 +140,7 @@ public NodeDataType createProperties(BlockState state, @Nullable ItemStack stack */ public abstract NodeDataType getFallbackType(); - @Nullable - @Override - public abstract PipeBlockRenderer getRenderer(BlockState state); - - protected abstract PipeModel getPipeModel(); + public abstract PipeModel createPipeModel(GTBlockstateProvider provider); public void updateActiveNodeStatus(@NotNull Level worldIn, BlockPos pos, IPipeNode pipeTile) { @@ -400,7 +407,7 @@ public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, return Shapes.block(); } connections = pipeNode.getVisualConnections(); - VoxelShape shape = getPipeModel().getShapes(connections); + VoxelShape shape = getShapes(connections); shape = Shapes.or(shape, pipeNode.getCoverContainer().addCoverCollisionBoundingBox()); if (context instanceof EntityCollisionContext entityCtx && entityCtx.getEntity() instanceof Player player) { @@ -424,7 +431,7 @@ public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, } return shape; } - return getPipeModel().getShapes(connections); + return getShapes(connections); } @Nullable @@ -475,4 +482,11 @@ public List getDrops(BlockState state, LootParams.Builder builder) { public GTToolType getPipeTuneTool() { return GTToolType.WRENCH; } + + public VoxelShape getShapes(int connections) { + return this.shapes.entrySet().stream() + .filter(entry -> entry.getKey() == null || PipeBlockEntity.isConnected(connections, entry.getKey())) + .map(Map.Entry::getValue) + .reduce(Shapes.empty(), Shapes::or); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index db0589bd9c4..380debf6782 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -314,9 +314,9 @@ public AABB getRenderBoundingBox() { BlockRenderDispatcher blockRenderDispatcher = Minecraft.getInstance().getBlockRenderer(); BakedModel model = blockRenderDispatcher.getBlockModel(this.getBlockState()); - if (model instanceof IBlockEntityRendererBakedModel modelWithBER) { - if (modelWithBER.getBlockEntityType() == this.getType()) { - return ((IBlockEntityRendererBakedModel) modelWithBER) + if (model instanceof IBlockEntityRendererBakedModel berModel) { + if (berModel.getBlockEntityType() != null && berModel.getBlockEntityType() == this.getType()) { + return ((IBlockEntityRendererBakedModel) berModel) .getRenderBoundingBox(this); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/DuctPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/DuctPipeBlockItem.java deleted file mode 100644 index 5563d6a4097..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/item/DuctPipeBlockItem.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.gregtechceu.gtceu.api.item; - -import com.gregtechceu.gtceu.common.block.DuctPipeBlock; - -import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.lowdragmc.lowdraglib.client.renderer.IRenderer; - -import net.minecraft.world.item.ItemStack; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class DuctPipeBlockItem extends PipeBlockItem implements IItemRendererProvider { - - public DuctPipeBlockItem(DuctPipeBlock block, Properties properties) { - super(block, properties); - } - - @Override - @NotNull - public DuctPipeBlock getBlock() { - return (DuctPipeBlock) super.getBlock(); - } - - @Nullable - @Override - public IRenderer getRenderer(ItemStack stack) { - return getBlock().getRenderer(getBlock().defaultBlockState()); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java index f56af127f4a..d07587b9b57 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java @@ -1,20 +1,29 @@ package com.gregtechceu.gtceu.api.item; +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.client.renderer.block.LampItemRenderer; +import com.gregtechceu.gtceu.client.util.ModelUtils; import com.gregtechceu.gtceu.common.block.LampBlock; -import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.lowdragmc.lowdraglib.client.renderer.IRenderer; - +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import net.minecraftforge.client.model.BakedModelWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.function.Consumer; + import javax.annotation.ParametersAreNonnullByDefault; import static com.gregtechceu.gtceu.common.block.LampBlock.isBloomEnabled; @@ -22,10 +31,14 @@ import static com.gregtechceu.gtceu.common.block.LampBlock.isLightEnabled; @ParametersAreNonnullByDefault -public class LampBlockItem extends BlockItem implements IItemRendererProvider { +public class LampBlockItem extends BlockItem { public LampBlockItem(LampBlock block, Properties properties) { super(block, properties); + + if (GTCEu.isClientSide()) { + ClientCallWrapper.registerEventListener(this); + } } @NotNull @@ -37,16 +50,19 @@ public LampBlock getBlock() { @Nullable @Override protected BlockState getPlacementState(BlockPlaceContext context) { - BlockState returnValue = super.getPlacementState(context); - ItemStack handItem = context.getItemInHand(); - if (returnValue != null && handItem.hasTag()) { - var tag = handItem.getTag(); - returnValue = returnValue - .setValue(LampBlock.INVERTED, isInverted(tag)) - .setValue(LampBlock.BLOOM, isBloomEnabled(tag)) - .setValue(LampBlock.LIGHT, isLightEnabled(tag)); + BlockState state = super.getPlacementState(context); + return getStateFromStack(context.getItemInHand(), state); + } + + public BlockState getStateFromStack(ItemStack stack, @Nullable BlockState baseState) { + if (!stack.hasTag() || !stack.is(this)) { + return baseState; } - return returnValue; + var tag = stack.getTag(); + return (baseState != null ? baseState : getBlock().defaultBlockState()) + .setValue(LampBlock.INVERTED, isInverted(tag)) + .setValue(LampBlock.BLOOM, isBloomEnabled(tag)) + .setValue(LampBlock.LIGHT, isLightEnabled(tag)); } public void fillItemCategory(CreativeModeTab category, NonNullList items) { @@ -55,17 +71,35 @@ public void fillItemCategory(CreativeModeTab category, NonNullList it } } - @Nullable @Override - public IRenderer getRenderer(ItemStack stack) { - BlockState state = getBlock().defaultBlockState(); - if (stack.hasTag()) { - var tag = stack.getTag(); - state = state - .setValue(LampBlock.INVERTED, isInverted(tag)) - .setValue(LampBlock.BLOOM, isBloomEnabled(tag)) - .setValue(LampBlock.LIGHT, isLightEnabled(tag)); + public void initializeClient(Consumer consumer) { + consumer.accept(new IClientItemExtensions() { + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return LampItemRenderer.INSTANCE; + } + }); + } + + private static class ClientCallWrapper { + + private static void registerEventListener(LampBlockItem item) { + ModelUtils.registerBakeEventListener(false, event -> { + ResourceLocation model = BuiltInRegistries.ITEM.getKey(item).withPrefix("item/"); + BakedModel original = event.getModels().get(model); + if (original == null) { + model = new ModelResourceLocation(model, "inventory"); + original = event.getModels().get(model); + } + event.getModels().put(model, new BakedModelWrapper<>(original) { + + @Override + public boolean isCustomRenderer() { + return true; + } + }); + }); } - return getBlock().getRenderer(state); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java index dfaef338c15..3f34616dc3c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java @@ -3,20 +3,14 @@ import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.common.block.LaserPipeBlock; -import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.lowdragmc.lowdraglib.client.renderer.IRenderer; - import net.minecraft.client.color.item.ItemColor; -import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.Nullable; - import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault -public class LaserPipeBlockItem extends PipeBlockItem implements IItemRendererProvider { +public class LaserPipeBlockItem extends PipeBlockItem { public LaserPipeBlockItem(PipeBlock block, Properties properties) { super(block, properties); @@ -37,11 +31,4 @@ public static ItemColor tintColor() { return -1; }; } - - @Nullable - @Override - @OnlyIn(Dist.CLIENT) - public IRenderer getRenderer(ItemStack stack) { - return getBlock().getRenderer(getBlock().defaultBlockState()); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java index 97851db6697..22f63a6cf8f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java @@ -2,9 +2,6 @@ import com.gregtechceu.gtceu.api.block.MaterialPipeBlock; -import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.lowdragmc.lowdraglib.client.renderer.IRenderer; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.item.ItemColor; import net.minecraft.network.chat.Component; @@ -13,13 +10,12 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class MaterialPipeBlockItem extends PipeBlockItem implements IItemRendererProvider { +public class MaterialPipeBlockItem extends PipeBlockItem { public MaterialPipeBlockItem(MaterialPipeBlock block, Properties properties) { super(block, properties); @@ -42,13 +38,6 @@ public static ItemColor tintColor() { }; } - @Nullable - @Override - @OnlyIn(Dist.CLIENT) - public IRenderer getRenderer(ItemStack stack) { - return getBlock().getRenderer(getBlock().defaultBlockState()); - } - @Override public Component getDescription() { return this.getBlock().getName(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java deleted file mode 100644 index ed59e05ded9..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.gregtechceu.gtceu.api.item; - -import com.gregtechceu.gtceu.common.block.OpticalPipeBlock; - -import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.lowdragmc.lowdraglib.client.renderer.IRenderer; - -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import org.jetbrains.annotations.Nullable; - -import javax.annotation.ParametersAreNonnullByDefault; - -@ParametersAreNonnullByDefault -public class OpticalPipeBlockItem extends PipeBlockItem implements IItemRendererProvider { - - public OpticalPipeBlockItem(OpticalPipeBlock block, Properties properties) { - super(block, properties); - } - - @Nullable - @Override - @OnlyIn(Dist.CLIENT) - public IRenderer getRenderer(ItemStack stack) { - return getBlock().getRenderer(getBlock().defaultBlockState()); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java index df3ff0930d0..187fe5df909 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java @@ -13,12 +13,10 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.client.model.data.ModelData; -import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.common.extensions.IForgeBlockEntity; import org.jetbrains.annotations.NotNull; @@ -31,9 +29,6 @@ public interface IMachineBlockEntity extends IToolGridHighlight, IAsyncAutoSyncBlockEntity, IRPCBlockEntity, IAutoPersistBlockEntity, IPaintable, IForgeBlockEntity { - ModelProperty MODEL_DATA_LEVEL = new ModelProperty<>(); - ModelProperty MODEL_DATA_POS = new ModelProperty<>(); - default BlockEntity self() { return (BlockEntity) this; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTBlockBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTBlockBuilder.java index c1ba8744fb0..17dfee8d336 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTBlockBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTBlockBuilder.java @@ -38,6 +38,10 @@ public GTBlockBuilder exBlockstate(NonNullBiConsumer cons.accept(ctx, (GTBlockstateProvider) prov)); } + public GTBlockBuilder gtBlockstate(NonNullBiConsumer, GTBlockstateProvider> cons) { + return setData(ProviderType.BLOCKSTATE, (ctx, prov) -> cons.accept(ctx, (GTBlockstateProvider) prov)); + } + // region default overrides @Override @@ -122,6 +126,11 @@ public GTBlockBuilder setDataGeneric(Provid return this; } + @Override + public GTBlockBuilder setData(ProviderType type, NonNullBiConsumer, D> cons) { + return (GTBlockBuilder) super.setData(type, cons); + } + // spotless:on // endregion } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java index b676b92f0cb..ee9020c53fc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java @@ -27,6 +27,7 @@ import com.gregtechceu.gtceu.common.data.models.GTMachineModels; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.model.builder.MachineModelBuilder; +import com.gregtechceu.gtceu.utils.data.RuntimeBlockstateProvider; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.RenderType; @@ -76,7 +77,6 @@ import javax.annotation.ParametersAreNonnullByDefault; import static com.gregtechceu.gtceu.common.data.models.GTMachineModels.*; -import static com.gregtechceu.gtceu.integration.kjs.GregTechKubeJSPlugin.RUNTIME_BLOCKSTATE_PROVIDER; @SuppressWarnings("unused") @ParametersAreNonnullByDefault @@ -818,9 +818,10 @@ public static void generateAssetJsons(@Nullable As // Fake a data provider for the GT model builders var context = new DataGenContext<>(definition::getBlock, definition.getName(), id); if (builder.blockModel() != null) { - builder.blockModel().accept(context, RUNTIME_BLOCKSTATE_PROVIDER); + builder.blockModel().accept(context, RuntimeBlockstateProvider.INSTANCE); } else { - GTMachineModels.createMachineModel(builder.model()).accept(context, RUNTIME_BLOCKSTATE_PROVIDER); + GTMachineModels.createMachineModel(builder.model()) + .accept(context, RuntimeBlockstateProvider.INSTANCE); } } else { generator.itemModel(id, gen -> gen.parent(id.withPrefix("block/machine/").toString())); diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTBlockstateProvider.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTBlockstateProvider.java index 40bf8542286..6b7789b5159 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTBlockstateProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTBlockstateProvider.java @@ -78,14 +78,17 @@ public MultiVariantGenerator multiVariantGenerator(Block block) { public MultiVariantGenerator multiVariantGenerator(Block block, Variant baseVariant) { var multiVariant = MultiVariantGenerator.multiVariant(block, baseVariant); - registeredBlocks.put(block, new BlockStateGeneratorWrapper(multiVariant)); - return multiVariant; + return addVanillaGenerator(block, multiVariant); } public MultiPartGenerator multiPartGenerator(Block block) { var multiPart = MultiPartGenerator.multiPart(block); - registeredBlocks.put(block, new BlockStateGeneratorWrapper(multiPart)); - return multiPart; + return addVanillaGenerator(block, multiPart); + } + + public T addVanillaGenerator(Block block, T generator) { + registeredBlocks.put(block, new BlockStateGeneratorWrapper(generator)); + return generator; } public static @Nullable PropertyDispatch createFacingDispatch(MachineDefinition definition) { diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index 0f3b72535e4..c4bc0f934da 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -13,10 +13,18 @@ import com.gregtechceu.gtceu.api.item.QuantumTankMachineItem; import com.gregtechceu.gtceu.client.model.item.FacadeUnbakedModel; import com.gregtechceu.gtceu.client.model.machine.MachineModelLoader; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; +import com.gregtechceu.gtceu.client.model.pipe.PipeModelLoader; import com.gregtechceu.gtceu.client.particle.HazardParticle; import com.gregtechceu.gtceu.client.particle.MufflerParticle; +import com.gregtechceu.gtceu.client.renderer.block.MaterialBlockRenderer; +import com.gregtechceu.gtceu.client.renderer.block.OreBlockRenderer; +import com.gregtechceu.gtceu.client.renderer.block.SurfaceRockRenderer; import com.gregtechceu.gtceu.client.renderer.entity.GTBoatRenderer; import com.gregtechceu.gtceu.client.renderer.entity.GTExplosiveRenderer; +import com.gregtechceu.gtceu.client.renderer.item.ArmorItemRenderer; +import com.gregtechceu.gtceu.client.renderer.item.TagPrefixItemRenderer; +import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; import com.gregtechceu.gtceu.client.renderer.item.decorator.GTComponentItemDecorator; import com.gregtechceu.gtceu.client.renderer.item.decorator.GTLampItemOverlayRenderer; import com.gregtechceu.gtceu.client.renderer.item.decorator.GTTankItemFluidPreview; @@ -27,17 +35,23 @@ import com.gregtechceu.gtceu.common.CommonProxy; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTEntityTypes; +import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; import com.gregtechceu.gtceu.common.data.GTParticleTypes; +import com.gregtechceu.gtceu.common.data.models.GTModels; import com.gregtechceu.gtceu.common.entity.GTBoat; import com.gregtechceu.gtceu.common.machine.owner.MachineOwner; import com.gregtechceu.gtceu.config.ConfigHolder; +import com.gregtechceu.gtceu.data.model.builder.PipeModelBuilder; +import com.gregtechceu.gtceu.data.pack.event.RegisterDynamicResourcesEvent; import com.gregtechceu.gtceu.forge.ForgeCommonEventListener; +import com.gregtechceu.gtceu.integration.kjs.GregTechKubeJSPlugin; import com.gregtechceu.gtceu.integration.map.ClientCacheManager; import com.gregtechceu.gtceu.integration.map.cache.client.GTClientCache; import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksPlugin; import com.gregtechceu.gtceu.integration.map.layer.Layers; import com.gregtechceu.gtceu.integration.map.layer.builtin.FluidRenderLayer; import com.gregtechceu.gtceu.integration.map.layer.builtin.OreRenderLayer; +import com.gregtechceu.gtceu.utils.data.RuntimeBlockstateProvider; import com.gregtechceu.gtceu.utils.input.SyncedKeyMapping; import net.minecraft.client.model.BoatModel; @@ -49,6 +63,7 @@ import net.minecraft.world.item.Item; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.event.*; +import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.registries.ForgeRegistries; @@ -158,6 +173,50 @@ public static void initializeDynamicRenders() { @SubscribeEvent public void onRegisterModelLoaders(ModelEvent.RegisterGeometryLoaders event) { event.register(MachineModelLoader.ID.getPath(), MachineModelLoader.INSTANCE); + event.register(PipeModelLoader.ID.getPath(), PipeModelLoader.INSTANCE); event.register("facade", FacadeUnbakedModel.Loader.INSTANCE); } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void preRegisterDynamicAssets(RegisterDynamicResourcesEvent event) { + PipeModel.DYNAMIC_MODELS.clear(); + } + + @SubscribeEvent + public void registerDynamicAssets(RegisterDynamicResourcesEvent event) { + // regenerate all pipe models in case their textures changed + // cables may do this, others too if something's removed + for (var block : GTMaterialBlocks.CABLE_BLOCKS.values()) { + if (block == null) continue; + block.get().createPipeModel(RuntimeBlockstateProvider.INSTANCE).dynamicModel(); + } + for (var block : GTMaterialBlocks.FLUID_PIPE_BLOCKS.values()) { + if (block == null) continue; + block.get().createPipeModel(RuntimeBlockstateProvider.INSTANCE).dynamicModel(); + } + for (var block : GTMaterialBlocks.ITEM_PIPE_BLOCKS.values()) { + if (block == null) continue; + block.get().createPipeModel(RuntimeBlockstateProvider.INSTANCE).dynamicModel(); + } + + MaterialBlockRenderer.reinitModels(); + TagPrefixItemRenderer.reinitModels(); + OreBlockRenderer.reinitModels(); + ToolItemRenderer.reinitModels(); + ArmorItemRenderer.reinitModels(); + SurfaceRockRenderer.reinitModels(); + GTModels.registerMaterialFluidModels(); + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void postRegisterDynamicAssets(RegisterDynamicResourcesEvent event) { + // do this last so addons can easily add new variants to the registered model set + PipeModel.initDynamicModels(); + + if (GTCEu.Mods.isKubeJSLoaded()) { + GregTechKubeJSPlugin.generateMachineBlockModels(); + } + RuntimeBlockstateProvider.INSTANCE.run(); + PipeModelBuilder.clearRestrictorModelCache(); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/BaseBakedModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/BaseBakedModel.java index f91a52c0b2a..484ee5656e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/BaseBakedModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/BaseBakedModel.java @@ -9,8 +9,6 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.IDynamicBakedModel; -import org.jetbrains.annotations.NotNull; - public abstract class BaseBakedModel implements IDynamicBakedModel { public BaseBakedModel() {} @@ -37,13 +35,13 @@ public boolean isCustomRenderer() { @Override @OnlyIn(Dist.CLIENT) - public @NotNull ItemOverrides getOverrides() { + public ItemOverrides getOverrides() { return ItemOverrides.EMPTY; } @Override @OnlyIn(Dist.CLIENT) - public @NotNull TextureAtlasSprite getParticleIcon() { + public TextureAtlasSprite getParticleIcon() { return Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS) .apply(MissingTextureAtlasSprite.getLocation()); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java b/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java new file mode 100644 index 00000000000..2f58894072b --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java @@ -0,0 +1,16 @@ +package com.gregtechceu.gtceu.client.model; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraftforge.client.model.data.ModelProperty; + +public class GTModelProperties { + + public static final ModelProperty LEVEL = new ModelProperty<>(); + public static final ModelProperty POS = new ModelProperty<>(); + + public static final ModelProperty PIPE_CONNECTION_MASK = new ModelProperty<>(); + public static final ModelProperty PIPE_BLOCKED_MASK = new ModelProperty<>(); + + public static final ModelProperty PIPE_ACTIVE = new ModelProperty<>(); +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/IBlockEntityRendererBakedModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/IBlockEntityRendererBakedModel.java index 6a59d976574..001442720cc 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/IBlockEntityRendererBakedModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/IBlockEntityRendererBakedModel.java @@ -12,21 +12,21 @@ import net.minecraftforge.client.model.IDynamicBakedModel; import com.mojang.blaze3d.vertex.PoseStack; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface IBlockEntityRendererBakedModel extends IDynamicBakedModel, BlockEntityRenderer { + @Nullable BlockEntityType getBlockEntityType(); - void render(@NotNull T blockEntity, float partialTick, - @NotNull PoseStack poseStack, @NotNull MultiBufferSource buffer, + void render(T blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay); default void renderByItem(ItemStack stack, ItemDisplayContext displayContext, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) {} - default boolean shouldRender(T blockEntity, @NotNull Vec3 cameraPos) { + default boolean shouldRender(T blockEntity, Vec3 cameraPos) { return Vec3.atCenterOf(blockEntity.getBlockPos()).closerThan(cameraPos, this.getViewDistance()); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java deleted file mode 100644 index efdff6bb28b..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java +++ /dev/null @@ -1,357 +0,0 @@ -package com.gregtechceu.gtceu.client.model; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; -import com.gregtechceu.gtceu.client.util.ModelUtils; -import com.gregtechceu.gtceu.common.data.models.GTModels; -import com.gregtechceu.gtceu.utils.GTUtil; -import com.gregtechceu.gtceu.utils.memoization.GTMemoizer; -import com.gregtechceu.gtceu.utils.memoization.MemoizedSupplier; - -import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; -import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; - -import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.InventoryMenu; -import net.minecraft.world.item.ItemDisplayContext; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import com.mojang.blaze3d.vertex.PoseStack; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import lombok.Setter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Supplier; - -public class PipeModel { - - public static final ResourceLocation PIPE_BLOCKED_OVERLAY = GTCEu.id("block/pipe/blocked/pipe_blocked"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_UP = GTCEu.id("block/pipe/blocked/pipe_blocked_up"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_DOWN = GTCEu.id("block/pipe/blocked/pipe_blocked_down"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_LEFT = GTCEu.id("block/pipe/blocked/pipe_blocked_left"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_RIGHT = GTCEu.id("block/pipe/blocked/pipe_blocked_right"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_NU = GTCEu.id("block/pipe/blocked/pipe_blocked_nu"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_ND = GTCEu.id("block/pipe/blocked/pipe_blocked_nd"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_NL = GTCEu.id("block/pipe/blocked/pipe_blocked_nl"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_NR = GTCEu.id("block/pipe/blocked/pipe_blocked_nr"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_UD = GTCEu.id("block/pipe/blocked/pipe_blocked_ud"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_UL = GTCEu.id("block/pipe/blocked/pipe_blocked_ul"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_UR = GTCEu.id("block/pipe/blocked/pipe_blocked_ur"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_DL = GTCEu.id("block/pipe/blocked/pipe_blocked_dl"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_DR = GTCEu.id("block/pipe/blocked/pipe_blocked_dr"); - public static final ResourceLocation PIPE_BLOCKED_OVERLAY_LR = GTCEu.id("block/pipe/blocked/pipe_blocked_lr"); - private static final Int2ObjectMap RESTRICTOR_MAP = new Int2ObjectOpenHashMap<>(); - private static boolean isRestrictorInitialized; - - protected static void initializeRestrictor(Function atlas) { - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_UP), Border.TOP); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_DOWN), Border.BOTTOM); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_UD), Border.TOP, Border.BOTTOM); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_LEFT), Border.LEFT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_UL), Border.TOP, Border.LEFT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_DL), Border.BOTTOM, Border.LEFT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_NR), Border.TOP, Border.BOTTOM, Border.LEFT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_RIGHT), Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_UR), Border.TOP, Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_DR), Border.BOTTOM, Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_NL), Border.TOP, Border.BOTTOM, Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_LR), Border.LEFT, Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_ND), Border.TOP, Border.LEFT, Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY_NU), Border.BOTTOM, Border.LEFT, Border.RIGHT); - addRestrictor(atlas.apply(PIPE_BLOCKED_OVERLAY), Border.TOP, Border.BOTTOM, Border.LEFT, Border.RIGHT); - } - - private static final EnumMap> FACE_BORDER_MAP = Util.make(() -> { - EnumMap> map = new EnumMap<>(Direction.class); - - map.put(Direction.DOWN, borderMap(Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)); - map.put(Direction.UP, borderMap(Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)); - map.put(Direction.NORTH, borderMap(Direction.DOWN, Direction.UP, Direction.WEST, Direction.EAST)); - map.put(Direction.SOUTH, borderMap(Direction.DOWN, Direction.UP, Direction.WEST, Direction.EAST)); - map.put(Direction.WEST, borderMap(Direction.DOWN, Direction.UP, Direction.NORTH, Direction.SOUTH)); - map.put(Direction.EAST, borderMap(Direction.DOWN, Direction.UP, Direction.NORTH, Direction.SOUTH)); - - return map; - }); - - public final static int ITEM_CONNECTIONS = 0b001100; - public final float thickness; - public final AABB coreCube; - public final Map sideCubes; - - public MemoizedSupplier sideTexture, endTexture; - @Nullable - public MemoizedSupplier secondarySideTexture, secondaryEndTexture; - @Setter - public @Nullable ResourceLocation sideOverlayTexture, endOverlayTexture; - - @OnlyIn(Dist.CLIENT) - private @Nullable TextureAtlasSprite sideSprite, endSprite; - @OnlyIn(Dist.CLIENT) - private @Nullable TextureAtlasSprite secondarySideSprite, secondaryEndSprite; - @OnlyIn(Dist.CLIENT) - private @Nullable TextureAtlasSprite sideOverlaySprite, endOverlaySprite; - - public PipeModel(float thickness, Supplier sideTexture, Supplier endTexture, - @Nullable Supplier secondarySideTexture, - @Nullable Supplier secondaryEndTexture) { - this.sideTexture = GTMemoizer.memoize(sideTexture); - this.endTexture = GTMemoizer.memoize(endTexture); - this.secondarySideTexture = secondarySideTexture != null ? GTMemoizer.memoize(secondarySideTexture) : - null; - this.secondaryEndTexture = secondaryEndTexture != null ? GTMemoizer.memoize(secondaryEndTexture) : null; - this.thickness = thickness; - double min = (1d - thickness) / 2; - double max = min + thickness; - this.coreCube = new AABB(min, min, min, max, max, max); - this.sideCubes = new EnumMap<>(Direction.class); - for (Direction side : GTUtil.DIRECTIONS) { - var normal = side.getNormal(); - sideCubes.put(side, new AABB( - normal.getX() == 0 ? min : normal.getX() > 0 ? max : 0, - normal.getY() == 0 ? min : normal.getY() > 0 ? max : 0, - normal.getZ() == 0 ? min : normal.getZ() > 0 ? max : 0, - normal.getX() == 0 ? max : normal.getX() > 0 ? 1 : min, - normal.getY() == 0 ? max : normal.getY() > 0 ? 1 : min, - normal.getZ() == 0 ? max : normal.getZ() > 0 ? 1 : min)); - } - - if (!isRestrictorInitialized) { - ModelUtils.registerAtlasStitchedEventListener(false, InventoryMenu.BLOCK_ATLAS, event -> { - initializeRestrictor(event.getAtlas()::getSprite); - }); - - isRestrictorInitialized = true; - } - ModelUtils.registerAtlasStitchedEventListener(false, InventoryMenu.BLOCK_ATLAS, event -> { - TextureAtlas atlas = event.getAtlas(); - - sideSprite = atlas.getSprite(sideTexture.get()); - endSprite = atlas.getSprite(endTexture.get()); - if (secondarySideTexture != null) { - secondarySideSprite = atlas.getSprite(secondarySideTexture.get()); - } - if (secondaryEndTexture != null) { - secondaryEndSprite = atlas.getSprite(secondaryEndTexture.get()); - } - if (sideOverlayTexture != null) { - sideOverlaySprite = atlas.getSprite(sideOverlayTexture); - } - if (endOverlayTexture != null) { - endOverlaySprite = atlas.getSprite(endOverlayTexture); - } - }); - } - - public VoxelShape getShapes(int connections) { - var shapes = new ArrayList(7); - shapes.add(Shapes.create(coreCube)); - for (Direction side : GTUtil.DIRECTIONS) { - if (PipeBlockEntity.isConnected(connections, side)) { - shapes.add(Shapes.create(sideCubes.get(side))); - } - } - return shapes.stream().reduce(Shapes.empty(), Shapes::or); - } - - @OnlyIn(Dist.CLIENT) - public List bakeQuads(@Nullable Direction side, int connections, int blockedConnections) { - if (side != null) { - if (thickness == 1) { // full block - List quads = new LinkedList<>(); - quads.add(FaceQuad.builder(side, sideSprite).cube(coreCube).cubeUV().tintIndex(0).bake()); - if (secondarySideSprite != null) { - quads.add(FaceQuad.builder(side, secondarySideSprite).cube(coreCube).cubeUV().tintIndex(0).bake()); - } - return quads; - } - - if (PipeBlockEntity.isConnected(connections, side)) { // side connected - List quads = new LinkedList<>(); - quads.add(FaceQuad.builder(side, endSprite).cube(sideCubes.get(side).inflate(-0.001)).cubeUV() - .tintIndex(1).bake()); - if (secondaryEndSprite != null) { - quads.add(FaceQuad.builder(side, secondaryEndSprite).cube(sideCubes.get(side)).cubeUV().tintIndex(1) - .bake()); - } - if (endOverlaySprite != null) { - quads.add(FaceQuad.builder(side, endOverlaySprite).cube(sideCubes.get(side)).cubeUV().tintIndex(0) - .bake()); - } - if (sideOverlaySprite != null) { - for (Direction face : GTUtil.DIRECTIONS) { - if (face.getAxis() != side.getAxis()) { - quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(side)).cubeUV() - .tintIndex(2).bake()); - } - } - } - int borderMask = computeBorderMask(blockedConnections, connections, side); - if (borderMask != 0) { - quads.add(FaceQuad.builder(side, RESTRICTOR_MAP.get(borderMask)).cube(sideCubes.get(side)).cubeUV() - .bake()); - } - return quads; - } - - return Collections.emptyList(); - } - - List quads = new LinkedList<>(); - if (thickness < 1) { // non full block - // render core cube - for (Direction face : GTUtil.DIRECTIONS) { - if (!PipeBlockEntity.isConnected(connections, face)) { - quads.add(FaceQuad.builder(face, sideSprite).cube(coreCube).cubeUV().tintIndex(0).bake()); - if (secondarySideSprite != null) { - quads.add(FaceQuad.builder(face, secondarySideSprite).cube(coreCube).cubeUV().tintIndex(0) - .bake()); - } - } - // render each connected side - for (Direction facing : GTUtil.DIRECTIONS) { - if (facing.getAxis() != face.getAxis()) { - if (PipeBlockEntity.isConnected(connections, facing)) { - quads.add(FaceQuad.builder(face, sideSprite).cube(sideCubes.get(facing)).cubeUV() - .tintIndex(0).bake()); - if (secondarySideSprite != null) { - quads.add(FaceQuad.builder(face, secondarySideSprite).cube(sideCubes.get(facing)) - .cubeUV().tintIndex(0).bake()); - } - if (sideOverlaySprite != null) { - quads.add(FaceQuad.builder(face, sideOverlaySprite) - .cube(sideCubes.get(facing).inflate(0.001)).cubeUV().tintIndex(2).bake()); - } - int borderMask = computeBorderMask(blockedConnections, connections, face); - if (borderMask != 0) { - quads.add(FaceQuad.builder(face, RESTRICTOR_MAP.get(borderMask)) - .cube(coreCube).cubeUV().bake()); - quads.add(FaceQuad.builder(face, RESTRICTOR_MAP.get(borderMask)) - .cube(sideCubes.get(facing)).cubeUV().bake()); - } - } - } - } - } - } - return quads; - } - - @SuppressWarnings("DataFlowIssue") - @OnlyIn(Dist.CLIENT) - public @NotNull TextureAtlasSprite getParticleTexture() { - return sideSprite; - } - - private final Map, List> itemModelCache = new ConcurrentHashMap<>(); - - @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, - MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { - IItemRendererProvider.disabled.set(true); - Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, - combinedLight, combinedOverlay, - (ItemBakedModel) (state, direction, random) -> itemModelCache.computeIfAbsent( - Optional.ofNullable(direction), - direction1 -> bakeQuads(direction1.orElse(null), ITEM_CONNECTIONS, 0))); - IItemRendererProvider.disabled.set(false); - } - - @OnlyIn(Dist.CLIENT) - public void registerTextureAtlas(Consumer register) { - itemModelCache.clear(); - sideTexture.invalidate(); - register.accept(sideTexture.get()); - endTexture.invalidate(); - register.accept(endTexture.get()); - if (secondarySideTexture != null) { - secondarySideTexture.invalidate(); - if (secondarySideTexture.get() != GTModels.BLANK_TEXTURE) { - register.accept(secondarySideTexture.get()); - } - } - if (secondaryEndTexture != null) { - secondaryEndTexture.invalidate(); - if (secondaryEndTexture.get() != GTModels.BLANK_TEXTURE) { - register.accept(secondaryEndTexture.get()); - } - } - if (sideOverlayTexture != null) register.accept(sideOverlayTexture); - if (endOverlayTexture != null) register.accept(endOverlayTexture); - sideSprite = null; - endSprite = null; - endOverlaySprite = null; - } - - private static EnumMap borderMap(Direction topSide, Direction bottomSide, Direction leftSide, - Direction rightSide) { - EnumMap sideMap = new EnumMap<>(Border.class); - sideMap.put(Border.TOP, topSide); - sideMap.put(Border.BOTTOM, bottomSide); - sideMap.put(Border.LEFT, leftSide); - sideMap.put(Border.RIGHT, rightSide); - return sideMap; - } - - private static void addRestrictor(TextureAtlasSprite sprite, Border... borders) { - int mask = 0; - for (Border border : borders) { - mask |= border.mask; - } - RESTRICTOR_MAP.put(mask, sprite); - } - - protected static Direction getSideAtBorder(Direction side, Border border) { - return FACE_BORDER_MAP.get(side).get(border); - } - - protected static int computeBorderMask(int blockedConnections, int connections, Direction side) { - int borderMask = 0; - if (blockedConnections != 0) { - for (Border border : Border.VALUES) { - Direction borderSide = getSideAtBorder(side, border); - if (PipeBlockEntity.isFaceBlocked(blockedConnections, borderSide) && - PipeBlockEntity.isConnected(connections, borderSide)) { - // only render when the side is blocked *and* connected - borderMask |= border.mask; - } - } - } - return borderMask; - } - - public enum Border { - - TOP, - BOTTOM, - LEFT, - RIGHT; - - public static final Border[] VALUES = values(); - - public final int mask; - - Border() { - mask = 1 << this.ordinal(); - } - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModel.java index c20eb618e68..0b765ceba79 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModel.java @@ -9,6 +9,7 @@ import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.client.model.BaseBakedModel; +import com.gregtechceu.gtceu.client.model.GTModelProperties; import com.gregtechceu.gtceu.client.model.IBlockEntityRendererBakedModel; import com.gregtechceu.gtceu.client.model.TextureOverrideModel; import com.gregtechceu.gtceu.client.model.machine.multipart.MultiPartBakedModel; @@ -52,15 +53,12 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; -import static com.gregtechceu.gtceu.api.machine.IMachineBlockEntity.*; - public final class MachineModel extends BaseBakedModel implements ICoverableRenderer, IBlockEntityRendererBakedModel { @@ -138,7 +136,7 @@ public static void initSprites(TextureAtlas atlas) { @SuppressWarnings("deprecation") @Override - public @NotNull TextureAtlasSprite getParticleIcon() { + public TextureAtlasSprite getParticleIcon() { if (particleIcon != null) { return particleIcon; } else if (multiPart != null) { @@ -152,9 +150,9 @@ public static void initSprites(TextureAtlas atlas) { } @Override - public TextureAtlasSprite getParticleIcon(@NotNull ModelData modelData) { - BlockAndTintGetter level = modelData.get(MODEL_DATA_LEVEL); - BlockPos pos = modelData.get(MODEL_DATA_POS); + public TextureAtlasSprite getParticleIcon(ModelData modelData) { + BlockAndTintGetter level = modelData.get(GTModelProperties.LEVEL); + BlockPos pos = modelData.get(GTModelProperties.POS); MetaMachine machine = (level == null || pos == null) ? null : MetaMachine.getMachine(level, pos); MachineRenderState renderState = machine != null ? machine.getRenderState() : @@ -171,11 +169,11 @@ public TextureAtlasSprite getParticleIcon(@NotNull ModelData modelData) { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override - public @NotNull ModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull BlockPos pos, - @NotNull BlockState state, @NotNull ModelData modelData) { + public ModelData getModelData(BlockAndTintGetter level, BlockPos pos, + BlockState state, ModelData modelData) { ModelData.Builder builder = modelData.derive() - .with(MODEL_DATA_LEVEL, level) - .with(MODEL_DATA_POS, pos); + .with(GTModelProperties.LEVEL, level) + .with(GTModelProperties.POS, pos); MetaMachine machine = MetaMachine.getMachine(level, pos); MachineRenderState renderState = machine == null ? definition.defaultRenderState() : machine.getRenderState(); @@ -193,9 +191,9 @@ public TextureAtlasSprite getParticleIcon(@NotNull ModelData modelData) { } @Override - public @NotNull List getQuads(@Nullable BlockState state, @Nullable Direction side, - @NotNull RandomSource rand, - @NotNull ModelData modelData, @Nullable RenderType renderType) { + public List getQuads(@Nullable BlockState state, @Nullable Direction side, + RandomSource rand, + ModelData modelData, @Nullable RenderType renderType) { // If there is a root transform, undo the ModelState transform, apply it, // then re-apply the ModelState transform. // This is necessary because of things like UV locking, which should only respond to the ModelState, @@ -206,7 +204,7 @@ public TextureAtlasSprite getParticleIcon(@NotNull ModelData modelData) { } List quads; - if (modelData.has(MODEL_DATA_LEVEL) && modelData.has(MODEL_DATA_POS)) { + if (modelData.has(GTModelProperties.LEVEL) && modelData.has(GTModelProperties.POS)) { quads = getMachineQuads(state, side, rand, modelData, renderType); } else { // if it doesn't have either of those properties, we're rendering an item. @@ -217,10 +215,10 @@ public TextureAtlasSprite getParticleIcon(@NotNull ModelData modelData) { } public List getMachineQuads(@Nullable BlockState blockState, @Nullable Direction side, - @NotNull RandomSource rand, @NotNull ModelData modelData, + RandomSource rand, ModelData modelData, @Nullable RenderType renderType) { - BlockAndTintGetter level = modelData.get(MODEL_DATA_LEVEL); - BlockPos pos = modelData.get(MODEL_DATA_POS); + BlockAndTintGetter level = modelData.get(GTModelProperties.LEVEL); + BlockPos pos = modelData.get(GTModelProperties.POS); MetaMachine machine = (level == null || pos == null) ? null : MetaMachine.getMachine(level, pos); // render machine quads @@ -261,7 +259,7 @@ public List getMachineQuads(@Nullable BlockState blockState, @Nullabl public List renderMachine(@Nullable MetaMachine machine, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @Nullable BlockState blockState, @Nullable Direction side, RandomSource rand, - @NotNull ModelData modelData, @Nullable RenderType renderType) { + ModelData modelData, @Nullable RenderType renderType) { List quads = new LinkedList<>(); MachineRenderState renderState = machine != null ? machine.getRenderState() : definition.defaultRenderState(); @@ -283,9 +281,9 @@ public List renderMachine(@Nullable MetaMachine machine, @Nullable Bl return quads; } - public void renderBaseModel(List quads, @NotNull MachineRenderState renderState, + public void renderBaseModel(List quads, MachineRenderState renderState, @Nullable BlockState blockState, @Nullable Direction side, RandomSource rand, - @NotNull ModelData modelData, @Nullable RenderType renderType) { + ModelData modelData, @Nullable RenderType renderType) { if (multiPart != null) { quads.addAll(multiPart.getMachineQuads(definition, renderState, blockState, side, rand, modelData, renderType)); @@ -387,8 +385,8 @@ public boolean isCustomRenderer() { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override - public void render(@NotNull BlockEntity blockEntity, float partialTick, - @NotNull PoseStack poseStack, @NotNull MultiBufferSource buffer, + public void render(BlockEntity blockEntity, float partialTick, + PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { if (!(blockEntity instanceof IMachineBlockEntity machineBE)) return; if (machineBE.getDefinition() != getDefinition()) return; @@ -449,7 +447,7 @@ public boolean shouldRenderOffScreen(BlockEntity blockEntity) { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override - public boolean shouldRender(BlockEntity blockEntity, @NotNull Vec3 cameraPos) { + public boolean shouldRender(BlockEntity blockEntity, Vec3 cameraPos) { if (!(blockEntity instanceof IMachineBlockEntity machineBE)) return false; if (machineBE.getDefinition() != getDefinition()) return false; if (machineBE.getMetaMachine().getCoverContainer().hasDynamicCovers()) return true; diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModelLoader.java b/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModelLoader.java index 934b511a0ea..9dc6e3e532a 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModelLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/machine/MachineModelLoader.java @@ -63,7 +63,7 @@ public class MachineModelLoader implements IGeometryLoader private static final Splitter COMMA_SPLITTER = Splitter.on(','); private static final Splitter EQUAL_SPLITTER = Splitter.on('=').limit(2); - private static final UnbakedModel MISSING_MARKER = new BasicUnbakedModel(); + public static final UnbakedModel MISSING_MARKER = new BasicUnbakedModel(); private MachineModelLoader() {} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/machine/multipart/MultiPartBakedModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/machine/multipart/MultiPartBakedModel.java index 2835f96414f..ef19e96f369 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/machine/multipart/MultiPartBakedModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/machine/multipart/MultiPartBakedModel.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.client.model.GTModelProperties; import com.gregtechceu.gtceu.client.model.machine.MachineRenderState; import net.minecraft.Util; @@ -33,8 +34,6 @@ import java.util.*; import java.util.function.Predicate; -import static com.gregtechceu.gtceu.api.machine.IMachineBlockEntity.*; - public class MultiPartBakedModel implements IDynamicBakedModel { private final List, BakedModel>> selectors; @@ -115,8 +114,8 @@ public List getMachineQuads(MachineDefinition definition, MachineRend @Override public ChunkRenderTypeSet getRenderTypes(BlockState state, RandomSource rand, ModelData modelData) { - BlockAndTintGetter level = modelData.get(MODEL_DATA_LEVEL); - BlockPos pos = modelData.get(MODEL_DATA_POS); + BlockAndTintGetter level = modelData.get(GTModelProperties.LEVEL); + BlockPos pos = modelData.get(GTModelProperties.POS); var machine = (level == null || pos == null) ? null : MetaMachine.getMachine(level, pos); if (machine == null) return IDynamicBakedModel.super.getRenderTypes(state, rand, modelData); @@ -137,8 +136,8 @@ public ChunkRenderTypeSet getRenderTypes(BlockState state, RandomSource rand, Mo @Override public ModelData getModelData(BlockAndTintGetter level, BlockPos pos, BlockState state, ModelData modelData) { ModelData.Builder builder = modelData.derive() - .with(MODEL_DATA_LEVEL, level) - .with(MODEL_DATA_POS, pos); + .with(GTModelProperties.LEVEL, level) + .with(GTModelProperties.POS, pos); var machine = MetaMachine.getMachine(level, pos); if (machine == null) return builder.build(); @@ -183,8 +182,8 @@ public boolean isCustomRenderer() { @Override public TextureAtlasSprite getParticleIcon(ModelData modelData) { - BlockAndTintGetter level = modelData.get(MODEL_DATA_LEVEL); - BlockPos pos = modelData.get(MODEL_DATA_POS); + BlockAndTintGetter level = modelData.get(GTModelProperties.LEVEL); + BlockPos pos = modelData.get(GTModelProperties.POS); var machine = (level == null || pos == null) ? null : MetaMachine.getMachine(level, pos); if (machine != null) return getParticleIcon(machine.getRenderState(), modelData); diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/machine/variant/MultiVariantModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/machine/variant/MultiVariantModel.java index dcf7da73340..57e7defb97a 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/machine/variant/MultiVariantModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/machine/variant/MultiVariantModel.java @@ -70,8 +70,8 @@ public void resolveParents(@NotNull Function res @OnlyIn(Dist.CLIENT) public static class Deserializer implements JsonDeserializer { - public MultiVariantModel deserialize(JsonElement json, Type type, JsonDeserializationContext context) - throws JsonParseException { + public MultiVariantModel deserialize(JsonElement json, Type type, + JsonDeserializationContext context) throws JsonParseException { List variants = new ArrayList<>(); if (json.isJsonArray()) { JsonArray array = json.getAsJsonArray(); diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java new file mode 100644 index 00000000000..dc257bd4770 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java @@ -0,0 +1,169 @@ +package com.gregtechceu.gtceu.client.model.pipe; + +import com.gregtechceu.gtceu.api.block.PipeBlock; +import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.data.model.builder.PipeModelBuilder; + +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.model.generators.BlockModelBuilder; +import net.minecraftforge.client.model.generators.IGeneratedBlockState; + +import lombok.Setter; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +import java.util.Objects; + +public class ActivablePipeModel extends PipeModel { + + @Setter + public @Nullable ResourceLocation sideActive, endActive; + @Setter + public @Nullable ResourceLocation sideSecondaryActive, endSecondaryActive; + @Setter + public @Nullable ResourceLocation sideOverlayActive, endOverlayActive; + + /// Use {@link #getOrCreateActiveBlockModel()} instead of referencing this field directly. + private BlockModelBuilder activeBlockModel; + /// Use {@link #getOrCreateActiveCenterElement()} instead of referencing this field directly. + private BlockModelBuilder activeCenterElement; + /// Use {@link #getOrCreateActiveConnectionElement()} instead of referencing this field directly. + private BlockModelBuilder activeConnectionElement; + + public ActivablePipeModel(PipeBlock block, float thickness, ResourceLocation side, ResourceLocation end, + GTBlockstateProvider provider) { + super(block, provider, thickness, side, end); + } + + /** + * @see #getOrCreateActiveBlockModel() + * @see #getOrCreateConnectionElement() + * @see #getOrCreateActiveCenterElement() + * @see #getOrCreateActiveConnectionElement() + */ + @Override + public void initModels() { + getOrCreateActiveCenterElement(); + getOrCreateActiveConnectionElement(); + getOrCreateActiveBlockModel(); + + super.initModels(); + } + + /** + * Override this to change the actual model {@link #block this.block} will use. + * + * @return A model builder for the block's actual model. + * @see #getOrCreateBlockModel() + * @see #getOrCreateActiveCenterElement() + * @see #getOrCreateActiveConnectionElement() + */ + @ApiStatus.OverrideOnly + protected BlockModelBuilder getOrCreateActiveBlockModel() { + if (this.activeBlockModel != null) { + return this.activeBlockModel; + } + // spotless:off + return this.activeBlockModel = this.provider.models().getBuilder(this.blockId.withSuffix("_active").toString()) + .parent(this.getOrCreateActiveCenterElement()) + .customLoader(PipeModelBuilder::begin) + .thickness(this.thickness).provider(this.provider) + .centerModels(this.getOrCreateActiveCenterElement().getLocation()) + .connectionModels(this.getOrCreateActiveConnectionElement().getLocation()) + .end(); + // spotless:on + } + + /** + * Override this to change the center element's model for when the pipe is active. + * + * @return A model builder for the center element's model. + * @see #getOrCreateCenterElement() + * @see #getOrCreateActiveConnectionElement() + */ + @ApiStatus.OverrideOnly + protected BlockModelBuilder getOrCreateActiveCenterElement() { + if (this.activeCenterElement != null) { + return this.activeCenterElement; + } + return this.activeCenterElement = makeActiveVariant(this.getOrCreateCenterElement()); + } + + /** + * Override this to change the 'connection' element's model for when the pipe is active.
+ * By default, this is rotated & used for all connected sides of the pipe.
+ * Note that that is not a hard requirement, and that you may set a model per side in + * {@link #getOrCreateBlockModel()}. + * + * @return A model builder for the connection element's model. + * @see #getOrCreateConnectionElement() + * @see #getOrCreateActiveCenterElement() + */ + @ApiStatus.OverrideOnly + protected BlockModelBuilder getOrCreateActiveConnectionElement() { + if (this.activeConnectionElement != null) { + return this.activeConnectionElement; + } + return this.activeConnectionElement = makeActiveVariant(this.getOrCreateConnectionElement()); + } + + protected BlockModelBuilder makeActiveVariant(BlockModelBuilder parentModel) { + BlockModelBuilder model = this.provider.models() + .getBuilder(parentModel.getLocation().withSuffix("_active").toString()) + .parent(parentModel); + // override non-null textures, leave unset ones as is + if (this.sideActive != null) model.texture("side", this.sideActive); + if (this.endActive != null) model.texture("end", this.endActive); + if (this.sideSecondaryActive != null) model.texture("side_secondary", this.sideSecondaryActive); + if (this.endSecondaryActive != null) model.texture("end_secondary", this.endSecondaryActive); + if (this.sideOverlayActive != null) model.texture("side_overlay", this.sideOverlayActive); + if (this.endOverlayActive != null) model.texture("end_overlay", this.endOverlayActive); + + return model; + } + + @Override + public IGeneratedBlockState createBlockState() { + if (!this.getBlock().defaultBlockState().hasProperty(GTBlockStateProperties.ACTIVE)) { + return super.createBlockState(); + } + // spotless:off + return this.provider.getVariantBuilder(this.getBlock()) + .partialState() + .with(GTBlockStateProperties.ACTIVE, false) + .modelForState() + .modelFile(this.provider.models().getExistingFile(this.blockId)) + .addModel() + .partialState() + .with(GTBlockStateProperties.ACTIVE, true) + .modelForState() + .modelFile(this.provider.models().getExistingFile(this.blockId.withSuffix("_active"))) + .addModel(); + // spotless:on + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ActivablePipeModel pipeModel)) return false; + return super.equals(o) && + Objects.equals(sideActive, pipeModel.sideActive) && + Objects.equals(endActive, pipeModel.endActive) && + Objects.equals(sideSecondaryActive, pipeModel.sideSecondaryActive) && + Objects.equals(endSecondaryActive, pipeModel.endSecondaryActive) && + Objects.equals(sideOverlayActive, pipeModel.sideOverlayActive) && + Objects.equals(endOverlayActive, pipeModel.endOverlayActive); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(sideActive); + result = 31 * result + Objects.hashCode(endActive); + result = 31 * result + Objects.hashCode(sideSecondaryActive); + result = 31 * result + Objects.hashCode(endSecondaryActive); + result = 31 * result + Objects.hashCode(sideOverlayActive); + result = 31 * result + Objects.hashCode(endOverlayActive); + return result; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java new file mode 100644 index 00000000000..cba98fe97b3 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java @@ -0,0 +1,152 @@ +package com.gregtechceu.gtceu.client.model.pipe; + +import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.pipenet.IPipeNode; +import com.gregtechceu.gtceu.api.pipenet.Node; +import com.gregtechceu.gtceu.client.model.BaseBakedModel; +import com.gregtechceu.gtceu.client.model.GTModelProperties; +import com.gregtechceu.gtceu.client.model.IBlockEntityRendererBakedModel; +import com.gregtechceu.gtceu.client.renderer.cover.ICoverableRenderer; +import com.gregtechceu.gtceu.client.util.GTQuadTransformers; +import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; +import com.gregtechceu.gtceu.utils.GTUtil; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.model.data.ModelData; + +import com.mojang.blaze3d.vertex.PoseStack; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +public class BakedPipeModel extends BaseBakedModel implements ICoverableRenderer, + IBlockEntityRendererBakedModel> { + + public final static int ITEM_CONNECTIONS = 0b001100; + + private final Map parts; + private final Map restrictors; + + public BakedPipeModel(Map parts, Map restrictors) { + this.parts = parts; + this.restrictors = restrictors; + } + + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, + RandomSource rand, ModelData modelData, @Nullable RenderType renderType) { + List quads = new ArrayList<>(); + + BlockAndTintGetter level = modelData.get(GTModelProperties.LEVEL); + BlockPos pos = modelData.get(GTModelProperties.POS); + Integer connectionMask = modelData.get(GTModelProperties.PIPE_CONNECTION_MASK); + Integer blockedMask = modelData.get(GTModelProperties.PIPE_BLOCKED_MASK); + + if (level == null || pos == null || state == null) { + connectionMask = ITEM_CONNECTIONS; + blockedMask = Node.ALL_CLOSED; + } + if (connectionMask == null || connectionMask != Node.ALL_OPENED) { + quads.addAll(parts.get(null).getQuads(state, side, rand, modelData, renderType)); + if (connectionMask == null) { + // return unconnected base model if the model property isn't set + return quads; + } + } + for (Direction dir : GTUtil.DIRECTIONS) { + if (PipeBlockEntity.isConnected(connectionMask, dir)) { + quads.addAll(parts.get(dir).getQuads(state, side, rand, modelData, renderType)); + if (blockedMask != null && PipeBlockEntity.isFaceBlocked(blockedMask, dir)) { + quads.addAll(restrictors.get(dir).getQuads(state, side, rand, modelData, renderType)); + } + } + } + if (level == null || pos == null || !(level.getBlockEntity(pos) instanceof IPipeNode pipeNode)) { + return quads; + } + ICoverableRenderer.super.renderCovers(quads, pipeNode.getCoverContainer(), pos, level, side, rand, + modelData, renderType); + + if (pipeNode.getFrameMaterial().isNull() || (renderType != null && renderType != RenderType.translucent())) { + return quads; + } + var frameBlockEntry = GTMaterialBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, pipeNode.getFrameMaterial()); + if (frameBlockEntry == null) { + return quads; + } + BlockState frameState = frameBlockEntry.getDefaultState(); + BakedModel frameModel = Minecraft.getInstance().getBlockRenderer().getBlockModel(frameState); + + modelData = frameModel.getModelData(level, pos, frameState, modelData); + + List frameQuads = new LinkedList<>(); + if (side == null || pipeNode.getCoverContainer().getCoverAtSide(side) == null) { + frameQuads.addAll(frameModel.getQuads(state, side, rand, modelData, renderType)); + } + + if (side == null) { + for (Direction face : GTUtil.DIRECTIONS) { + if (pipeNode.getCoverContainer().getCoverAtSide(face) != null) { + continue; + } + frameQuads.addAll(frameModel.getQuads(state, face, rand, modelData, renderType)); + } + } + + // bake all the quads' tint colors into the vertices + BlockColors blockColors = Minecraft.getInstance().getBlockColors(); + for (BakedQuad frameQuad : frameQuads) { + if (frameQuad.isTinted()) { + int color = blockColors.getColor(frameState, level, pos, frameQuad.getTintIndex()); + frameQuad = GTQuadTransformers.setColor(frameQuad, color, true); + } + quads.add(frameQuad); + } + return quads; + } + + @Override + public ModelData getModelData(BlockAndTintGetter level, BlockPos pos, BlockState state, ModelData modelData) { + ModelData.Builder builder = modelData.derive() + .with(GTModelProperties.LEVEL, level) + .with(GTModelProperties.POS, pos); + + if (!(level.getBlockEntity(pos) instanceof PipeBlockEntity blockEntity)) { + return builder.build(); + } + return builder.with(GTModelProperties.PIPE_CONNECTION_MASK, blockEntity.getVisualConnections()) + .with(GTModelProperties.PIPE_BLOCKED_MASK, blockEntity.getBlockedConnections()) + .build(); + } + + @SuppressWarnings("deprecation") + @Override + public TextureAtlasSprite getParticleIcon() { + return parts.get(null).getParticleIcon(); + } + + @Override + public @Nullable BlockEntityType> getBlockEntityType() { + return null; + } + + @Override + public void render(PipeBlockEntity blockEntity, float partialTick, PoseStack poseStack, + MultiBufferSource buffer, int packedLight, int packedOverlay) {} +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java new file mode 100644 index 00000000000..83f0ceeb9ca --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java @@ -0,0 +1,377 @@ +package com.gregtechceu.gtceu.client.model.pipe; + +import com.gregtechceu.gtceu.api.block.PipeBlock; +import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties; +import com.gregtechceu.gtceu.api.registry.registrate.GTBlockBuilder; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.data.model.builder.PipeModelBuilder; +import com.gregtechceu.gtceu.data.pack.event.RegisterDynamicResourcesEvent; +import com.gregtechceu.gtceu.utils.GTMath; +import com.gregtechceu.gtceu.utils.GTUtil; + +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.models.blockstates.MultiVariantGenerator; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.model.generators.*; + +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; +import it.unimi.dsi.fastutil.objects.Reference2FloatMap; +import it.unimi.dsi.fastutil.objects.Reference2FloatOpenHashMap; +import lombok.Getter; +import lombok.Setter; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.*; + +/** + * This is an automatic pipe model generator. + * + *

For material pipes

+ * If the pipe this model belongs to is generated from a material property (or equivalent), + * you should call {@link #dynamicModel()}, which adds the model to {@link #DYNAMIC_MODELS} + * and automatically processes it as a part of runtime asset generation. + *

+ * NOTE:
+ * You must also initialize the models in an {@link RegisterDynamicResourcesEvent} listener as such: + * + *

+ * {@code
+ * 
+ * // in a @EventBusSubscriber-annotated class
+ * @SubscribeEvent
+ * public static void registerDynamicAssets(RegisterDynamicResourcesEvent event) {
+ *     for (var block : YourBlocks.YOUR_PIPE_BLOCKS.values()) {
+ *         if (block == null) continue;
+ *         block.get().createPipeModel(RuntimeExistingFileHelper.INSTANCE).dynamicModel();
+ *     }
+ * }
+ * }
+ * 
+ * + * Remember to replace {@code YourBlocks.YOUR_PIPE_BLOCKS.values()} with a reference to your pipe block collection! + *

+ * + *

For non-material pipes

+ * Conversely, if the pipe is not generated, but has a constant set of variants (such as optical fiber + * cables), + * you should NOT use {@link #dynamicModel()} and instead set the model with + * {@link GTBlockBuilder#gtBlockstate(NonNullBiConsumer)} as such: + * + *
+ * {@code
+ *     // on your pipe block builder
+ *     ... = REGISTRATE.block(...)
+ *              .properties(...)
+ *              .gtBlockstate(GTModels::createPipeBlockModel)
+ *              ...more builder things...
+ *              .item(...)
+ *              .model(NonNullBiConsumer.noop())
+ *              ...more builder things...
+ * }
+ * 
+ * + * This makes the pipe model(s) be generated for you without having to process them at runtime. + * + */ +public class PipeModel { + + public static final Set DYNAMIC_MODELS = new HashSet<>(); + + public static void initDynamicModels() { + for (PipeModel generator : DYNAMIC_MODELS) { + generator.initModels(); + } + } + + @Getter + private final PipeBlock block; + public final @NotNull ResourceLocation blockId; + protected final GTBlockstateProvider provider; + + /** + * The pipe's "thickness" in the (0,16] voxel range, where 1 is 1 voxel and 16 is a full block thick + */ + protected final float thickness; + /** + * The pipe model's 'minimum' coordinate in the (0,16] voxel range.
+ * This is ex. the height of the center part's bottom edge. + */ + protected final float minCoord; + /** + * The pipe model's 'maximum' coordinate in the (0,16] voxel range.
+ * This is ex. the height of the center part's top edge. + */ + protected final float maxCoord; + @Setter + public ResourceLocation side, end; + @Setter + public @Nullable ResourceLocation sideSecondary, endSecondary; + @Setter + public @Nullable ResourceLocation sideOverlay, endOverlay; + + /// Use {@link #getOrCreateBlockModel()} instead of referencing this field directly. + private BlockModelBuilder blockModel; + /// Use {@link #getOrCreateItemModel()} instead of referencing this field directly. + private ItemModelBuilder itemModel; + + /// Use {@link #getOrCreateCenterElement()} instead of referencing this field directly. + private BlockModelBuilder centerElement; + /// Use {@link #getOrCreateConnectionElement()} instead of referencing this field directly. + private BlockModelBuilder connectionElement; + + public PipeModel(PipeBlock block, GTBlockstateProvider provider, + float thickness, ResourceLocation side, ResourceLocation end) { + this.block = block; + this.blockId = BuiltInRegistries.BLOCK.getKey(this.block); + this.provider = provider; + + // assume thickness is in the 0-1 range + this.thickness = thickness * 16.0f; + this.side = side; + this.end = end; + + this.minCoord = (16.0f - this.thickness) / 2.0f; + this.maxCoord = this.minCoord + this.thickness; + } + + public final void dynamicModel() { + DYNAMIC_MODELS.add(this); + } + + /** + * Initialize all models that are required for this block model to exist.
+ * Order is important! Dependent models must be initialized after their dependencies. + * + * @see #getOrCreateBlockModel() + * @see #getOrCreateCenterElement() + * @see #getOrCreateConnectionElement() + */ + public void initModels() { + getOrCreateCenterElement(); + getOrCreateConnectionElement(); + getOrCreateBlockModel(); + createBlockState(); + + getOrCreateItemModel(); + } + + /** + * Override this to change the actual model {@link #block this.block} will use. + * + * @return A model builder for the block's actual model. + * @see #getOrCreateCenterElement() + * @see #getOrCreateConnectionElement() + */ + @ApiStatus.OverrideOnly + protected BlockModelBuilder getOrCreateBlockModel() { + if (this.blockModel != null) { + return this.blockModel; + } + // spotless:off + return this.blockModel = this.provider.models().getBuilder(this.blockId.toString()) + // make the "default" model be based on the center part's model + .parent(this.getOrCreateCenterElement()) + .customLoader(PipeModelBuilder::begin) + .thickness(this.thickness).provider(this.provider) + .centerModels(this.getOrCreateCenterElement().getLocation()) + .connectionModels(this.getOrCreateConnectionElement().getLocation()) + .end(); + // spotless:on + } + + /** + * Override this to change the center element's model. + * + * @return A model builder for the center element's model. + * @see #getOrCreateBlockModel() + * @see #getOrCreateConnectionElement() + */ + @ApiStatus.OverrideOnly + protected BlockModelBuilder getOrCreateCenterElement() { + if (this.centerElement != null) { + return this.centerElement; + } + return this.centerElement = makeElementModel(this.blockId.withPath(path -> "block/pipe/" + path + "/center"), + null, minCoord, minCoord, minCoord, maxCoord, maxCoord, maxCoord); + } + + /** + * Override this to change the 'connection' element's model.
+ * By default, this is rotated & used for all connected sides of the pipe.
+ * Note that that is not a hard requirement, and that you may set a model per side in + * {@link #getOrCreateBlockModel()}. + * + * @return A model builder for the connection element's model. + * @see #getOrCreateBlockModel() + * @see #getOrCreateCenterElement() + */ + @ApiStatus.OverrideOnly + protected BlockModelBuilder getOrCreateConnectionElement() { + if (this.connectionElement != null) { + return this.connectionElement; + } + return this.connectionElement = makeElementModel( + this.blockId.withPath(path -> "block/pipe/" + path + "/connection"), + Direction.DOWN, minCoord, 0, minCoord, maxCoord, minCoord, maxCoord); + } + + /** + * Override this to change the item model.
+ * By default, this creates a version of the pipe block model with the north & south sides 'connected'. + * + * @return The item model builder. + * @see #getOrCreateBlockModel() + */ + @ApiStatus.OverrideOnly + protected ItemModelBuilder getOrCreateItemModel() { + return createItemModel(this.blockId, this.minCoord, this.maxCoord); + } + + /** + * Override this to change the block state set {@link #block this.block} will use.
+ * By default, this creates a simple block state with no properties.
+ * The activable pipes (laser & optical) use this to add a model for the + * {@link GTBlockStateProperties#ACTIVE "active"} state of the blocks. + * + * @return The block state generator, usually a {@link MultiVariantGenerator}. + * @see #getOrCreateBlockModel() + * @see ActivablePipeModel#createBlockState() + */ + @ApiStatus.OverrideOnly + public IGeneratedBlockState createBlockState() { + // spotless:off + return this.provider.getVariantBuilder(this.getBlock()) + .partialState() + .modelForState() + .modelFile(this.provider.models().getExistingFile(this.blockId)) + .addModel(); + // spotless:on + } + + /** + * Creates an item model based on the block model that extends to the north/south end of the block space. + * + * @param name The resulting model's path. + * @param min The minimum X/Y coordinate. + * @param max The maximum X/Y coordinate. + * @return An item model builder. + */ + protected ItemModelBuilder createItemModel(ResourceLocation name, float min, float max) { + Reference2FloatMap faceEndpoints = new Reference2FloatOpenHashMap<>(); + faceEndpoints.put(Direction.DOWN, min); + faceEndpoints.put(Direction.UP, max); + faceEndpoints.put(Direction.NORTH, 0); + faceEndpoints.put(Direction.SOUTH, 16); + faceEndpoints.put(Direction.WEST, min); + faceEndpoints.put(Direction.EAST, max); + + ItemModelBuilder model = this.provider.itemModels().getBuilder(name.toString()) + .parent(this.getOrCreateCenterElement()); + makePartModelElement(model, Direction.NORTH, false, faceEndpoints, 0.0f, 0, 1, + min, min, 0, max, max, 16, this.side, this.end, "side", "end"); + makePartModelElement(model, Direction.NORTH, true, faceEndpoints, 0.001f, 0, 1, + min, min, 0, max, max, 16, this.sideSecondary, this.endSecondary, "side_secondary", "end_secondary"); + makePartModelElement(model, Direction.NORTH, true, faceEndpoints, 0.002f, 2, 2, + min, min, 0, max, max, 16, this.sideOverlay, this.endOverlay, "side_overlay", "end_overlay"); + return model; + } + + /** + * Fills out a model builder with applicable pipe model elements and returns it for further use + * + * @param name the resulting model's path + * @param endFace the model face that's being created + * @param x1 min X coordinate in the range [-16,32] + * @param y1 min Y coordinate in the range [-16,32] + * @param z1 min Z coordinate in the range [-16,32] + * @param x2 max X coordinate in the range [-16,32] + * @param y2 max Y coordinate in the range [-16,32] + * @param z2 max Z coordinate in the range [-16,32] + * @implNote The coordinates must be in the correct order or the resulting model's cubes will be inside out! + */ + protected BlockModelBuilder makeElementModel(ResourceLocation name, @Nullable Direction endFace, + final float x1, final float y1, final float z1, + final float x2, final float y2, final float z2) { + Reference2FloatMap faceEndpoints = new Reference2FloatOpenHashMap<>(); + faceEndpoints.defaultReturnValue(GTMath.max(x1, y1, z1, x2, y2, z2)); + for (Direction dir : GTUtil.DIRECTIONS) { + faceEndpoints.put(dir, switch (dir) { + case DOWN -> Math.min(y1, y2); + case UP -> Math.max(y1, y2); + case NORTH -> Math.min(z1, z2); + case SOUTH -> Math.max(z1, z2); + case WEST -> Math.min(x1, x2); + case EAST -> Math.max(x1, x2); + }); + } + + BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) + .parent(new ModelFile.UncheckedModelFile("block/block")); + makePartModelElement(model, endFace, false, faceEndpoints, 0.0f, 0, 1, + x1, y1, z1, x2, y2, z2, this.side, this.end, "side", "end"); + makePartModelElement(model, endFace, true, faceEndpoints, 0.001f, 0, 1, + x1, y1, z1, x2, y2, z2, this.sideSecondary, this.endSecondary, "side_secondary", "end_secondary"); + makePartModelElement(model, endFace, true, faceEndpoints, 0.002f, 2, 2, + x1, y1, z1, x2, y2, z2, this.sideOverlay, this.endOverlay, "side_overlay", "end_overlay"); + return model; + } + + protected > void makePartModelElement(T model, @Nullable Direction endFace, + boolean useEndWithFullCube, + Reference2FloatMap faceEndpoints, + float offset, int sideTintIndex, int endTintIndex, + final float x1, final float y1, final float z1, + final float x2, final float y2, final float z2, + @Nullable ResourceLocation sideTexture, + @Nullable ResourceLocation endTexture, + String sideKey, String endKey) { + if (sideTexture == null && endTexture == null) { + return; + } + if (sideTexture != null) model.texture(sideKey, sideTexture); + if (endTexture != null) model.texture(endKey, endTexture); + + boolean fullCube = !useEndWithFullCube && + (x1 == y1 && x1 == z1 && x1 <= 0.0f) && + (x2 == y2 && x2 == z2 && x2 >= 16.0f); + + ModelBuilder.ElementBuilder element = model.element() + .from(x1 - offset, y1 - offset, z1 - offset) + .to(x2 + offset, y2 + offset, z2 + offset); + + for (Direction dir : GTUtil.DIRECTIONS) { + ModelBuilder.ElementBuilder.FaceBuilder face = null; + boolean isEnd = (endFace == dir || endFace == dir.getOpposite()) && !fullCube; + if (isEnd && endTexture != null) { + face = element.face(dir).texture("#" + endKey).tintindex(endTintIndex); + } else if (!isEnd && sideTexture != null) { + face = element.face(dir).texture("#" + sideKey).tintindex(sideTintIndex); + } + + float faceEnd = faceEndpoints.getFloat(dir); + if (face != null && (faceEnd >= 16.0f || faceEnd <= 0.0f)) { + face.cullface(dir); + } + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof PipeModel pipeModel)) return false; + return block == pipeModel.block && + Objects.equals(side, pipeModel.side) && + Objects.equals(end, pipeModel.end) && + Objects.equals(sideSecondary, pipeModel.sideSecondary) && + Objects.equals(endSecondary, pipeModel.endSecondary) && + Objects.equals(sideOverlay, pipeModel.sideOverlay) && + Objects.equals(endOverlay, pipeModel.endOverlay); + } + + @Override + public int hashCode() { + return Objects.hash(block, side, end, sideSecondary, endSecondary, sideOverlay, endOverlay); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModelLoader.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModelLoader.java new file mode 100644 index 00000000000..9465b8f8471 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModelLoader.java @@ -0,0 +1,62 @@ +package com.gregtechceu.gtceu.client.model.pipe; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.client.model.machine.MachineModelLoader; +import com.gregtechceu.gtceu.client.model.machine.variant.MultiVariantModel; + +import net.minecraft.client.resources.model.UnbakedModel; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraftforge.client.model.geometry.IGeometryLoader; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import org.jetbrains.annotations.Nullable; + +import java.util.*; + +public class PipeModelLoader implements IGeometryLoader { + + public static final PipeModelLoader INSTANCE = new PipeModelLoader(); + public static final ResourceLocation ID = GTCEu.id("pipe"); + public static final String PRIMARY_CENTER_KEY = "center"; + public static final Set CENTER_KEYS = Set.of(PRIMARY_CENTER_KEY, "core", "null", "none"); + + @Override + public @Nullable UnbakedPipeModel read(JsonObject json, + JsonDeserializationContext context) throws JsonParseException { + // load the inner models + final Map parts = new HashMap<>(); + if (json.has("parts")) { + JsonObject variantsJson = GsonHelper.getAsJsonObject(json, "parts"); + for (Map.Entry entry : variantsJson.entrySet()) { + Direction direction = Direction.byName(entry.getKey()); + if (direction == null && !CENTER_KEYS.contains(entry.getKey().toLowerCase(Locale.ROOT))) { + throw new JsonParseException("Invalid pipe model part specifier " + entry.getKey()); + } + if (direction == null && parts.get(null) != null) { + throw new JsonParseException("Cannot specify more than one 'center' model for a pipe model"); + } + + parts.put(direction, MachineModelLoader.GSON.fromJson(entry.getValue(), MultiVariantModel.class)); + } + } + // and the restrictors + final Map restrictors = new HashMap<>(); + if (json.has("restrictors")) { + JsonObject variantsJson = GsonHelper.getAsJsonObject(json, "restrictors"); + for (Map.Entry entry : variantsJson.entrySet()) { + Direction direction = Direction.byName(entry.getKey()); + if (direction == null) { + throw new JsonParseException("Invalid pipe model part specifier " + entry.getKey()); + } + restrictors.put(direction, MachineModelLoader.GSON.fromJson(entry.getValue(), MultiVariantModel.class)); + } + } + + return new UnbakedPipeModel(parts, restrictors); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/UnbakedPipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/UnbakedPipeModel.java new file mode 100644 index 00000000000..5ea5e68ac76 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/UnbakedPipeModel.java @@ -0,0 +1,71 @@ +package com.gregtechceu.gtceu.client.model.pipe; + +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.*; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.model.geometry.IGeometryBakingContext; +import net.minecraftforge.client.model.geometry.IUnbakedGeometry; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.function.Function; + +import static com.gregtechceu.gtceu.client.model.machine.MachineModelLoader.MISSING_MARKER; + +public class UnbakedPipeModel implements IUnbakedGeometry { + + private final Map<@Nullable Direction, UnbakedModel> parts; + private final Map<@NotNull Direction, UnbakedModel> restrictors; + + public UnbakedPipeModel(Map<@Nullable Direction, UnbakedModel> parts, + Map<@NotNull Direction, UnbakedModel> restrictors) { + this.parts = parts; + this.restrictors = restrictors; + } + + @Override + public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, + Function spriteGetter, ModelState modelState, + ItemOverrides overrides, ResourceLocation modelLocation) { + Map bakedParts = new IdentityHashMap<>(); + this.parts.forEach((direction, unbaked) -> { + bakedParts.put(direction, unbaked.bake(baker, spriteGetter, modelState, modelLocation)); + }); + Map bakedRestrictors = new IdentityHashMap<>(); + this.restrictors.forEach((direction, unbaked) -> { + bakedRestrictors.put(direction, unbaked.bake(baker, spriteGetter, modelState, modelLocation)); + }); + return new BakedPipeModel(bakedParts, bakedRestrictors); + } + + @Override + public void resolveParents(Function resolver, IGeometryBakingContext context) { + UnbakedModel missingModel = resolver.apply(ModelBakery.MISSING_MODEL_LOCATION); + + Map copy = new IdentityHashMap<>(this.parts); + copy.forEach((side, variant) -> { + if (variant == null || variant == MISSING_MARKER) { + // replace null & markers with the actual missing model + this.parts.put(side, missingModel); + } else { + variant.resolveParents(resolver); + this.parts.put(side, variant); + } + }); + copy = new IdentityHashMap<>(this.restrictors); + copy.forEach((side, variant) -> { + if (variant == null || variant == MISSING_MARKER) { + // replace null & markers with the actual missing model + this.restrictors.put(side, missingModel); + } else { + variant.resolveParents(resolver); + this.restrictors.put(side, variant); + } + }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/package-info.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/package-info.java new file mode 100644 index 00000000000..481c46780dc --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +package com.gregtechceu.gtceu.client.model.pipe; + +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockEntityWithBERModelRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockEntityWithBERModelRenderer.java index 3508a6e860e..511730ca9aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockEntityWithBERModelRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockEntityWithBERModelRenderer.java @@ -45,7 +45,7 @@ public void render(T blockEntity, float partialTick, BakedModel model = blockRenderDispatcher.getBlockModel(blockState); if (model instanceof IBlockEntityRendererBakedModel berModel) { - if (berModel.getBlockEntityType() != blockEntity.getType()) return; + if (berModel.getBlockEntityType() != null && berModel.getBlockEntityType() != blockEntity.getType()) return; ((IBlockEntityRendererBakedModel) berModel).render(blockEntity, partialTick, poseStack, buffer, packedLight, packedOverlay); @@ -79,7 +79,7 @@ public boolean shouldRenderOffScreen(T blockEntity) { BakedModel model = blockRenderDispatcher.getBlockModel(blockState); if (model instanceof IBlockEntityRendererBakedModel berModel) { - if (berModel.getBlockEntityType() == blockEntity.getType()) { + if (berModel.getBlockEntityType() != null && berModel.getBlockEntityType() == blockEntity.getType()) { return ((IBlockEntityRendererBakedModel) berModel).shouldRenderOffScreen(blockEntity); } } @@ -92,7 +92,7 @@ public boolean shouldRender(T blockEntity, Vec3 cameraPos) { BakedModel model = blockRenderDispatcher.getBlockModel(blockState); if (model instanceof IBlockEntityRendererBakedModel berModel) { - if (berModel.getBlockEntityType() == blockEntity.getType()) { + if (berModel.getBlockEntityType() != null && berModel.getBlockEntityType() == blockEntity.getType()) { return ((IBlockEntityRendererBakedModel) berModel).shouldRender(blockEntity, cameraPos); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java new file mode 100644 index 00000000000..aed2072c637 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java @@ -0,0 +1,54 @@ +package com.gregtechceu.gtceu.client.renderer.block; + +import com.gregtechceu.gtceu.api.item.LampBlockItem; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import org.jetbrains.annotations.NotNull; + +/** + * All this renderer does is refer rendering to the correct block model based on the lamp item's NBT.
+ * Without it, all item variants would look like the default 'lit, with bloom' one. + */ +public class LampItemRenderer extends BlockEntityWithoutLevelRenderer { + + public static final LampItemRenderer INSTANCE = new LampItemRenderer(); + + protected final ItemRenderer itemRenderer; + protected final BlockRenderDispatcher blockRenderer; + + protected LampItemRenderer() { + super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), + Minecraft.getInstance().getEntityModels()); + this.itemRenderer = Minecraft.getInstance().getItemRenderer(); + this.blockRenderer = Minecraft.getInstance().getBlockRenderer(); + } + + @Override + public void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, + @NotNull PoseStack poseStack, @NotNull MultiBufferSource buffer, + int packedLight, int packedOverlay) { + if (!(stack.getItem() instanceof LampBlockItem item)) { + return; + } + BlockState state = item.getStateFromStack(stack, null); + BakedModel p_model = blockRenderer.getBlockModel(state); + + for (var model : p_model.getRenderPasses(stack, true)) { + for (var rendertype : model.getRenderTypes(stack, true)) { + VertexConsumer foilBuffer = ItemRenderer.getFoilBufferDirect(buffer, rendertype, true, stack.hasFoil()); + itemRenderer.renderModelLists(model, stack, packedLight, packedOverlay, poseStack, foilBuffer); + } + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampRenderer.java deleted file mode 100644 index a9552b7ea83..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampRenderer.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.gregtechceu.gtceu.client.renderer.block; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.common.block.LampBlock; - -import com.lowdragmc.lowdraglib.client.model.custommodel.ICTMPredicate; -import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -public class LampRenderer extends IModelRenderer implements ICTMPredicate { - - public LampRenderer(LampBlock lamp, BlockState state) { - super(GTCEu.id("block/%s%s_lamp%s%s".formatted( - lamp.color, - lamp.bordered ? "" : "_borderless", - state.getValue(LampBlock.LIGHT) ? "" : "_off", - state.getValue(LampBlock.LIGHT) && state.getValue(LampBlock.BLOOM) ? "_bloom" : ""))); - } - - @Override - public boolean isConnected(BlockAndTintGetter level, BlockState state, BlockPos pos, - BlockState sourceState, BlockPos sourcePos, Direction side) { - var stateAppearance = state.getAppearance(level, pos, side, sourceState, sourcePos); - var sourceStateAppearance = sourceState.getAppearance(level, sourcePos, side, state, pos); - return stateAppearance.getBlock() == sourceStateAppearance.getBlock(); - } - - @Override - @OnlyIn(Dist.CLIENT) - public boolean useAO() { - return true; - } - - @Override - public boolean reBakeCustomQuads() { - return true; - } - - @Override - public float reBakeCustomQuadsOffset() { - return 0.0f; - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java index 563f1bc6682..fbd6bff6240 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java @@ -75,12 +75,14 @@ public static void cloneBlockModel(ResourceLocation modelId, TagPrefix prefix, M JsonObject newJson = original.deepCopy(); JsonObject children = newJson.getAsJsonObject("children"); // add the base stone texture. - children.getAsJsonObject("base_stone").addProperty("parent", - TagPrefix.ORES.get(prefix).baseModelLocation().toString()); + children.getAsJsonObject("base_stone") + .addProperty("parent", TagPrefix.ORES.get(prefix).baseModelLocation().toString()); + + ResourceLocation layer0 = prefix.materialIconType() + .getBlockTexturePath(material.getMaterialIconSet(), true); + ResourceLocation layer1 = prefix.materialIconType() + .getBlockTexturePath(material.getMaterialIconSet(), "layer2", true); - ResourceLocation layer0 = prefix.materialIconType().getBlockTexturePath(material.getMaterialIconSet(), true); - ResourceLocation layer1 = prefix.materialIconType().getBlockTexturePath(material.getMaterialIconSet(), "layer2", - true); JsonObject oresTextures = children.getAsJsonObject("ore_texture").getAsJsonObject("textures"); oresTextures.addProperty("layer0", layer0.toString()); oresTextures.addProperty("layer1", layer1.toString()); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java deleted file mode 100644 index b06ac84c7ce..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.gregtechceu.gtceu.client.renderer.block; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.tag.TagPrefix; -import com.gregtechceu.gtceu.api.pipenet.IPipeNode; -import com.gregtechceu.gtceu.client.model.PipeModel; -import com.gregtechceu.gtceu.client.renderer.cover.ICoverableRenderer; -import com.gregtechceu.gtceu.client.util.GTQuadTransformers; -import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; -import com.gregtechceu.gtceu.utils.GTUtil; - -import com.lowdragmc.lowdraglib.client.renderer.IRenderer; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.color.block.BlockColors; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.RandomSource; -import net.minecraft.world.item.ItemDisplayContext; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.model.data.ModelData; - -import com.mojang.blaze3d.vertex.PoseStack; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -import java.util.LinkedList; -import java.util.List; -import java.util.function.Consumer; - -import static com.lowdragmc.lowdraglib.client.model.forge.LDLRendererModel.RendererBakedModel.*; - -public class PipeBlockRenderer implements IRenderer, ICoverableRenderer { - - @Getter - PipeModel pipeModel; - - public PipeBlockRenderer(PipeModel pipeModel) { - this.pipeModel = pipeModel; - if (GTCEu.isClientSide()) { - registerEvent(); - } - } - - @Override - @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, - ItemDisplayContext transformType, - boolean leftHand, PoseStack matrixStack, - MultiBufferSource buffer, int combinedLight, - int combinedOverlay, BakedModel model) { - pipeModel.renderItem(stack, transformType, leftHand, matrixStack, buffer, combinedLight, combinedOverlay, - model); - } - - @Override - public boolean useAO() { - return true; - } - - @Override - @OnlyIn(Dist.CLIENT) - public boolean useBlockLight(ItemStack stack) { - return true; - } - - @Override - @OnlyIn(Dist.CLIENT) - public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, - RandomSource rand) { - if (level == null) { - return pipeModel.bakeQuads(side, PipeModel.ITEM_CONNECTIONS, 0); - } - if (!(level.getBlockEntity(pos) instanceof IPipeNode pipeNode)) { - return pipeModel.bakeQuads(side, 0, 0); - } - RenderType renderType = CURRENT_RENDER_TYPE.get(); - ModelData modelData = CURRENT_MODEL_DATA.get().get(MODEL_DATA); - if (modelData == null) modelData = ModelData.EMPTY; - - List quads = new LinkedList<>(); - - if (renderType == null || renderType == RenderType.cutoutMipped()) { - quads.addAll(pipeModel.bakeQuads(side, pipeNode.getVisualConnections(), pipeNode.getBlockedConnections())); - } - ICoverableRenderer.super.renderCovers(quads, pipeNode.getCoverContainer(), pos, level, side, rand, - modelData, renderType); - - if (pipeNode.getFrameMaterial().isNull() || (renderType != null && renderType != RenderType.translucent())) { - return quads; - } - - BlockState frameState = GTMaterialBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, pipeNode.getFrameMaterial()) - .getDefaultState(); - BakedModel frameModel = Minecraft.getInstance().getBlockRenderer().getBlockModel(frameState); - - modelData = frameModel.getModelData(level, pos, frameState, modelData); - - List frameQuads = new LinkedList<>(); - if (side == null || pipeNode.getCoverContainer().getCoverAtSide(side) == null) { - frameQuads.addAll(frameModel.getQuads(state, side, rand, modelData, renderType)); - } - if (side == null) { - for (Direction face : GTUtil.DIRECTIONS) { - if (pipeNode.getCoverContainer().getCoverAtSide(face) != null) { - continue; - } - frameQuads.addAll(frameModel.getQuads(state, face, rand, modelData, renderType)); - } - } - - // bake all the quads' tint colors into the vertices - BlockColors blockColors = Minecraft.getInstance().getBlockColors(); - for (BakedQuad frameQuad : frameQuads) { - if (frameQuad.isTinted()) { - int color = blockColors.getColor(frameState, level, pos, frameQuad.getTintIndex()); - frameQuad = GTQuadTransformers.setColor(frameQuad, color, true); - } - quads.add(frameQuad); - } - return quads; - } - - @NotNull - @Override - @OnlyIn(Dist.CLIENT) - public TextureAtlasSprite getParticleTexture() { - return pipeModel.getParticleTexture(); - } - - @Override - @OnlyIn(Dist.CLIENT) - public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer register) { - if (atlasName.equals(TextureAtlas.LOCATION_BLOCKS)) { - pipeModel.registerTextureAtlas(register); - } - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java index e1542d349f3..1abacd672cb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java @@ -11,7 +11,8 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; -import com.gregtechceu.gtceu.client.model.PipeModel; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTDamageTypes; @@ -54,7 +55,7 @@ public CableBlock(Properties properties, Insulation insulation, Material materia @Override public int tinted(BlockState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos, int index) { - if (pipeType.isCable && index == 0) { + if (pipeType.isCable && (index == 0 || index == 2)) { return 0x404040; } return super.tinted(state, level, pos, index); @@ -94,8 +95,8 @@ public boolean canPipeConnectToBlock(IPipeNode selfT } @Override - protected PipeModel createPipeModel() { - return pipeType.createPipeModel(material); + public PipeModel createPipeModel(GTBlockstateProvider provider) { + return pipeType.createPipeModel(this, material, provider); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/DuctPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/DuctPipeBlock.java index f08d13c97f9..69306723f59 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/DuctPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/DuctPipeBlock.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.common.block; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; @@ -7,8 +8,8 @@ import com.gregtechceu.gtceu.api.machine.feature.IEnvironmentalHazardCleaner; import com.gregtechceu.gtceu.api.machine.feature.IEnvironmentalHazardEmitter; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; -import com.gregtechceu.gtceu.client.model.PipeModel; -import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import com.gregtechceu.gtceu.common.blockentity.DuctPipeBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.pipelike.duct.DuctPipeProperties; @@ -36,15 +37,11 @@ @MethodsReturnNonnullByDefault public class DuctPipeBlock extends PipeBlock { - public final PipeBlockRenderer renderer; - public final PipeModel model; private final DuctPipeProperties properties; public DuctPipeBlock(Properties properties, DuctPipeType type) { super(properties, type); this.properties = new DuctPipeProperties(type.getRateMultiplier()); - this.model = type.createPipeModel(); - this.renderer = new PipeBlockRenderer(this.model); } @Override @@ -75,13 +72,9 @@ public DuctPipeProperties getFallbackType() { } @Override - public @Nullable PipeBlockRenderer getRenderer(BlockState state) { - return renderer; - } - - @Override - protected PipeModel getPipeModel() { - return model; + public PipeModel createPipeModel(GTBlockstateProvider provider) { + return new PipeModel(this, provider, this.pipeType.getThickness(), + GTCEu.id("block/pipe/pipe_duct_side"), GTCEu.id("block/pipe/pipe_duct_in")); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/FluidPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/FluidPipeBlock.java index 3b0173a574b..1af49f770c2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/FluidPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/FluidPipeBlock.java @@ -8,7 +8,8 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; -import com.gregtechceu.gtceu.client.model.PipeModel; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; @@ -82,8 +83,8 @@ public boolean canPipeConnectToBlock(IPipeNode renderers = new IdentityHashMap<>(); public LampBlock(Properties properties, DyeColor color, boolean bordered) { super(properties); @@ -65,9 +60,6 @@ public LampBlock(Properties properties, DyeColor color, boolean bordered) { .setValue(LIGHT, true) .setValue(INVERTED, false) .setValue(POWERED, false)); - for (BlockState state : getStateDefinition().getPossibleStates()) { - renderers.put(state, new LampRenderer(this, state)); - } } public static boolean isLightActive(BlockState state) { @@ -126,6 +118,12 @@ public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { return state.getValue(LIGHT) && isLightActive(state) ? 15 : 0; } + @Override + public BlockState getAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + @Nullable BlockState queryState, @Nullable BlockPos queryPos) { + return state.getBlock().defaultBlockState(); + } + @Override @SuppressWarnings("deprecation") public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { @@ -192,10 +190,4 @@ public List getDrops(BlockState state, LootParams.Builder params) { } return returnValue; } - - @Nullable - @Override - public IRenderer getRenderer(BlockState state) { - return renderers.get(state); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java index 4b99ed7cdeb..311338b6a1f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.PipeBlock; +import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; -import com.gregtechceu.gtceu.client.model.PipeModel; -import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.ActivablePipeModel; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import com.gregtechceu.gtceu.common.blockentity.LaserPipeBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.pipelike.laser.LaserPipeProperties; @@ -19,9 +21,11 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -33,23 +37,20 @@ @MethodsReturnNonnullByDefault public class LaserPipeBlock extends PipeBlock { - public final PipeBlockRenderer renderer; - public final PipeModel model; private final LaserPipeProperties properties; public LaserPipeBlock(Properties properties, LaserPipeType type) { super(properties, type); this.properties = LaserPipeProperties.INSTANCE; - this.model = new PipeModel(LaserPipeType.NORMAL.getThickness(), () -> GTCEu.id("block/pipe/pipe_laser_side"), - () -> GTCEu.id("block/pipe/pipe_laser_in"), null, null); - this.renderer = new PipeBlockRenderer(this.model); + + registerDefaultState(defaultBlockState().setValue(GTBlockStateProperties.ACTIVE, false)); } @OnlyIn(Dist.CLIENT) public static BlockColor tintedColor() { - return (blockState, level, blockPos, index) -> { - if (blockPos != null && level != null && - level.getBlockEntity(blockPos) instanceof PipeBlockEntity pipe) { + return (state, level, pos, index) -> { + if (pos != null && level != null && + level.getBlockEntity(pos) instanceof PipeBlockEntity pipe) { if (!pipe.getFrameMaterial().isNull()) { if (index == 3) { return pipe.getFrameMaterial().getMaterialRGB(); @@ -65,6 +66,12 @@ public static BlockColor tintedColor() { }; } + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); + builder.add(GTBlockStateProperties.ACTIVE); + } + @Override public LevelLaserPipeNet getWorldPipeNet(ServerLevel world) { return LevelLaserPipeNet.getOrCreate(world); @@ -93,12 +100,12 @@ public LaserPipeProperties getFallbackType() { } @Override - public @Nullable PipeBlockRenderer getRenderer(BlockState state) { - return renderer; - } - - @Override - protected PipeModel getPipeModel() { + public PipeModel createPipeModel(GTBlockstateProvider provider) { + ActivablePipeModel model = new ActivablePipeModel(this, LaserPipeType.NORMAL.getThickness(), + GTCEu.id("block/pipe/pipe_laser_side"), GTCEu.id("block/pipe/pipe_laser_in"), + provider); + model.setSideOverlay(GTCEu.id("block/pipe/pipe_laser_side_overlay")); + model.setSideOverlayActive(GTCEu.id("block/pipe/pipe_laser_side_overlay_emissive")); return model; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java index 07d7e22be23..c710e296547 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.PipeBlock; +import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; -import com.gregtechceu.gtceu.client.model.PipeModel; -import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.ActivablePipeModel; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.pipelike.optical.LevelOpticalPipeNet; @@ -18,14 +20,15 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,20 +37,29 @@ @ParametersAreNonnullByDefault public class OpticalPipeBlock extends PipeBlock { - public final PipeBlockRenderer renderer; - @Getter - public final PipeModel pipeModel; - - private final OpticalPipeType pipeType; private final OpticalPipeProperties properties; - public OpticalPipeBlock(BlockBehaviour.Properties properties, @NotNull OpticalPipeType pipeType) { + public OpticalPipeBlock(BlockBehaviour.Properties properties, OpticalPipeType pipeType) { super(properties, pipeType); - this.pipeType = pipeType; this.properties = OpticalPipeProperties.INSTANCE; - this.pipeModel = new PipeModel(pipeType.getThickness(), () -> GTCEu.id("block/pipe/pipe_optical_side"), - () -> GTCEu.id("block/pipe/pipe_optical_in"), null, null); - this.renderer = new PipeBlockRenderer(this.pipeModel); + + registerDefaultState(defaultBlockState().setValue(GTBlockStateProperties.ACTIVE, false)); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); + builder.add(GTBlockStateProperties.ACTIVE); + } + + @Override + public @NotNull PipeModel createPipeModel(GTBlockstateProvider provider) { + ActivablePipeModel pipeModel = new ActivablePipeModel(this, pipeType.getThickness(), + GTCEu.id("block/pipe/pipe_optical_side"), GTCEu.id("block/pipe/pipe_optical_in"), + provider); + pipeModel.setSideOverlay(GTCEu.id("block/pipe/pipe_optical_side_overlay")); + pipeModel.setSideOverlayActive(GTCEu.id("block/pipe/pipe_optical_side_overlay_active")); + return pipeModel; } @Override @@ -77,11 +89,6 @@ public OpticalPipeProperties getFallbackType() { return OpticalPipeProperties.INSTANCE; } - @Override - public @Nullable PipeBlockRenderer getRenderer(BlockState state) { - return renderer; - } - @OnlyIn(Dist.CLIENT) public static BlockColor tintedColor() { return (blockState, level, blockPos, index) -> { diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java index bdad968b985..9845dd66447 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java @@ -74,10 +74,6 @@ public CableBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockS super(type, pos, blockState); } - public static CableBlockEntity create(BlockEntityType type, BlockPos pos, BlockState blockState) { - return new CableBlockEntity(type, pos, blockState); - } - @Override public @NotNull LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { if (cap == GTCapability.CAPABILITY_ENERGY_CONTAINER) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/DuctPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/DuctPipeBlockEntity.java index d2e27a69840..075cc58e284 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/DuctPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/DuctPipeBlockEntity.java @@ -36,14 +36,10 @@ public class DuctPipeBlockEntity extends PipeBlockEntity type, BlockPos pos, BlockState blockState) { + public DuctPipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { super(type, pos, blockState); } - public static DuctPipeBlockEntity create(BlockEntityType type, BlockPos pos, BlockState blockState) { - return new DuctPipeBlockEntity(type, pos, blockState); - } - public static void onBlockEntityRegister(BlockEntityType ductBlockEntityBlockEntityType) {} @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java index 5fa341fd83e..f222c06da11 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java @@ -50,10 +50,6 @@ public ItemPipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState blo super(type, pos, blockState); } - public static ItemPipeBlockEntity create(BlockEntityType type, BlockPos pos, BlockState blockState) { - return new ItemPipeBlockEntity(type, pos, blockState); - } - public long getLevelTime() { return hasLevel() ? Objects.requireNonNull(getLevel()).getGameTime() : 0L; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java index e16ffb9b549..3d8784ca767 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.common.blockentity; +import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ILaserContainer; @@ -10,13 +11,11 @@ import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.TaskHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; -import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -32,9 +31,6 @@ public class LaserPipeBlockEntity extends PipeBlockEntity { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LaserPipeBlockEntity.class, - PipeBlockEntity.MANAGED_FIELD_HOLDER); - @Getter protected final EnumMap handlers = new EnumMap<>(Direction.class); // the LaserNetHandler can only be created on the server, so we have an empty placeholder for the client @@ -43,21 +39,10 @@ public class LaserPipeBlockEntity extends PipeBlockEntity type, BlockPos pos, BlockState blockState) { + public LaserPipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { super(type, pos, blockState); } - public static LaserPipeBlockEntity create(BlockEntityType type, BlockPos pos, BlockState blockState) { - return new LaserPipeBlockEntity(type, pos, blockState); - } - public static void onBlockEntityRegister(BlockEntityType cableBlockEntityBlockEntityType) {} @Override @@ -127,28 +112,11 @@ public LaserPipeNet getLaserPipeNet() { * @param duration how long the pipe should be active for */ public void setActive(boolean active, int duration) { - if (this.active != active) { - this.active = active; - notifyBlockUpdate(); - setChanged(); - if (active && duration != this.activeDuration) { - TaskHandler.enqueueServerTask((ServerLevel) getLevel(), this::queueDisconnect, 0); - } - } - - this.activeDuration = duration; - if (duration > 0 && active) { - this.ticksActive = 0; - } + setPipeActive(this, this.getBlockState(), active, duration); } - public boolean queueDisconnect() { - if (++this.ticksActive % activeDuration == 0) { - this.ticksActive = 0; - setActive(false, -1); - return false; - } - return true; + public boolean isActive() { + return this.getBlockState().getValue(GTBlockStateProperties.ACTIVE); } @Override @@ -189,9 +157,26 @@ public GTToolType getPipeTuneTool() { return GTToolType.WIRE_CUTTER; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + public static BlockState setPipeActive(PipeBlockEntity blockEntity, + BlockState state, boolean newActive, int duration) { + if (!state.hasProperty(GTBlockStateProperties.ACTIVE) || + state.getValue(GTBlockStateProperties.ACTIVE) == newActive) { + return state; + } + BlockState newState = state.setValue(GTBlockStateProperties.ACTIVE, newActive); + if (blockEntity == null || blockEntity.getLevel() == null || blockEntity.isRemoved()) { + return newState; + } + Level level = blockEntity.getLevel(); + + level.setBlock(blockEntity.getBlockPos(), newState, Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE); + blockEntity.notifyBlockUpdate(); + blockEntity.setChanged(); + + if (newActive && level instanceof ServerLevel serverLevel) { + TaskHandler.enqueueServerTask(serverLevel, () -> setPipeActive(blockEntity, newState, false, -1), duration); + } + return newState; } private static class DefaultLaserContainer implements ILaserContainer { diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java index 684ed5d3c93..edd25dcc1fa 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.common.blockentity; +import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.capability.IDataAccessHatch; import com.gregtechceu.gtceu.api.capability.IOpticalComputationProvider; @@ -9,12 +10,6 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.common.pipelike.optical.*; import com.gregtechceu.gtceu.utils.GTUtil; -import com.gregtechceu.gtceu.utils.TaskHandler; - -import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; -import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -25,7 +20,6 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; -import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,9 +29,6 @@ public class OpticalPipeBlockEntity extends PipeBlockEntity { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(OpticalPipeBlockEntity.class, - PipeBlockEntity.MANAGED_FIELD_HOLDER); - private final EnumMap handlers = new EnumMap<>(Direction.class); // the OpticalNetHandler can only be created on the server, so we have an empty placeholder for the client private final IDataAccessHatch clientDataHandler = new DefaultDataHandler(); @@ -45,12 +36,6 @@ public class OpticalPipeBlockEntity extends PipeBlockEntity currentPipeNet = new WeakReference<>(null); private OpticalNetHandler defaultHandler; - @Getter - @Persisted - @DescSynced - @RequireRerender - private boolean isActive; - public OpticalPipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { super(type, pos, blockState); } @@ -157,20 +142,11 @@ public void setConnection(Direction side, boolean connected, boolean fromNeighbo * @param duration how long the pipe should be active for */ public void setActive(boolean active, int duration) { - boolean stateChanged = false; - if (this.isActive && !active) { - this.isActive = false; - stateChanged = true; - } else if (!this.isActive && active) { - this.isActive = true; - stateChanged = true; - TaskHandler.enqueueServerTask((ServerLevel) getLevel(), () -> setActive(false, -1), duration); - } + LaserPipeBlockEntity.setPipeActive(this, this.getBlockState(), active, duration); + } - if (stateChanged) { - notifyBlockUpdate(); - setChanged(); - } + public boolean isActive() { + return this.getBlockState().getValue(GTBlockStateProperties.ACTIVE); } @Override @@ -184,11 +160,6 @@ public GTToolType getPipeTuneTool() { return GTToolType.WIRE_CUTTER; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private static class DefaultDataHandler implements IDataAccessHatch { @Override 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 14e31f25adb..3b9463eb764 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java +++ b/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java @@ -293,7 +293,7 @@ private static int setActiveCape(CommandSourceStack source, ServerPlayer player, private static int dumpDataRegistry(CommandContext context, GTRegistry registry, Codec codec, String folder) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/data"); + Path parent = GTCEu.GTCEU_FOLDER.resolve("dumped/data"); var ops = RegistryOps.create(JsonOps.INSTANCE, context.getSource().registryAccess()); int dumpedCount = 0; for (ResourceLocation id : registry.keys()) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java index 4355206d72f..c4330ecb17b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java @@ -13,7 +13,7 @@ public class GTBlockEntities { @SuppressWarnings("unchecked") public static final BlockEntityEntry CABLE = REGISTRATE - .blockEntity("cable", CableBlockEntity::create) + .blockEntity("cable", CableBlockEntity::new) .onRegister(CableBlockEntity::onBlockEntityRegister) .validBlocks(GTMaterialBlocks.CABLE_BLOCKS.values().toArray(BlockEntry[]::new)) .register(); @@ -27,13 +27,13 @@ public class GTBlockEntities { @SuppressWarnings("unchecked") public static final BlockEntityEntry ITEM_PIPE = REGISTRATE - .blockEntity("item_pipe", ItemPipeBlockEntity::create) + .blockEntity("item_pipe", ItemPipeBlockEntity::new) .onRegister(ItemPipeBlockEntity::onBlockEntityRegister) .validBlocks(GTMaterialBlocks.ITEM_PIPE_BLOCKS.values().toArray(BlockEntry[]::new)) .register(); public static final BlockEntityEntry LASER_PIPE = REGISTRATE - .blockEntity("laser_pipe", LaserPipeBlockEntity::create) + .blockEntity("laser_pipe", LaserPipeBlockEntity::new) .onRegister(LaserPipeBlockEntity::onBlockEntityRegister) .validBlocks(GTBlocks.LASER_PIPES) .register(); @@ -44,7 +44,7 @@ public class GTBlockEntities { .register(); public static final BlockEntityEntry DUCT_PIPE = REGISTRATE - .blockEntity("duct_pipe", DuctPipeBlockEntity::create) + .blockEntity("duct_pipe", DuctPipeBlockEntity::new) .onRegister(DuctPipeBlockEntity::onBlockEntityRegister) .validBlocks(GTBlocks.DUCT_PIPES) .register(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index a91932797f8..241aa9101ff 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -115,7 +115,7 @@ private static void registerLaserPipeBlock(int index) { .block("%s_laser_pipe".formatted(type.getSerializedName()), (p) -> new LaserPipeBlock(p, type)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.dynamicShape().noOcclusion().forceSolidOn()) - .blockstate(NonNullBiConsumer.noop()) + .gtBlockstate(GTModels::createPipeBlockModel) .defaultLoot() .tag(CustomTags.MINEABLE_WITH_CONFIG_VALID_PICKAXE_WIRE_CUTTER) .addLayer(() -> RenderType::cutoutMipped) @@ -145,13 +145,13 @@ private static void registerOpticalPipeBlock(int index) { .lang("Optical Fiber Cable") .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.dynamicShape().noOcclusion().forceSolidOn()) - .blockstate(NonNullBiConsumer.noop()) + .gtBlockstate(GTModels::createPipeBlockModel) .defaultLoot() .tag(CustomTags.MINEABLE_WITH_CONFIG_VALID_PICKAXE_WIRE_CUTTER) .addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::translucent) .color(() -> OpticalPipeBlock::tintedColor) - .item(OpticalPipeBlockItem::new) + .item(PipeBlockItem::new) .model(NonNullBiConsumer.noop()) .build() .register(); @@ -173,12 +173,12 @@ private static void registerDuctPipeBlock(int index) { .block("%s_duct_pipe".formatted(type.getSerializedName()), (p) -> new DuctPipeBlock(p, type)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.dynamicShape().noOcclusion().forceSolidOn()) - .blockstate(NonNullBiConsumer.noop()) + .gtBlockstate(GTModels::createPipeBlockModel) .defaultLoot() .tag(CustomTags.MINEABLE_WITH_CONFIG_VALID_PICKAXE_WRENCH) .addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::translucent) - .item(DuctPipeBlockItem::new) + .item(PipeBlockItem::new) .model(NonNullBiConsumer.noop()) .build() .register(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/models/GTModels.java b/src/main/java/com/gregtechceu/gtceu/common/data/models/GTModels.java index c33890e76d7..6065874b12c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/models/GTModels.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/models/GTModels.java @@ -39,6 +39,8 @@ public class GTModels { public static final ResourceLocation BLANK_TEXTURE = GTCEu.id("block/void"); + public static final String ACTIVE_SUFFIX = "_active"; + // region BLOCK MODELS public static NonNullBiConsumer, GTBlockstateProvider> createModelBlockState(ResourceLocation modelLocation) { @@ -273,6 +275,12 @@ public static NonNullBiConsumer, RegistrateBl }; } + public static void createPipeBlockModel(DataGenContext> ctx, + GTBlockstateProvider prov) { + // the pipe model generator handles adding its models to the provider by itself + ctx.getEntry().createPipeModel(prov).initModels(); + } + // endregion // region RUNTIME GEN diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java index b149d5df98c..fc543f04ff4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java @@ -1,19 +1,19 @@ package com.gregtechceu.gtceu.common.pipelike.cable; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; -import com.gregtechceu.gtceu.client.model.PipeModel; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; +import com.gregtechceu.gtceu.common.data.models.GTModels; import net.minecraft.resources.ResourceLocation; import lombok.Getter; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Supplier; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; @@ -83,20 +83,28 @@ public ResourceLocation type() { return TYPE_ID; } - public PipeModel createPipeModel(Material material) { - Supplier wireSideTexturePath = () -> MaterialIconType.wire + public PipeModel createPipeModel(PipeBlock block, Material material, GTBlockstateProvider provider) { + ResourceLocation side = MaterialIconType.wire .getBlockTexturePath(material.getMaterialIconSet(), "side", true); - Supplier wireEndTexturePath = () -> MaterialIconType.wire + ResourceLocation end = MaterialIconType.wire .getBlockTexturePath(material.getMaterialIconSet(), "end", true); - Supplier<@Nullable ResourceLocation> wireSideOverlayTexturePath = () -> MaterialIconType.wire + + PipeModel model = new PipeModel(block, provider, thickness, + isCable ? GTCEu.id("block/cable/insulation_5") : side, end); + + ResourceLocation sideSecondary = MaterialIconType.wire .getBlockTexturePath(material.getMaterialIconSet(), "side_overlay", true); - Supplier<@Nullable ResourceLocation> wireEndOverlayTexturePath = () -> MaterialIconType.wire + ResourceLocation endSecondary = MaterialIconType.wire .getBlockTexturePath(material.getMaterialIconSet(), "end_overlay", true); - PipeModel model = new PipeModel(thickness, - isCable ? () -> GTCEu.id("block/cable/insulation_5") : wireSideTexturePath, wireEndTexturePath, - wireSideOverlayTexturePath, wireEndOverlayTexturePath); + + if (sideSecondary != null && !sideSecondary.equals(GTModels.BLANK_TEXTURE)) { + model.setSideSecondary(sideSecondary); + } + if (endSecondary != null && !endSecondary.equals(GTModels.BLANK_TEXTURE)) { + model.setEndSecondary(endSecondary); + } if (isCable) { - model.setEndOverlayTexture(GTCEu.id("block/cable/insulation_%s".formatted(insulationLevel))); + model.setEndOverlay(GTCEu.id("block/cable/insulation_%s".formatted(insulationLevel))); } return model; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/duct/DuctPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/duct/DuctPipeType.java index 1323fa297f1..feebae0b7ca 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/duct/DuctPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/duct/DuctPipeType.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.pipenet.IPipeType; -import com.gregtechceu.gtceu.client.model.PipeModel; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; @@ -54,10 +53,4 @@ public ResourceLocation type() { public String getSerializedName() { return name().toLowerCase(Locale.ROOT); } - - public PipeModel createPipeModel() { - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_duct_side"), - () -> GTCEu.id("block/pipe/pipe_duct_in"), - null, null); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java index 8ad5940e500..f068dd69236 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.common.pipelike.fluidpipe; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; -import com.gregtechceu.gtceu.client.model.PipeModel; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import net.minecraft.resources.ResourceLocation; @@ -72,26 +74,20 @@ public ResourceLocation type() { return TYPE_ID; } - public PipeModel createPipeModel(Material material) { + public PipeModel createPipeModel(PipeBlock block, Material material, GTBlockstateProvider provider) { + String side = "block/pipe/pipe%s_side"; + String end = "block/pipe/pipe_%s_in".formatted(name); if (material.hasProperty(PropertyKey.WOOD)) { - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side_wood"), - () -> GTCEu.id("block/pipe/pipe_%s_in_wood".formatted(name)), null, null); + side += "_wood"; + end += "_wood"; } if (channels == 9) { - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_non_side"), - () -> GTCEu.id("block/pipe/pipe_%s_in".formatted(name)), - null, null); + side = side.formatted("_non"); } else if (channels == 4) { - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_quad_side"), - () -> GTCEu.id("block/pipe/pipe_%s_in".formatted(name)), - null, null); + side = side.formatted("_quad"); + } else { + side = side.formatted(""); } - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side"), - () -> GTCEu.id("block/pipe/pipe_%s_in".formatted(name)), - null, null/* - * () -> GTCEu.id("block/pipe/pipe_side_secondary"), () -> - * GTCEu.id("block/pipe/pipe_%s_in_secondary".formatted(name)) TODO enable once the textures - * are added - */); + return new PipeModel(block, provider, thickness, GTCEu.id(side), GTCEu.id(end)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java index 68e5c37d016..8c6a4f78083 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.common.pipelike.item; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.ItemPipeProperties; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; -import com.gregtechceu.gtceu.client.model.PipeModel; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModel; import net.minecraft.resources.ResourceLocation; @@ -72,25 +74,18 @@ public ResourceLocation type() { return TYPE_ID; } - public PipeModel createPipeModel(Material material) { - PipeModel model; + public PipeModel createPipeModel(PipeBlock block, Material material, GTBlockstateProvider provider) { + ResourceLocation sideTexture = GTCEu.id("block/pipe/pipe_side"); + ResourceLocation endTexture = GTCEu.id("block/pipe/pipe_%s_in" + .formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)); if (material.hasProperty(PropertyKey.WOOD)) { - model = new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side_wood"), - () -> GTCEu.id("block/pipe/pipe_%s_in_wood" - .formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)), - null, null); - } else { - model = new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side"), - () -> GTCEu.id("block/pipe/pipe_%s_in" - .formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)), - null, null/* - * () -> GTCEu.id("block/pipe/pipe_side_secondary"), () -> - * GTCEu.id("block/pipe/pipe_%s_in_secondary".formatted(this.isRestrictive() ? - * values()[this.ordinal() - 4].name : name)) TODO enable once the textures are added - */); + sideTexture = sideTexture.withSuffix("_wood"); + endTexture = endTexture.withSuffix("_wood"); } + + PipeModel model = new PipeModel(block, provider, thickness, sideTexture, endTexture); if (isRestrictive()) { - model.setSideOverlayTexture(GTCEu.id("block/pipe/pipe_restrictive")); + model.setSideOverlay(GTCEu.id("block/pipe/pipe_restrictive")); } return model; } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/client/ModelManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/client/ModelManagerMixin.java index 24605160b28..9c8a8ec19f1 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/client/ModelManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/client/ModelManagerMixin.java @@ -1,14 +1,7 @@ package com.gregtechceu.gtceu.core.mixins.client; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.client.renderer.block.MaterialBlockRenderer; -import com.gregtechceu.gtceu.client.renderer.block.OreBlockRenderer; -import com.gregtechceu.gtceu.client.renderer.block.SurfaceRockRenderer; -import com.gregtechceu.gtceu.client.renderer.item.ArmorItemRenderer; -import com.gregtechceu.gtceu.client.renderer.item.TagPrefixItemRenderer; -import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; -import com.gregtechceu.gtceu.common.data.models.GTModels; -import com.gregtechceu.gtceu.integration.kjs.GregTechKubeJSPlugin; +import com.gregtechceu.gtceu.data.pack.event.RegisterDynamicResourcesEvent; import com.gregtechceu.gtceu.integration.modernfix.GTModernFixIntegration; import net.minecraft.client.resources.model.ModelManager; @@ -37,17 +30,8 @@ public abstract class ModelManagerMixin { long startTime = System.currentTimeMillis(); // turns out these do have to be init in here after all, as they check for asset existence. whoops. - MaterialBlockRenderer.reinitModels(); - TagPrefixItemRenderer.reinitModels(); - OreBlockRenderer.reinitModels(); - ToolItemRenderer.reinitModels(); - ArmorItemRenderer.reinitModels(); - SurfaceRockRenderer.reinitModels(); - GTModels.registerMaterialFluidModels(); - - if (GTCEu.Mods.isKubeJSLoaded()) { - GregTechKubeJSPlugin.generateMachineBlockModels(); - } + ModLoader.get().postEventWrapContainerInModOrder(new RegisterDynamicResourcesEvent()); + if (GTCEu.Mods.isModernFixLoaded()) { GTModernFixIntegration.setAsLast(); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java new file mode 100644 index 00000000000..917e3996be2 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java @@ -0,0 +1,477 @@ +package com.gregtechceu.gtceu.data.model.builder; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.client.model.pipe.PipeModelLoader; +import com.gregtechceu.gtceu.core.mixins.forge.ConfiguredModelBuilderAccessor; +import com.gregtechceu.gtceu.utils.GTMath; +import com.gregtechceu.gtceu.utils.GTUtil; +import com.gregtechceu.gtceu.utils.memoization.GTMemoizer; +import com.gregtechceu.gtceu.utils.memoization.function.MemoizedBiFunction; + +import net.minecraft.Util; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.model.generators.*; +import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredModelList; +import net.minecraftforge.common.data.ExistingFileHelper; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.gson.JsonObject; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.Range; +import org.joml.Vector3f; + +import java.util.*; + +import static com.gregtechceu.gtceu.data.model.builder.MachineModelBuilder.configuredModelListToJSON; +import static com.gregtechceu.gtceu.data.model.builder.MachineModelBuilder.configuredModelToJSON; + +@Accessors(fluent = true, chain = true) +@SuppressWarnings("UnusedReturnValue") +public class PipeModelBuilder> extends CustomLoaderBuilder { + + public static > PipeModelBuilder begin(T parent, + ExistingFileHelper existingFileHelper) { + return new PipeModelBuilder<>(parent, existingFileHelper); + } + + @Accessors(fluent = false) + @Getter + private final Map parts = new IdentityHashMap<>(); + @Setter + @Range(from = 0, to = 16) + private float thickness = Float.MIN_VALUE; + @Setter + private @NotNull GTBlockstateProvider provider; + private BlockModelBuilder[] restrictors = null; + + protected PipeModelBuilder(T parent, ExistingFileHelper existingFileHelper) { + super(PipeModelLoader.ID, parent, existingFileHelper); + } + + /** + * Set the models for all pipe elements at the same time + * + * @param centerModel The model to use for the center part of the pipe + * @param connectionModels The models to use for all the connection elements + * @return {@code this} + * @see #allModels(ModelFile, ModelFile...) + * @see #allModels(ResourceLocation, ResourceLocation...) + */ + public PipeModelBuilder allModels(ConfiguredModel centerModel, ConfiguredModel... connectionModels) { + centerModels(centerModel); + connectionModels(connectionModels); + return this; + } + + /** + * Set the models for all pipe elements at the same time + * + * @param centerModel The model to use for the center part of the pipe + * @param connectionModels The models to use for all the connection elements + * @return {@code this} + * @see #allModels(ModelFile, ModelFile...) + * @see #allModels(ResourceLocation, ResourceLocation...) + */ + public PipeModelBuilder allModels(ModelFile centerModel, ModelFile... connectionModels) { + centerModels(centerModel); + connectionModels(connectionModels); + return this; + } + + /** + * Set the models for all pipe elements at the same time + * + * @param centerModel The model to use for the center part of the pipe + * @param connectionModels The models to use for all the connection elements + * @return {@code this} + * @see #allModels(ConfiguredModel, ConfiguredModel...) + * @see #allModels(ModelFile, ModelFile...) + */ + public PipeModelBuilder allModels(ResourceLocation centerModel, ResourceLocation... connectionModels) { + centerModels(centerModel); + connectionModels(connectionModels); + return this; + } + + /** + * Set the models for all connection elements + * + * @param connectionModels The models to use for all the connection elements + * @return {@code this} + * @see #connectionModels(ModelFile...) + * @see #connectionModels(ResourceLocation...) + */ + public PipeModelBuilder connectionModels(ConfiguredModel... connectionModels) { + for (Direction dir : GTUtil.DIRECTIONS) { + ConfiguredModel[] rotatedModels = Arrays.stream(connectionModels) + .map(model -> ConfiguredModel.builder() + .modelFile(model.model).uvLock(model.uvLock).weight(model.weight) + .rotationX(dir == Direction.DOWN ? 90 : dir == Direction.UP ? 270 : 0) + .rotationY(dir.getAxis().isVertical() ? 0 : ((int) dir.toYRot() + 180) % 360) + .buildLast()) + .toArray(ConfiguredModel[]::new); + modelsForDirection(dir, rotatedModels); + } + return this; + } + + /** + * Set the models for all connection elements + * + * @param connectionModels The models to use for all the connection elements + * @return {@code this} + * @see #connectionModels(ConfiguredModel...) + * @see #connectionModels(ResourceLocation...) + */ + public PipeModelBuilder connectionModels(ModelFile... connectionModels) { + for (Direction dir : GTUtil.DIRECTIONS) { + ConfiguredModel[] rotatedModels = Arrays.stream(connectionModels) + .map(model -> ConfiguredModel.builder() + .modelFile(model) + .rotationX(dir == Direction.DOWN ? 0 : dir == Direction.UP ? 180 : 90) + .rotationY(dir.getAxis().isVertical() ? 0 : (int) dir.toYRot()) + .buildLast()) + .toArray(ConfiguredModel[]::new); + modelsForDirection(dir, rotatedModels); + } + return this; + } + + /** + * Set the models for all connection elements + * + * @param connectionModels The models to use for all the connection elements + * @return {@code this} + * @see #connectionModels(ConfiguredModel...) + * @see #connectionModels(ModelFile...) + */ + public PipeModelBuilder connectionModels(ResourceLocation... connectionModels) { + return connectionModels(Arrays.stream(connectionModels) + .map(loc -> new ModelFile.ExistingModelFile(loc, this.existingFileHelper)) + .toArray(ModelFile[]::new)); + } + + /** + * Set the models for all connection elements with a builder + * + * @return A model builder + * @see #connectionModels(ConfiguredModel...) + * @see #connectionModels(ModelFile...) + * @see #connectionModels(ResourceLocation...) + */ + public ConfiguredModel.Builder> connectionModels() { + return ConfiguredModelBuilderAccessor.builder(this::connectionModels, ImmutableList.of()); + } + + /** + * Set the models for the center element + * + * @param centerModels The model to use for the center part of the pipe + * @return {@code this} + * @see #centerModels(ModelFile...) + * @see #centerModels(ResourceLocation...) + */ + public PipeModelBuilder centerModels(ConfiguredModel... centerModels) { + return modelsForDirection(null, centerModels); + } + + /** + * Set the models for the center element + * + * @param centerModels The model to use for the center part of the pipe + * @return {@code this} + * @see #centerModels(ConfiguredModel...) + * @see #centerModels(ResourceLocation...) + */ + public PipeModelBuilder centerModels(ModelFile... centerModels) { + return modelsForDirection(null, centerModels); + } + + /** + * Set the models for the center element + * + * @param centerModels The model to use for the center part of the pipe + * @return {@code this} + * @see #centerModels(ConfiguredModel...) + * @see #centerModels(ModelFile...) + */ + public PipeModelBuilder centerModels(ResourceLocation... centerModels) { + return modelsForDirection(null, centerModels); + } + + /** + * Set the models for the center element with a builder + * + * @return A model builder + * @see #centerModels(ConfiguredModel...) + * @see #centerModels(ModelFile...) + * @see #centerModels(ResourceLocation...) + */ + public ConfiguredModel.Builder> centerModel() { + return ConfiguredModelBuilderAccessor.builder(this::centerModels, ImmutableList.of()); + } + + /** + * Set the models for the given direction + * + * @param direction The direction that'll use the model(s) + * @param models The models to set for the direction. + * @return {@code this} + * @see #modelsForDirection(Direction, ModelFile...) + * @see #modelsForDirection(Direction, ResourceLocation...) + */ + public PipeModelBuilder modelsForDirection(@Nullable Direction direction, ConfiguredModel... models) { + parts.put(direction, new ConfiguredModelList(models)); + return this; + } + + /** + * Set the models for the given direction + * + * @param direction The direction that'll use the model(s) + * @param models The models to set for the direction. + * @return {@code this} + * @see #modelsForDirection(Direction, ConfiguredModel...) + * @see #modelsForDirection(Direction, ResourceLocation...) + */ + public PipeModelBuilder modelsForDirection(@Nullable Direction direction, ModelFile... models) { + return modelsForDirection(direction, Arrays.stream(models) + .map(model -> ConfiguredModel.builder().modelFile(model).buildLast()) + .toArray(ConfiguredModel[]::new)); + } + + /** + * Set the models for the given direction + * + * @param direction The direction that'll use the model(s) + * @param models The models to set for the direction. + * @return {@code this} + * @see #modelsForDirection(Direction, ConfiguredModel...) + * @see #modelsForDirection(Direction, ModelFile...) + */ + public PipeModelBuilder modelsForDirection(@Nullable Direction direction, ResourceLocation... models) { + return modelsForDirection(direction, Arrays.stream(models) + .map(model -> ConfiguredModel.builder() + .modelFile(new ModelFile.ExistingModelFile(model, this.existingFileHelper)) + .buildLast()) + .toArray(ConfiguredModel[]::new)); + } + + /** + * Set the models for the given direction with a builder + * + * @return A model builder + * @see #modelsForDirection(Direction, ConfiguredModel...) + * @see #modelsForDirection(Direction, ModelFile...) + * @see #modelsForDirection(Direction, ResourceLocation...) + */ + public ConfiguredModel.Builder> modelsForDirection(@Nullable Direction direction) { + return ConfiguredModelBuilderAccessor.builder(models -> this.modelsForDirection(direction, models), + ImmutableList.of()); + } + + @Override + public T end() { + this.restrictors = getOrCreateRestrictorModels(this.provider.models(), this.thickness); + return super.end(); + } + + @Override + public JsonObject toJson(JsonObject json) { + Preconditions.checkState(thickness != Float.MIN_VALUE, "A thickness value must be set!"); + Preconditions.checkState(thickness > 0.0f || thickness <= 16.0f, + "Thickness must be between 0 (exclusive) and 16 (inclusive). is %s", thickness); + // noinspection ConstantValue + Preconditions.checkState(provider != null, "You must pass in a GTBlockStateProvider!"); + + json = super.toJson(json); + + if (!getParts().isEmpty()) { + final JsonObject parts = new JsonObject(); + getParts().entrySet().stream() + .sorted(Map.Entry.comparingByKey(Comparator.nullsFirst(Direction::compareTo))) + .forEach(entry -> { + String key = entry.getKey() != null ? entry.getKey().getName() : + PipeModelLoader.PRIMARY_CENTER_KEY; + parts.add(key, configuredModelListToJSON(entry.getValue())); + }); + + json.add("parts", parts); + } + + if (this.restrictors != null) { + final JsonObject restrictors = new JsonObject(); + for (int i = 0; i < GTUtil.DIRECTIONS.length; i++) { + Direction dir = GTUtil.DIRECTIONS[i]; + restrictors.add(dir.getName(), + configuredModelToJSON(ConfiguredModel.builder() + .modelFile(new ModelFile.UncheckedModelFile(this.restrictors[i].getLocation())) + .buildLast(), false)); + } + json.add("restrictors", restrictors); + } + + return json; + } + + private static final ResourceLocation PIPE_BLOCKED_OVERLAY = GTCEu.id("block/pipe/blocked/pipe_blocked"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UP = GTCEu.id("block/pipe/blocked/pipe_blocked_up"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_DOWN = GTCEu.id("block/pipe/blocked/pipe_blocked_down"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_LEFT = GTCEu.id("block/pipe/blocked/pipe_blocked_left"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_RIGHT = GTCEu + .id("block/pipe/blocked/pipe_blocked_right"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_NU = GTCEu.id("block/pipe/blocked/pipe_blocked_nu"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_ND = GTCEu.id("block/pipe/blocked/pipe_blocked_nd"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_NL = GTCEu.id("block/pipe/blocked/pipe_blocked_nl"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_NR = GTCEu.id("block/pipe/blocked/pipe_blocked_nr"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UD = GTCEu.id("block/pipe/blocked/pipe_blocked_ud"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UL = GTCEu.id("block/pipe/blocked/pipe_blocked_ul"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UR = GTCEu.id("block/pipe/blocked/pipe_blocked_ur"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_DL = GTCEu.id("block/pipe/blocked/pipe_blocked_dl"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_DR = GTCEu.id("block/pipe/blocked/pipe_blocked_dr"); + private static final ResourceLocation PIPE_BLOCKED_OVERLAY_LR = GTCEu.id("block/pipe/blocked/pipe_blocked_lr"); + + private static final Int2ObjectMap RESTRICTOR_MAP = Util.make(() -> { + Int2ObjectMap map = new Int2ObjectOpenHashMap<>(); + + addRestrictor(map, PIPE_BLOCKED_OVERLAY_UP, Border.TOP); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_DOWN, Border.BOTTOM); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_UD, Border.TOP, Border.BOTTOM); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_LEFT, Border.LEFT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_UL, Border.TOP, Border.LEFT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_DL, Border.BOTTOM, Border.LEFT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_NR, Border.TOP, Border.BOTTOM, Border.LEFT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_RIGHT, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_UR, Border.TOP, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_DR, Border.BOTTOM, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_NL, Border.TOP, Border.BOTTOM, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_LR, Border.LEFT, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_ND, Border.TOP, Border.LEFT, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY_NU, Border.BOTTOM, Border.LEFT, Border.RIGHT); + addRestrictor(map, PIPE_BLOCKED_OVERLAY, Border.TOP, Border.BOTTOM, Border.LEFT, Border.RIGHT); + + return map; + }); + + private static BlockModelBuilder[] getOrCreateRestrictorModels(BlockModelProvider provider, float thickness) { + return RESTRICTOR_MODEL_CACHE.apply(provider, thickness); + } + + private static final MemoizedBiFunction RESTRICTOR_MODEL_CACHE = GTMemoizer + .memoizeFunctionWeakIdent(PipeModelBuilder::makeRestrictorModels); + + private static BlockModelBuilder[] makeRestrictorModels(BlockModelProvider provider, float thickness) { + BlockModelBuilder[] models = new BlockModelBuilder[GTUtil.DIRECTIONS.length]; + + float min = (16.0f - thickness) / 2.0f - 0.003f; + float max = min + thickness + 0.006f; // offset by 0.003 * 2 + for (Direction dir : GTUtil.DIRECTIONS) { + String modelPath = "block/pipe/restrictor/" + dir.getName() + "/thickness_" + thickness; + ResourceLocation modelName = GTCEu.id(modelPath); + if (provider.generatedModels.containsKey(modelName)) { + models[dir.ordinal()] = provider.generatedModels.get(modelName); + continue; + } + + var coords = GTMath.getCoordinates(dir, min, max); + Vector3f minPos = coords.getLeft(); + Vector3f maxPos = coords.getRight(); + BlockModelBuilder model = provider.getBuilder(modelPath); + model.texture("restrictor", PIPE_BLOCKED_OVERLAY) + .element() + .from(minPos.x, minPos.y, minPos.z) + .to(maxPos.x, maxPos.y, maxPos.z) + .face(getSideAtBorder(dir, Border.BOTTOM)).end() + .face(getSideAtBorder(dir, Border.TOP)).end() + .face(getSideAtBorder(dir, Border.LEFT)).end() + .face(getSideAtBorder(dir, Border.RIGHT)).end() + .faces((face, builder) -> builder.texture("#restrictor")) + .end(); + models[dir.ordinal()] = model; + } + return models; + } + + @ApiStatus.Internal + public static void clearRestrictorModelCache() { + RESTRICTOR_MODEL_CACHE.getCache().clear(); + } + + private static final EnumMap> FACE_BORDER_MAP = Util.make(() -> { + EnumMap> map = new EnumMap<>(Direction.class); + + map.put(Direction.DOWN, borderMap(Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)); + map.put(Direction.UP, borderMap(Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST)); + map.put(Direction.NORTH, borderMap(Direction.DOWN, Direction.UP, Direction.WEST, Direction.EAST)); + map.put(Direction.SOUTH, borderMap(Direction.DOWN, Direction.UP, Direction.WEST, Direction.EAST)); + map.put(Direction.WEST, borderMap(Direction.DOWN, Direction.UP, Direction.NORTH, Direction.SOUTH)); + map.put(Direction.EAST, borderMap(Direction.DOWN, Direction.UP, Direction.NORTH, Direction.SOUTH)); + + return map; + }); + + private static EnumMap borderMap(Direction topSide, Direction bottomSide, + Direction leftSide, Direction rightSide) { + EnumMap sideMap = new EnumMap<>(Border.class); + sideMap.put(Border.TOP, topSide); + sideMap.put(Border.BOTTOM, bottomSide); + sideMap.put(Border.LEFT, leftSide); + sideMap.put(Border.RIGHT, rightSide); + return sideMap; + } + + private static void addRestrictor(Int2ObjectMap map, ResourceLocation texture, + Border... borders) { + int mask = 0; + for (Border border : borders) { + mask |= border.mask; + } + map.put(mask, texture); + } + + private static Direction getSideAtBorder(Direction side, Border border) { + return FACE_BORDER_MAP.get(side).get(border); + } + + private static int computeBorderMask(int blockedConnections, int connections, Direction side) { + int borderMask = 0; + if (blockedConnections != 0) { + for (Border border : Border.VALUES) { + Direction borderSide = getSideAtBorder(side, border); + if (PipeBlockEntity.isFaceBlocked(blockedConnections, borderSide) && + PipeBlockEntity.isConnected(connections, borderSide)) { + // only render when the side is blocked *and* connected + borderMask |= border.mask; + } + } + } + return borderMask; + } + + private enum Border { + + TOP, + BOTTOM, + LEFT, + RIGHT; + + public static final Border[] VALUES = values(); + + public final int mask; + + Border() { + mask = 1 << this.ordinal(); + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java index cbf7560b4f3..103ffba6b4d 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java @@ -68,7 +68,7 @@ private static void addToData(ResourceLocation location, byte[] bytes) { public static void addRecipe(FinishedRecipe recipe) { JsonObject recipeJson = recipe.serializeRecipe(); byte[] recipeBytes = recipeJson.toString().getBytes(StandardCharsets.UTF_8); - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/data"); + Path parent = GTCEu.GTCEU_FOLDER.resolve("dumped/data"); ResourceLocation recipeId = recipe.getId(); if (ConfigHolder.INSTANCE.dev.dumpRecipes) { writeJson(recipeId, "recipes", parent, recipeBytes); diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java index bb5522a00f3..a33acec7fff 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java @@ -9,6 +9,8 @@ import net.minecraft.SharedConstants; import net.minecraft.client.renderer.texture.atlas.SpriteSource; import net.minecraft.client.renderer.texture.atlas.SpriteSources; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.models.blockstates.BlockStateGenerator; import net.minecraft.network.chat.Component; import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; @@ -17,6 +19,9 @@ import net.minecraft.server.packs.metadata.MetadataSectionSerializer; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.server.packs.resources.IoSupplier; +import net.minecraftforge.client.model.generators.BlockModelBuilder; +import net.minecraftforge.client.model.generators.ItemModelBuilder; +import net.minecraftforge.client.model.generators.ModelBuilder; import com.google.common.collect.Sets; import com.google.gson.JsonElement; @@ -52,9 +57,8 @@ public class GTDynamicResourcePack implements PackResources { private static final FileToIdConverter ATLAS_ID_CONVERTER = FileToIdConverter.json("atlases"); private static final FileToIdConverter TEXTURE_ID_CONVERTER = SpriteSource.TEXTURE_ID_CONVERTER; - private static final FileToIdConverter BLOCKSTATE_ID_CONVERTER = FileToIdConverter.json("blockstates"); - private static final FileToIdConverter BLOCK_MODEL_ID_CONVERTER = FileToIdConverter.json("models/block"); - private static final FileToIdConverter ITEM_MODEL_ID_CONVERTER = FileToIdConverter.json("models/item"); + public static final FileToIdConverter BLOCKSTATE_ID_CONVERTER = FileToIdConverter.json("blockstates"); + private static final FileToIdConverter MODEL_ID_CONVERTER = FileToIdConverter.json("models"); private final String name; @@ -81,89 +85,83 @@ public static void addResource(ResourceLocation location, JsonElement obj) { public static void addResource(ResourceLocation location, byte[] data) { if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.GTCEU_FOLDER.resolve("dumped/assets"); writeJson(location, null, parent, data); } CONTENTS.addToData(location, data); } public static void addBlockModel(ResourceLocation loc, JsonElement obj) { - ResourceLocation l = getBlockModelLocation(loc); - byte[] modelBytes = obj.toString().getBytes(StandardCharsets.UTF_8); - - if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); - writeJson(l, null, parent, modelBytes); + if (!loc.getPath().startsWith("block/")) { + loc = loc.withPrefix("block/"); } - CONTENTS.addToData(l, modelBytes); + addModel(loc, obj); } public static void addBlockModel(ResourceLocation loc, Supplier obj) { addBlockModel(loc, obj.get()); } - public static void addItemModel(ResourceLocation loc, JsonElement obj) { - ResourceLocation l = getItemModelLocation(loc); - byte[] modelBytes = obj.toString().getBytes(StandardCharsets.UTF_8); + public static void addBlockModel(BlockModelBuilder builder) { + addBlockModel(builder.getLocation(), builder.toJson()); + } - if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); - writeJson(l, null, parent, modelBytes); + public static void addItemModel(ResourceLocation loc, JsonElement obj) { + if (!loc.getPath().startsWith("item/")) { + loc = loc.withPrefix("item/"); } - CONTENTS.addToData(l, modelBytes); + addModel(loc, obj); + } + + public static void addItemModel(ItemModelBuilder builder) { + addItemModel(builder.getLocation(), builder.toJson()); } public static void addItemModel(ResourceLocation loc, Supplier obj) { addItemModel(loc, obj.get()); } - public static void addBlockState(ResourceLocation loc, JsonElement stateJson) { - ResourceLocation l = getBlockStateLocation(loc); - byte[] stateBytes = stateJson.toString().getBytes(StandardCharsets.UTF_8); + public static void addModel(ResourceLocation loc, JsonElement obj) { + loc = MODEL_ID_CONVERTER.idToFile(loc); + addResource(loc, obj); + } - if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); - writeJson(l, null, parent, stateBytes); - } - CONTENTS.addToData(l, stateBytes); + public static void addModel(ResourceLocation loc, Supplier obj) { + addModel(loc, obj.get()); + } + + public static > void addModel(T builder) { + addModel(builder.getLocation(), builder.toJson()); + } + + public static void addBlockState(ResourceLocation loc, JsonElement stateJson) { + loc = BLOCKSTATE_ID_CONVERTER.idToFile(loc); + addResource(loc, stateJson); } public static void addBlockState(ResourceLocation loc, Supplier generator) { addBlockState(loc, generator.get()); } - public static void addAtlasSpriteSource(ResourceLocation atlasLoc, SpriteSource source) { - ResourceLocation l = getAtlasLocation(atlasLoc); - JsonElement sourceJson = SpriteSources.FILE_CODEC - .encodeStart(JsonOps.INSTANCE, Collections.singletonList(source)) - .getOrThrow(false, - error -> GTCEu.LOGGER.error("Failed to encode atlas sprite source. {}", error)); - byte[] sourceBytes = sourceJson.toString().getBytes(StandardCharsets.UTF_8); - - if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); - writeJson(l, null, parent, sourceBytes); - } - CONTENTS.addToData(l, sourceBytes); + public static void addBlockState(BlockStateGenerator generator) { + addBlockState(BuiltInRegistries.BLOCK.getKey(generator.getBlock()), generator.get()); } - public static void addAtlasSpriteSourceList(ResourceLocation atlasLoc, List sources) { - ResourceLocation l = getAtlasLocation(atlasLoc); - JsonElement sourceJson = SpriteSources.FILE_CODEC.encodeStart(JsonOps.INSTANCE, sources).getOrThrow(false, - error -> GTCEu.LOGGER.error("Failed to encode atlas sprite source. {}", error)); - byte[] sourceBytes = sourceJson.toString().getBytes(StandardCharsets.UTF_8); + public static void addAtlasSpriteSource(ResourceLocation atlasLoc, SpriteSource source) { + addAtlasSpriteSourceList(atlasLoc, Collections.singletonList(source)); + } - if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); - writeJson(l, null, parent, sourceBytes); - } - CONTENTS.addToData(l, sourceBytes); + public static void addAtlasSpriteSourceList(ResourceLocation loc, List sources) { + loc = ATLAS_ID_CONVERTER.idToFile(loc); + JsonElement sourceJson = SpriteSources.FILE_CODEC.encodeStart(JsonOps.INSTANCE, sources) + .getOrThrow(false, error -> GTCEu.LOGGER.error("Failed to encode atlas sprite source. {}", error)); + addResource(loc, sourceJson); } public static void addBlockTexture(ResourceLocation loc, byte[] data) { ResourceLocation l = getTextureLocation("block", loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.GTCEU_FOLDER.resolve("dumped/assets"); writeByteArray(l, null, parent, data); } CONTENTS.addToData(l, data); @@ -172,7 +170,7 @@ public static void addBlockTexture(ResourceLocation loc, byte[] data) { public static void addItemTexture(ResourceLocation loc, byte[] data) { ResourceLocation l = getTextureLocation("item", loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.GTCEU_FOLDER.resolve("dumped/assets"); writeByteArray(l, null, parent, data); } CONTENTS.addToData(l, data); @@ -252,26 +250,10 @@ public void close() { // NOOP } - public static ResourceLocation getBlockStateLocation(ResourceLocation blockId) { - return BLOCKSTATE_ID_CONVERTER.idToFile(blockId); - } - - public static ResourceLocation getBlockModelLocation(ResourceLocation blockId) { - return BLOCK_MODEL_ID_CONVERTER.idToFile(blockId); - } - - public static ResourceLocation getItemModelLocation(ResourceLocation itemId) { - return ITEM_MODEL_ID_CONVERTER.idToFile(itemId); - } - public static ResourceLocation getTextureLocation(@Nullable String path, ResourceLocation textureId) { if (path == null) { return TEXTURE_ID_CONVERTER.idToFile(textureId); } return TEXTURE_ID_CONVERTER.idToFile(textureId.withPrefix(path + "/")); } - - public static ResourceLocation getAtlasLocation(ResourceLocation atlasId) { - return ATLAS_ID_CONVERTER.idToFile(atlasId); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/event/RegisterDynamicResourcesEvent.java b/src/main/java/com/gregtechceu/gtceu/data/pack/event/RegisterDynamicResourcesEvent.java new file mode 100644 index 00000000000..92f9eaa1d9a --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/event/RegisterDynamicResourcesEvent.java @@ -0,0 +1,12 @@ +package com.gregtechceu.gtceu.data.pack.event; + +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.event.IModBusEvent; + +import org.jetbrains.annotations.ApiStatus; + +public class RegisterDynamicResourcesEvent extends Event implements IModBusEvent { + + @ApiStatus.Internal + public RegisterDynamicResourcesEvent() {} +} 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 6300ac47d81..282112a3928 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java @@ -70,10 +70,8 @@ import com.gregtechceu.gtceu.common.data.models.GTModels; import com.gregtechceu.gtceu.common.item.armor.PowerlessJetpack; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitiveFancyUIWorkableMachine; -import com.gregtechceu.gtceu.common.registry.GTRegistration; import com.gregtechceu.gtceu.common.unification.material.MaterialRegistryManager; import com.gregtechceu.gtceu.core.mixins.IngredientAccessor; -import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; import com.gregtechceu.gtceu.data.recipe.CraftingComponent; import com.gregtechceu.gtceu.data.recipe.GTCraftingComponents; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; @@ -93,9 +91,7 @@ import com.gregtechceu.gtceu.integration.kjs.recipe.WrappingRecipeSchemaType; import com.gregtechceu.gtceu.integration.kjs.recipe.components.ExtendedOutputItem; import com.gregtechceu.gtceu.integration.kjs.recipe.components.GTRecipeComponents; -import com.gregtechceu.gtceu.utils.data.RuntimeBlockStateProvider; -import net.minecraft.data.PackOutput; import net.minecraft.nbt.NbtOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.CraftingContainer; @@ -109,7 +105,6 @@ import net.minecraftforge.registries.ForgeRegistries; import com.mojang.serialization.DataResult; -import dev.latvian.mods.kubejs.KubeJSPaths; import dev.latvian.mods.kubejs.KubeJSPlugin; import dev.latvian.mods.kubejs.block.state.BlockStatePredicate; import dev.latvian.mods.kubejs.client.LangEventJS; @@ -212,23 +207,12 @@ public void generateDataJsons(DataJsonGenerator generator) { GTRegistryInfo.ALL_BUILDERS.forEach(builderBase -> builderBase.generateDataJsons(generator)); } - // Fake a data provider for the GT model builders so we don't need to handle this ourselves in any way :3 - public static RuntimeBlockStateProvider RUNTIME_BLOCKSTATE_PROVIDER = new RuntimeBlockStateProvider( - GTRegistration.REGISTRATE, new PackOutput(KubeJSPaths.DIRECTORY), - (loc, json) -> { - if (!loc.getPath().endsWith(".json")) { - loc = loc.withSuffix(".json"); - } - GTDynamicResourcePack.addResource(loc, json); - }); - public static void generateMachineBlockModels() { GTRegistryInfo.ALL_BUILDERS.forEach(builderBase -> { try { builderBase.generateAssetJsons(null); } catch (IllegalStateException ignored) {} }); - GregTechKubeJSPlugin.RUNTIME_BLOCKSTATE_PROVIDER.run(); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java b/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java index 2877a711f97..ce8ec066a59 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java @@ -1,12 +1,18 @@ package com.gregtechceu.gtceu.utils; import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.joml.Vector3f; import java.math.BigDecimal; import java.math.BigInteger; @@ -93,4 +99,65 @@ public static int ceilDiv(int x, int y) { } return q; } + + public static float min(float @NotNull... values) { + // noinspection ConstantValue + if (values == null || values.length == 0) throw new IllegalArgumentException(); + if (values.length == 1) return values[0]; + if (values.length == 2) return Math.min(values[0], values[1]); + float min = Float.MAX_VALUE; + for (float i : values) { + if (i < min) { + min = i; + } + } + return min; + } + + public static float max(float @NotNull... values) { + // noinspection ConstantValue + if (values == null || values.length == 0) throw new IllegalArgumentException(); + if (values.length == 1) return values[0]; + if (values.length == 2) return Math.max(values[0], values[1]); + float max = Float.MIN_VALUE; + for (float i : values) { + if (i > max) { + max = i; + } + } + return max; + } + + public static Pair getCoordinates(@Nullable Direction dir, float min, float max) { + float x1 = min, y1 = min, z1 = min, x2 = max, y2 = max, z2 = max; + if (dir != null) { + switch (dir) { + case DOWN -> { + y1 = 0; + y2 = min; + } + case UP -> { + y1 = max; + y2 = 16; + } + case NORTH -> { + z1 = 0; + z2 = min; + } + case SOUTH -> { + z1 = max; + z2 = 16; + } + case WEST -> { + x1 = 0; + x2 = min; + } + case EAST -> { + x1 = max; + x2 = 16; + } + } + } + return ImmutablePair.of(new Vector3f(x1, y1, z1), new Vector3f(x2, y2, z2)); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java index 3b42d4f2b80..d699f5223e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java @@ -52,6 +52,7 @@ import com.mojang.datafixers.util.Pair; import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; +import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.GLFW; @@ -67,6 +68,7 @@ public class GTUtil { public static final Direction[] DIRECTIONS = Direction.values(); + public static final @Nullable Direction @NotNull [] DIRECTIONS_WITH_NULL = ArrayUtils.add(DIRECTIONS, null); @SuppressWarnings("UnstableApiUsage") public static final ImmutableList NON_CORNER_NEIGHBOURS = Util.make(() -> { diff --git a/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeBlockStateProvider.java b/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeBlockstateProvider.java similarity index 64% rename from src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeBlockStateProvider.java rename to src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeBlockstateProvider.java index b18f2bcd41d..8d69125eeb2 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeBlockStateProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeBlockstateProvider.java @@ -1,6 +1,9 @@ package com.gregtechceu.gtceu.utils.data; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; +import com.gregtechceu.gtceu.common.registry.GTRegistration; +import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; @@ -14,11 +17,21 @@ import java.util.Map; import java.util.function.BiConsumer; -public class RuntimeBlockStateProvider extends GTBlockstateProvider { +public class RuntimeBlockstateProvider extends GTBlockstateProvider { + + // Fake a data provider for the GT model builders so we don't need to handle this ourselves in any way :3 + public static final RuntimeBlockstateProvider INSTANCE = new RuntimeBlockstateProvider( + GTRegistration.REGISTRATE, new PackOutput(GTCEu.GTCEU_FOLDER), + (loc, json) -> { + if (!loc.getPath().endsWith(".json")) { + loc = loc.withSuffix(".json"); + } + GTDynamicResourcePack.addResource(loc, json); + }); protected final BiConsumer consumer; - public RuntimeBlockStateProvider(AbstractRegistrate parent, PackOutput packOutput, + public RuntimeBlockstateProvider(AbstractRegistrate parent, PackOutput packOutput, BiConsumer consumer) { super(parent, packOutput, RuntimeExistingFileHelper.INSTANCE); this.consumer = consumer; @@ -33,7 +46,8 @@ public void run() { processModelProvider(itemModels()); for (Map.Entry entry : registeredBlocks.entrySet()) { - ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(entry.getKey()).withPrefix("blockstates/"); + ResourceLocation loc = GTDynamicResourcePack.BLOCKSTATE_ID_CONVERTER + .idToFile(BuiltInRegistries.BLOCK.getKey(entry.getKey())); this.consumer.accept(loc, entry.getValue().toJson()); } // only clear the data *after* saving so we can keep track of it during the KJS event diff --git a/src/main/java/com/gregtechceu/gtceu/utils/memoization/GTMemoizer.java b/src/main/java/com/gregtechceu/gtceu/utils/memoization/GTMemoizer.java index be27b6cb231..36728327d77 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/memoization/GTMemoizer.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/memoization/GTMemoizer.java @@ -1,12 +1,19 @@ package com.gregtechceu.gtceu.utils.memoization; +import com.gregtechceu.gtceu.utils.memoization.function.MemoizedBiFunction; +import com.gregtechceu.gtceu.utils.memoization.function.MemoizedFunction; +import com.gregtechceu.gtceu.utils.memoization.function.MemoizedTriFunction; + import net.minecraft.world.level.block.Block; +import lombok.Getter; import org.apache.commons.lang3.function.TriFunction; +import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; @@ -27,32 +34,59 @@ public static MemoizedBlockSupplier memoizeBlockSupplier(Su return new MemoizedBlockSupplier<>(delegate); } - public static Function memoizeFunctionWeakIdent(final Function memoFunction) { - return new Function<>() { + public static MemoizedFunction memoizeFunctionWeakIdent(final Function memoFunction) { + return new MemoizedFunction<>() { + @Getter private final Map cache = new ConcurrentWeakIdentityHashMap<>(); + @Override public R apply(T key) { return this.cache.computeIfAbsent(key, memoFunction); } + @Override public String toString() { return "memoizeFunctionWeakIdent/1[function=" + memoFunction + ", size=" + this.cache.size() + "]"; } }; } - public static TriFunction memoize(final TriFunction memoTriFunction) { - return new TriFunction<>() { + public static MemoizedBiFunction memoizeFunctionWeakIdent(final BiFunction memoBiFunction) { + return new MemoizedBiFunction<>() { + + @Getter + private final Map, R> cache = new ConcurrentWeakIdentityHashMap<>(); + + @Override + public R apply(T key1, U key2) { + return this.cache.computeIfAbsent(Pair.of(key1, key2), (key) -> { + return memoBiFunction.apply(key.getLeft(), key.getRight()); + }); + } + + @Override + public String toString() { + return "memoizeFunctionWeakIdent/2[function=" + memoBiFunction + ", size=" + this.cache.size() + "]"; + } + }; + } + + public static MemoizedTriFunction memoize(final TriFunction memoTriFunction) { + return new MemoizedTriFunction<>() { + @Getter private final Map, R> cache = new ConcurrentHashMap<>(); + @Override public R apply(T key1, U key2, V key3) { return this.cache.computeIfAbsent(Triple.of(key1, key2, key3), (cacheKey) -> { return memoTriFunction.apply(cacheKey.getLeft(), cacheKey.getMiddle(), cacheKey.getRight()); }); } + @Override public String toString() { return "memoize/3[function=" + memoTriFunction + ", size=" + this.cache.size() + "]"; } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedBiFunction.java b/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedBiFunction.java new file mode 100644 index 00000000000..4934e7033d5 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedBiFunction.java @@ -0,0 +1,11 @@ +package com.gregtechceu.gtceu.utils.memoization.function; + +import org.apache.commons.lang3.tuple.Pair; + +import java.util.Map; +import java.util.function.BiFunction; + +public interface MemoizedBiFunction extends BiFunction { + + Map, R> getCache(); +} diff --git a/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedFunction.java b/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedFunction.java new file mode 100644 index 00000000000..61b79bb6b9d --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedFunction.java @@ -0,0 +1,9 @@ +package com.gregtechceu.gtceu.utils.memoization.function; + +import java.util.Map; +import java.util.function.Function; + +public interface MemoizedFunction extends Function { + + Map getCache(); +} diff --git a/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedTriFunction.java b/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedTriFunction.java new file mode 100644 index 00000000000..f5608e2f489 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/utils/memoization/function/MemoizedTriFunction.java @@ -0,0 +1,11 @@ +package com.gregtechceu.gtceu.utils.memoization.function; + +import org.apache.commons.lang3.function.TriFunction; +import org.apache.commons.lang3.tuple.Triple; + +import java.util.Map; + +public interface MemoizedTriFunction extends TriFunction { + + Map, R> getCache(); +} diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side.png b/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side.png index fa5c3c037c0e19e0421ad3b07cf173908a31016c..695048d32a3cf9f304c62896a01d9a34fccd7d7d 100644 GIT binary patch delta 282 zcmV+#0pLO5;`BjzY!JFAdm8Leu$=SjqybIL_ zguB}?f}pHJVSG{^on-+C{SxHI&j}b?7ED2BbB{)q^+dp~vVWijgxj0YDaegZ-vxwQ zYxe}%;Y;AUHeoH`V8GaPCL9ZlYwMkL=ca$NX!v)FNMK&u3`>CwLuPP{1+Gt`!}*~- zHV{q(@;Jc0x)WhphjjmofMc1v%6cMjJ<;C+#{Nq{h;V&%i;gAhkm?;`f&L)!lbF{A gI%)`~dwcZ&!4pYq0kCbKWrbfa7wY84RAT KelF{r5}E)Z79VK< literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png b/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png new file mode 100644 index 0000000000000000000000000000000000000000..d0d5cdc54a591822b7d7ade664e72b143c97649d GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!3HFyJAa%3Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9GG!XV7ZFl&wkP>{XE)7O>#IhzQRn6?U^4mVIJ$kW9!#N&8!!U6$LtER*R2IXxG%2CG3%8v^;n=iJQ`!{c((M m*zVD6IdQ_D3@51!28IRgI?{)f4jTeZXYh3Ob6Mw<&;$TuYCbps literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png.mcmeta new file mode 100644 index 00000000000..21972735d33 --- /dev/null +++ b/src/main/resources/assets/gtceu/textures/block/pipe/pipe_optical_side_overlay_active.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 25 + } +} From e62003c82fbe1b969bf0308d7799aeb937cf3e4f Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 1 Feb 2026 22:07:11 +0200 Subject: [PATCH 14/78] Fix missing/invalid pipe model issues (#4530) --- .../resources/assets/gtceu/lang/en_ud.json | 17 ++- .../resources/assets/gtceu/lang/en_us.json | 28 ++--- .../block/pipe/huge_duct_pipe/center.json | 1 - .../block/pipe/large_duct_pipe/center.json | 1 - .../block/pipe/normal_duct_pipe/center.json | 1 - .../block/pipe/normal_laser_pipe/center.json | 1 - .../pipe/normal_laser_pipe/center_active.json | 111 +++++++++++++++++- .../normal_laser_pipe/connection_active.json | 95 ++++++++++++++- .../pipe/normal_optical_pipe/center.json | 1 - .../normal_optical_pipe/center_active.json | 111 +++++++++++++++++- .../connection_active.json | 95 ++++++++++++++- .../block/pipe/small_duct_pipe/center.json | 1 - .../model/machine/overlays/HPCAOverlay.java | 63 ++++++---- .../machine/overlays/WorkableOverlays.java | 16 +++ .../client/model/pipe/ActivablePipeModel.java | 95 ++++++++++++--- .../gtceu/client/model/pipe/PipeModel.java | 100 ++++++++++++---- .../data/model/builder/PipeModelBuilder.java | 40 +++---- .../data/model/builder/package-info.java | 4 + .../utils/data/RuntimeExistingFileHelper.java | 72 ++++++++++-- 19 files changed, 736 insertions(+), 117 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/data/model/builder/package-info.java diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index a0a937ed0cb..f51d500f0c5 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -66,6 +66,7 @@ "behaviour.lighter.uses": "%d :sǝsn buıuıɐɯǝᴚ", "behaviour.memory_card.client_msg.cleared": "pǝɹɐǝןɔ uoıʇɐɹnbıɟuoɔ pǝɹoʇS", "behaviour.memory_card.client_msg.copied": "uoıʇɐɹnbıɟuoɔ ǝuıɥɔɐɯ pǝıdoƆ", + "behaviour.memory_card.client_msg.missing_items": "uoıʇɐɹnbıɟuoɔ ǝʇsɐd oʇ pǝɹınbǝɹ sɯǝʇı buıssıW", "behaviour.memory_card.client_msg.pasted": "uoıʇɐɹnbıɟuoɔ ǝuıɥɔɐɯ pǝıןddⱯ", "behaviour.memory_card.copy_target": "%s :buıʎdoƆ", "behaviour.memory_card.disabled": "ɹ§pǝןqɐsıᗡɔ§", @@ -1745,6 +1746,7 @@ "config.gtceu.option.addLoot": "ʇooꞀppɐ", "config.gtceu.option.ae2": "ᄅǝɐ", "config.gtceu.option.allowDrumsInputFluidsFromOutputSide": "ǝpıSʇndʇnOɯoɹℲspınןℲʇnduIsɯnɹᗡʍoןןɐ", + "config.gtceu.option.allowedImageDomains": "suıɐɯoᗡǝbɐɯIpǝʍoןןɐ", "config.gtceu.option.animationTime": "ǝɯı⟘uoıʇɐɯıuɐ", "config.gtceu.option.arcRecyclingYield": "pןǝıʎbuıןɔʎɔǝᴚɔɹɐ", "config.gtceu.option.armorHud": "pnHɹoɯɹɐ", @@ -1892,7 +1894,7 @@ "config.gtceu.option.steelSteamMultiblocks": "sʞɔoןqıʇןnWɯɐǝʇSןǝǝʇs", "config.gtceu.option.surfaceRockProspectRange": "ǝbuɐᴚʇɔǝdsoɹԀʞɔoᴚǝɔɐɟɹns", "config.gtceu.option.tankItemFluidPreview": "ʍǝıʌǝɹԀpınןℲɯǝʇIʞuɐʇ", - "config.gtceu.option.temperaturesInKelvin": "uıʌןǝʞuIsǝɹnʇɐɹǝdɯǝʇ", + "config.gtceu.option.temperaturesInCelsius": "snısןǝƆuIsǝɹnʇɐɹǝdɯǝʇ", "config.gtceu.option.titaniumBoilerHeatSpeed": "pǝǝdSʇɐǝHɹǝןıoᗺɯnıuɐʇıʇ", "config.gtceu.option.titaniumBoilerMaxTemperature": "ǝɹnʇɐɹǝdɯǝ⟘xɐWɹǝןıoᗺɯnıuɐʇıʇ", "config.gtceu.option.toggle": "ǝןbboʇ", @@ -2616,6 +2618,7 @@ "gtceu.key.armor_mode_switch": "ɥɔʇıʍS ǝpoW ɹoɯɹⱯ", "gtceu.key.enable_boots": "dɯnſ pǝʇsooᗺ ǝןqɐuƎ", "gtceu.key.enable_jetpack": "ʞɔɐdʇǝſ ǝןqɐuƎ", + "gtceu.key.enable_step_assist": "ʇsıssⱯdǝʇS ǝןqɐuƎ", "gtceu.key.tool_aoe_change": "ɥɔʇıʍS ǝpoW ƎoⱯ ןoo⟘", "gtceu.large_boiler": "ɹǝןıoᗺ ǝbɹɐꞀ", "gtceu.large_chemical_reactor": "ɹoʇɔɐǝᴚ ןɐɔıɯǝɥƆ ǝbɹɐꞀ", @@ -4733,7 +4736,7 @@ "item.gtceu.talc_dust": "ɔןɐ⟘", "item.gtceu.tantalum_capacitor": "ɹoʇıɔɐdɐƆ ɯnןɐʇuɐ⟘", "item.gtceu.terminal": "ןɐuıɯɹǝ⟘", - "item.gtceu.terminal.tooltip": "ʞɔoןq-ıʇןnɯ ǝɥʇ pןınq ʎןןɐɔıʇɐɯoʇnɐ oʇ ɹǝןןoɹʇuoɔ ɐ uo ʞɔıןƆ-ᴚ + ʇɟıɥS", + "item.gtceu.terminal.tooltip": "ʎɹoʇuǝʌuı ɹnoʎ ɯoɹɟ sɯǝʇı ɥʇıʍ ʞɔoןqıʇןnɯ ɐ pןınq ʎןןɐɔıʇɐɯoʇnɐ oʇ ɹǝןןoɹʇuoɔ ɐ uo ʞɔıןƆ-ᴚ + ʇɟıɥS", "item.gtceu.text_module": "ǝןnpoW ʇxǝ⟘", "item.gtceu.tiny_ash_dust": "sǝɥsⱯ ɟo ǝןıԀ ʎuı⟘", "item.gtceu.tiny_basaltic_mineral_sand_dust": "puɐS ןɐɹǝuıW ɔıʇןɐsɐᗺ ɟo ǝןıԀ ʎuı⟘", @@ -4836,7 +4839,7 @@ "item.gtceu.tool.lv_screwdriver.tooltip": "sǝuıɥɔɐW puɐ sɹǝʌoƆ sʇsnظpⱯ8§", "item.gtceu.tool.lv_wirecutter": ")ΛꞀ( ɹǝʇʇnƆ ǝɹıM %s", "item.gtceu.tool.lv_wrench": ")ΛꞀ( ɥɔuǝɹM %s", - "item.gtceu.tool.lv_wrench.tooltip": "sǝuıɥɔɐW ǝןʇuɐɯsıp oʇs ʞɔıןɔ ʇɟǝן pןoH8§", + "item.gtceu.tool.lv_wrench.tooltip": "sǝuıɥɔɐW ǝןʇuɐɯsıp oʇ ʞɔıןɔ ʇɟǝן pןoH8§", "item.gtceu.tool.mallet": "ʇǝןןɐW ʇɟoS %s", "item.gtceu.tool.mallet.tooltip.0": "˙ǝdıɔǝᴚ ʇuǝɹɹnƆ ɹǝʇɟⱯ ǝuıɥɔɐW ǝsnɐԀ oʇ ʞɐǝuS8§", "item.gtceu.tool.mallet.tooltip.1": "sǝuıɥɔɐW sʇɹɐʇS/sdoʇS8§", @@ -5698,20 +5701,24 @@ "metaarmor.message.nightvision.disabled": "ɟɟOɔ§ :uoısıΛʇɥbıNq§", "metaarmor.message.nightvision.enabled": "uOɐ§ :uoısıΛʇɥbıNq§", "metaarmor.message.nightvision.error": "¡ɹǝʍod ɥbnouǝ ʇoNɔ§", - "metaarmor.nms.boosted_jump.disabled": "pǝןqɐsıᗡ ʇsooᗺ dɯnſ :ǝʇınS ™ǝןɔsnWouɐN", - "metaarmor.nms.boosted_jump.enabled": "pǝןqɐuƎ ʇsooᗺ dɯnſ :ǝʇınS ™ǝןɔsnWouɐN", "metaarmor.nms.nightvision.disabled": "pǝןqɐsıᗡ uoısıΛʇɥbıN :ǝʇınS ™ǝןɔsnWouɐN", "metaarmor.nms.nightvision.enabled": "pǝןqɐuƎ uoısıΛʇɥbıN :ǝʇınS ™ǝןɔsnWouɐN", "metaarmor.nms.nightvision.error": "¡ɹǝʍod ɥbnouǝ ʇoNɔ§ :ǝʇınS ™ǝןɔsnWouɐN", "metaarmor.nms.share.disable": "pǝןqɐsıᗡ buıbɹɐɥƆ :ǝʇınS ™ǝןɔsnWouɐN", "metaarmor.nms.share.enable": "pǝןqɐuƎ buıbɹɐɥƆ :ǝʇınS ™ǝןɔsnWouɐN", "metaarmor.nms.share.error": "¡buıbɹɐɥɔ ɹoɟ ɹǝʍod ɥbnouǝ ʇoNɔ§ :ǝʇınS ™ǝןɔsnWouɐN", + "metaarmor.nms.step_assist.disabled": "pǝןqɐsıᗡ ʇsıssⱯdǝʇS :ǝʇınS ™ǝןɔsnWouɐN", + "metaarmor.nms.step_assist.enabled": "pǝןqɐuƎ ʇsıssⱯdǝʇS :ǝʇınS ™ǝןɔsnWouɐN", + "metaarmor.qts.boosted_jump.disabled": "pǝןqɐsıᗡ ʇsooᗺ dɯnſ :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", + "metaarmor.qts.boosted_jump.enabled": "pǝןqɐuƎ ʇsooᗺ dɯnſ :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.qts.nightvision.disabled": "pǝןqɐsıᗡ uoısıΛʇɥbıN :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.qts.nightvision.enabled": "pǝןqɐuƎ uoısıΛʇɥbıN :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.qts.nightvision.error": "¡ɹǝʍod ɥbnouǝ ʇoNɔ§ :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.qts.share.disable": "pǝןqɐsıᗡ buıbɹɐɥƆ :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.qts.share.enable": "pǝןqɐuƎ buıbɹɐɥƆ :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.qts.share.error": "¡buıbɹɐɥɔ ɹoɟ ɹǝʍod ɥbnouǝ ʇoNɔ§ :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", + "metaarmor.qts.step_assist.disabled": "pǝןqɐsıᗡ ʇsıssⱯdǝʇS :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", + "metaarmor.qts.step_assist.enabled": "pǝןqɐuƎ ʇsıssⱯdǝʇS :ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "metaarmor.tooltip.autoeat": "ʎɹoʇuǝʌuI ɯoɹɟ pooℲ buıs∩ ʎq ɹɐᗺ pooℲ sǝɥsıuǝןdǝᴚ", "metaarmor.tooltip.breath": "ɹɐᗺ ɥʇɐǝɹᗺ ɹǝʇɐʍɹǝpu∩ sǝɥsıuǝןdǝᴚ", "metaarmor.tooltip.burning": "buıuɹnᗺ sǝıɟıןןnN", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index b738160a97f..3ceb805dee1 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -66,6 +66,7 @@ "behaviour.lighter.uses": "Remaining uses: %d", "behaviour.memory_card.client_msg.cleared": "Stored configuration cleared", "behaviour.memory_card.client_msg.copied": "Copied machine configuration", + "behaviour.memory_card.client_msg.missing_items": "Missing items required to paste configuration", "behaviour.memory_card.client_msg.pasted": "Applied machine configuration", "behaviour.memory_card.copy_target": "Copying: %s", "behaviour.memory_card.disabled": "§cDisabled§r", @@ -1745,6 +1746,7 @@ "config.gtceu.option.addLoot": "addLoot", "config.gtceu.option.ae2": "ae2", "config.gtceu.option.allowDrumsInputFluidsFromOutputSide": "allowDrumsInputFluidsFromOutputSide", + "config.gtceu.option.allowedImageDomains": "allowedImageDomains", "config.gtceu.option.animationTime": "animationTime", "config.gtceu.option.arcRecyclingYield": "arcRecyclingYield", "config.gtceu.option.armorHud": "armorHud", @@ -1892,7 +1894,7 @@ "config.gtceu.option.steelSteamMultiblocks": "steelSteamMultiblocks", "config.gtceu.option.surfaceRockProspectRange": "surfaceRockProspectRange", "config.gtceu.option.tankItemFluidPreview": "tankItemFluidPreview", - "config.gtceu.option.temperaturesInKelvin": "temperaturesInKelvin", + "config.gtceu.option.temperaturesInCelsius": "temperaturesInCelsius", "config.gtceu.option.titaniumBoilerHeatSpeed": "titaniumBoilerHeatSpeed", "config.gtceu.option.titaniumBoilerMaxTemperature": "titaniumBoilerMaxTemperature", "config.gtceu.option.toggle": "toggle", @@ -2616,8 +2618,8 @@ "gtceu.key.armor_mode_switch": "Armor Mode Switch", "gtceu.key.enable_boots": "Enable Boosted Jump", "gtceu.key.enable_jetpack": "Enable Jetpack", - "gtceu.key.tool_aoe_change": "Tool AoE Mode Switch", "gtceu.key.enable_step_assist": "Enable StepAssist", + "gtceu.key.tool_aoe_change": "Tool AoE Mode Switch", "gtceu.large_boiler": "Large Boiler", "gtceu.large_chemical_reactor": "Large Chemical Reactor", "gtceu.laser_engraver": "Laser Engraver", @@ -4734,7 +4736,7 @@ "item.gtceu.talc_dust": "Talc", "item.gtceu.tantalum_capacitor": "Tantalum Capacitor", "item.gtceu.terminal": "Terminal", - "item.gtceu.terminal.tooltip": "Shift + R-Click on a controller to automatically build the multi-block", + "item.gtceu.terminal.tooltip": "Shift + R-Click on a controller to automatically build a multiblock with items from your inventory", "item.gtceu.text_module": "Text Module", "item.gtceu.tiny_ash_dust": "Tiny Pile of Ashes", "item.gtceu.tiny_basaltic_mineral_sand_dust": "Tiny Pile of Basaltic Mineral Sand", @@ -5699,26 +5701,24 @@ "metaarmor.message.nightvision.disabled": "§bNightVision: §cOff", "metaarmor.message.nightvision.enabled": "§bNightVision: §aOn", "metaarmor.message.nightvision.error": "§cNot enough power!", - "metaarmor.message.step_assist.disabled": "StepAssist: §cOff", - "metaarmor.message.step_assist.enabled": "StepAssist: §aOn", "metaarmor.nms.nightvision.disabled": "NanoMuscle™ Suite: NightVision Disabled", "metaarmor.nms.nightvision.enabled": "NanoMuscle™ Suite: NightVision Enabled", "metaarmor.nms.nightvision.error": "NanoMuscle™ Suite: §cNot enough power!", - "metaarmor.qts.nightvision.disabled": "QuarkTech™ Suite: NightVision Disabled", - "metaarmor.qts.nightvision.enabled": "QuarkTech™ Suite: NightVision Enabled", - "metaarmor.qts.nightvision.error": "QuarkTech™ Suite: §cNot enough power!", - "metaarmor.nms.step_assist.disabled": "NanoMuscle™ Suite: StepAssist Disabled", - "metaarmor.nms.step_assist.enabled": "NanoMuscle™ Suite: StepAssist Enabled", - "metaarmor.qts.step_assist.disabled": "QuarkTech™ Suite: StepAssist Disabled", - "metaarmor.qts.step_assist.enabled": "QuarkTech™ Suite: StepAssist Enabled", "metaarmor.nms.share.disable": "NanoMuscle™ Suite: Charging Disabled", "metaarmor.nms.share.enable": "NanoMuscle™ Suite: Charging Enabled", "metaarmor.nms.share.error": "NanoMuscle™ Suite: §cNot enough power for charging!", + "metaarmor.nms.step_assist.disabled": "NanoMuscle™ Suite: StepAssist Disabled", + "metaarmor.nms.step_assist.enabled": "NanoMuscle™ Suite: StepAssist Enabled", + "metaarmor.qts.boosted_jump.disabled": "QuarkTech™ Suite: Jump Boost Disabled", + "metaarmor.qts.boosted_jump.enabled": "QuarkTech™ Suite: Jump Boost Enabled", + "metaarmor.qts.nightvision.disabled": "QuarkTech™ Suite: NightVision Disabled", + "metaarmor.qts.nightvision.enabled": "QuarkTech™ Suite: NightVision Enabled", + "metaarmor.qts.nightvision.error": "QuarkTech™ Suite: §cNot enough power!", "metaarmor.qts.share.disable": "QuarkTech™ Suite: Charging Disabled", "metaarmor.qts.share.enable": "QuarkTech™ Suite: Charging Enabled", "metaarmor.qts.share.error": "QuarkTech™ Suite: §cNot enough power for charging!", - "metaarmor.qts.boosted_jump.disabled": "QuarkTech™ Suite: Jump Boost Disabled", - "metaarmor.qts.boosted_jump.enabled": "QuarkTech™ Suite: Jump Boost Enabled", + "metaarmor.qts.step_assist.disabled": "QuarkTech™ Suite: StepAssist Disabled", + "metaarmor.qts.step_assist.enabled": "QuarkTech™ Suite: StepAssist Enabled", "metaarmor.tooltip.autoeat": "Replenishes Food Bar by Using Food from Inventory", "metaarmor.tooltip.breath": "Replenishes Underwater Breath Bar", "metaarmor.tooltip.burning": "Nullifies Burning", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json index 6318ac6c5b3..1916aa7d966 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json @@ -41,7 +41,6 @@ } ], "textures": { - "end": "gtceu:block/pipe/pipe_duct_in", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json index 26aeac6acf3..39b3a894eac 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json @@ -41,7 +41,6 @@ } ], "textures": { - "end": "gtceu:block/pipe/pipe_duct_in", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json index 55bac017a34..1c7b6fe9ce9 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json @@ -41,7 +41,6 @@ } ], "textures": { - "end": "gtceu:block/pipe/pipe_duct_in", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json index 0cc3032c0e5..9de7a83201f 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json @@ -79,7 +79,6 @@ } ], "textures": { - "end": "gtceu:block/pipe/pipe_laser_in", "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json index 18781c339d2..088aa774a9f 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json @@ -1,6 +1,115 @@ { - "parent": "gtceu:block/pipe/normal_laser_pipe/center", + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 5 + ], + "to": [ + 11, + 11, + 11 + ] + }, + { + "faces": { + "down": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "east": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "up": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + 4.998, + 4.998 + ], + "to": [ + 11.002, + 11.002, + 11.002 + ] + } + ], "textures": { + "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay_emissive" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json index a9170249dab..83cb7127326 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json @@ -1,6 +1,99 @@ { - "parent": "gtceu:block/pipe/normal_laser_pipe/connection", + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 0, + 5 + ], + "to": [ + 11, + 5, + 11 + ] + }, + { + "faces": { + "east": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + -0.002, + 4.998 + ], + "to": [ + 11.002, + 5.002, + 11.002 + ] + } + ], "textures": { + "end": "gtceu:block/pipe/pipe_laser_in", + "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay_emissive" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json index c5356268055..1c46b15f85c 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json @@ -79,7 +79,6 @@ } ], "textures": { - "end": "gtceu:block/pipe/pipe_optical_in", "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json index ac513d036e5..3a643f6dcc4 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json @@ -1,6 +1,115 @@ { - "parent": "gtceu:block/pipe/normal_optical_pipe/center", + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "texture": "#side", + "tintindex": 0 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#side", + "tintindex": 0 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 5, + 5 + ], + "to": [ + 11, + 11, + 11 + ] + }, + { + "faces": { + "down": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "east": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "up": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + 4.998, + 4.998 + ], + "to": [ + 11.002, + 11.002, + 11.002 + ] + } + ], "textures": { + "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay_active" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json index 224c446f985..962efa95cf6 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json @@ -1,6 +1,99 @@ { - "parent": "gtceu:block/pipe/normal_optical_pipe/connection", + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#end", + "tintindex": 1 + }, + "east": { + "texture": "#side", + "tintindex": 0 + }, + "north": { + "texture": "#side", + "tintindex": 0 + }, + "south": { + "texture": "#side", + "tintindex": 0 + }, + "up": { + "texture": "#end", + "tintindex": 1 + }, + "west": { + "texture": "#side", + "tintindex": 0 + } + }, + "from": [ + 5, + 0, + 5 + ], + "to": [ + 11, + 5, + 11 + ] + }, + { + "faces": { + "east": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "north": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "south": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + }, + "west": { + "forge_data": { + "ambient_occlusion": false, + "block_light": 15, + "sky_light": 15 + }, + "texture": "#side_overlay", + "tintindex": 2 + } + }, + "from": [ + 4.998, + -0.002, + 4.998 + ], + "to": [ + 11.002, + 5.002, + 11.002 + ] + } + ], "textures": { + "end": "gtceu:block/pipe/pipe_optical_in", + "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay_active" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json index 98a31bc47ef..cf2698d2453 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json @@ -41,7 +41,6 @@ } ], "textures": { - "end": "gtceu:block/pipe/pipe_duct_in", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/HPCAOverlay.java b/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/HPCAOverlay.java index 3ea09f9003c..ed8de15bb92 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/HPCAOverlay.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/HPCAOverlay.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic.Status; import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; import com.gregtechceu.gtceu.common.data.models.GTModels; +import com.gregtechceu.gtceu.utils.data.RuntimeExistingFileHelper; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.resources.ResourceLocation; @@ -23,31 +24,47 @@ public class HPCAOverlay { // spotless:off public static HPCAOverlay get(ResourceLocation normalSprite, ResourceLocation damagedSprite, ExistingFileHelper fileHelper) { - // normal - if (!fileHelper.exists(normalSprite, GTBlockstateProvider.TEXTURE)) { - return HPCAOverlay.EMPTY; + if (fileHelper instanceof RuntimeExistingFileHelper runtimeFileHelper) { + // if fileHelper is an instance of RuntimeExistingFileHelper, we have to enable its existence checking. + // the AutoCloseable warning is suppressed here because there's no clean way to + // use a try-with-resources statement in this. + //noinspection resource + fileHelper = runtimeFileHelper.activeHelper(); } - ResourceLocation activeSprite = normalSprite.withSuffix("_active"); - if (!fileHelper.exists(activeSprite, GTBlockstateProvider.TEXTURE)) activeSprite = normalSprite; - ResourceLocation damagedActiveSprite = damagedSprite.withSuffix("_active"); - if (!fileHelper.exists(damagedActiveSprite, GTBlockstateProvider.TEXTURE)) damagedActiveSprite = damagedSprite; - - // emissive - ResourceLocation normalSpriteEmissive = normalSprite.withSuffix("_emissive"); - if (!fileHelper.exists(normalSpriteEmissive, GTBlockstateProvider.TEXTURE)) normalSpriteEmissive = null; - - ResourceLocation activeSpriteEmissive = activeSprite.withSuffix("_emissive"); - if (!fileHelper.exists(activeSpriteEmissive, GTBlockstateProvider.TEXTURE)) activeSpriteEmissive = null; - - ResourceLocation damagedSpriteEmissive = damagedSprite.withSuffix("_emissive"); - if (!fileHelper.exists(damagedSpriteEmissive, GTBlockstateProvider.TEXTURE)) damagedSpriteEmissive = null; - - ResourceLocation damagedActiveSpriteEmissive = damagedActiveSprite.withSuffix("_emissive"); - if (!fileHelper.exists(damagedActiveSpriteEmissive, GTBlockstateProvider.TEXTURE)) damagedActiveSpriteEmissive = null; - - return new HPCAOverlay(normalSprite, activeSprite, damagedSprite, damagedActiveSprite, - normalSpriteEmissive, activeSpriteEmissive, damagedSpriteEmissive, damagedActiveSpriteEmissive); + try { + // normal + if (!fileHelper.exists(normalSprite, GTBlockstateProvider.TEXTURE)) { + return HPCAOverlay.EMPTY; + } + ResourceLocation activeSprite = normalSprite.withSuffix("_active"); + if (!fileHelper.exists(activeSprite, GTBlockstateProvider.TEXTURE)) activeSprite = normalSprite; + + ResourceLocation damagedActiveSprite = damagedSprite.withSuffix("_active"); + if (!fileHelper.exists(damagedActiveSprite, GTBlockstateProvider.TEXTURE)) damagedActiveSprite = damagedSprite; + + // emissive + ResourceLocation normalSpriteEmissive = normalSprite.withSuffix("_emissive"); + if (!fileHelper.exists(normalSpriteEmissive, GTBlockstateProvider.TEXTURE)) normalSpriteEmissive = null; + + ResourceLocation activeSpriteEmissive = activeSprite.withSuffix("_emissive"); + if (!fileHelper.exists(activeSpriteEmissive, GTBlockstateProvider.TEXTURE)) activeSpriteEmissive = null; + + ResourceLocation damagedSpriteEmissive = damagedSprite.withSuffix("_emissive"); + if (!fileHelper.exists(damagedSpriteEmissive, GTBlockstateProvider.TEXTURE)) damagedSpriteEmissive = null; + + ResourceLocation damagedActiveSpriteEmissive = damagedActiveSprite.withSuffix("_emissive"); + if (!fileHelper.exists(damagedActiveSpriteEmissive, GTBlockstateProvider.TEXTURE)) damagedActiveSpriteEmissive = null; + + return new HPCAOverlay(normalSprite, activeSprite, damagedSprite, damagedActiveSprite, + normalSpriteEmissive, activeSpriteEmissive, damagedSpriteEmissive, damagedActiveSpriteEmissive); + } finally { + if (fileHelper instanceof RuntimeExistingFileHelper.Active activeHelper) { + // close the active helper, just for good measure. + // Also in case we ever make it do anything, this won't be forgotten. + activeHelper.close(); + } + } } // spotless:on diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/WorkableOverlays.java b/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/WorkableOverlays.java index bf09a89f026..373ab7b33c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/WorkableOverlays.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/machine/overlays/WorkableOverlays.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; import com.gregtechceu.gtceu.common.data.models.GTMachineModels; import com.gregtechceu.gtceu.common.data.models.GTModels; +import com.gregtechceu.gtceu.utils.data.RuntimeExistingFileHelper; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -25,6 +26,14 @@ public class WorkableOverlays { public static WorkableOverlays get(ResourceLocation textureDir, ExistingFileHelper fileHelper) { + if (fileHelper instanceof RuntimeExistingFileHelper runtimeFileHelper) { + // if fileHelper is an instance of RuntimeExistingFileHelper, we have to enable its existence checking. + // the AutoCloseable warning is suppressed here because there's no clean way to + // use a try-with-resources statement in this. + // noinspection resource + fileHelper = runtimeFileHelper.activeHelper(); + } + WorkableOverlays model = new WorkableOverlays(textureDir); for (OverlayFace overlayFace : OverlayFace.VALUES) { @@ -55,6 +64,13 @@ public static WorkableOverlays get(ResourceLocation textureDir, ExistingFileHelp model.textures.put(overlayFace, new StatusTextures(normalSprite, activeSprite, pausedSprite, normalSpriteEmissive, activeSpriteEmissive, pausedSpriteEmissive)); } + + if (fileHelper instanceof RuntimeExistingFileHelper.Active activeHelper) { + // close the active helper, just for good measure. + // Also in case we ever make it do anything, this won't be forgotten. + activeHelper.close(); + } + return model; } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java index dc257bd4770..4213be34926 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java @@ -5,10 +5,14 @@ import com.gregtechceu.gtceu.api.registry.registrate.provider.GTBlockstateProvider; import com.gregtechceu.gtceu.data.model.builder.PipeModelBuilder; +import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.model.generators.BlockModelBuilder; import net.minecraftforge.client.model.generators.IGeneratedBlockState; +import net.minecraftforge.client.model.generators.ModelBuilder; +import net.minecraftforge.client.model.generators.ModelFile; +import it.unimi.dsi.fastutil.objects.Reference2FloatMap; import lombok.Setter; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -23,6 +27,8 @@ public class ActivablePipeModel extends PipeModel { public @Nullable ResourceLocation sideSecondaryActive, endSecondaryActive; @Setter public @Nullable ResourceLocation sideOverlayActive, endOverlayActive; + @Setter + public int activeEmissivity = 15; /// Use {@link #getOrCreateActiveBlockModel()} instead of referencing this field directly. private BlockModelBuilder activeBlockModel; @@ -67,8 +73,7 @@ protected BlockModelBuilder getOrCreateActiveBlockModel() { // spotless:off return this.activeBlockModel = this.provider.models().getBuilder(this.blockId.withSuffix("_active").toString()) .parent(this.getOrCreateActiveCenterElement()) - .customLoader(PipeModelBuilder::begin) - .thickness(this.thickness).provider(this.provider) + .customLoader(PipeModelBuilder.begin(this.thickness, this.provider)) .centerModels(this.getOrCreateActiveCenterElement().getLocation()) .connectionModels(this.getOrCreateActiveConnectionElement().getLocation()) .end(); @@ -87,7 +92,9 @@ protected BlockModelBuilder getOrCreateActiveCenterElement() { if (this.activeCenterElement != null) { return this.activeCenterElement; } - return this.activeCenterElement = makeActiveVariant(this.getOrCreateCenterElement()); + return this.activeCenterElement = makeActiveElementModel( + this.blockId.withPath(path -> "block/pipe/" + path + "/center_active"), + null, minCoord, minCoord, minCoord, maxCoord, maxCoord, maxCoord); } /** @@ -105,24 +112,82 @@ protected BlockModelBuilder getOrCreateActiveConnectionElement() { if (this.activeConnectionElement != null) { return this.activeConnectionElement; } - return this.activeConnectionElement = makeActiveVariant(this.getOrCreateConnectionElement()); + return this.activeConnectionElement = makeActiveElementModel( + this.blockId.withPath(path -> "block/pipe/" + path + "/connection_active"), + Direction.DOWN, minCoord, 0, minCoord, maxCoord, minCoord, maxCoord); } - protected BlockModelBuilder makeActiveVariant(BlockModelBuilder parentModel) { - BlockModelBuilder model = this.provider.models() - .getBuilder(parentModel.getLocation().withSuffix("_active").toString()) - .parent(parentModel); - // override non-null textures, leave unset ones as is - if (this.sideActive != null) model.texture("side", this.sideActive); - if (this.endActive != null) model.texture("end", this.endActive); - if (this.sideSecondaryActive != null) model.texture("side_secondary", this.sideSecondaryActive); - if (this.endSecondaryActive != null) model.texture("end_secondary", this.endSecondaryActive); - if (this.sideOverlayActive != null) model.texture("side_overlay", this.sideOverlayActive); - if (this.endOverlayActive != null) model.texture("end_overlay", this.endOverlayActive); + /** + * Fills out a model builder with applicable pipe model elements and returns it for further use + *
+ * This method is a copy of {@linkplain #makeElementModel} with the texture references changed for active variants. + * + * @param name the resulting model's path + * @param endFace the model face that's being created + * @param x1 min X coordinate in the range [-16,32] + * @param y1 min Y coordinate in the range [-16,32] + * @param z1 min Z coordinate in the range [-16,32] + * @param x2 max X coordinate in the range [-16,32] + * @param y2 max Y coordinate in the range [-16,32] + * @param z2 max Z coordinate in the range [-16,32] + * @implNote The coordinates must be in the correct order or the resulting model's cubes will be inside out! + * @see #makeElementModel + */ + protected BlockModelBuilder makeActiveElementModel(ResourceLocation name, @Nullable Direction endFace, + final float x1, final float y1, final float z1, + final float x2, final float y2, final float z2) { + Reference2FloatMap faceEndpoints = makeFaceEndpointMap(x1, y1, z1, x2, y2, z2); + + BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) + .parent(new ModelFile.UncheckedModelFile("block/block")); + + ResourceLocation side = this.sideActive != null ? this.sideActive : this.side; + ResourceLocation end = this.endActive != null ? this.endActive : this.end; + ResourceLocation sideSecondary = this.sideSecondaryActive != null ? this.sideSecondaryActive : + this.sideSecondary; + ResourceLocation endSecondary = this.endSecondaryActive != null ? this.endSecondaryActive : this.endSecondary; + ResourceLocation sideOverlay = this.sideOverlayActive != null ? this.sideOverlayActive : this.sideOverlay; + ResourceLocation endOverlay = this.endOverlayActive != null ? this.endOverlayActive : this.endOverlay; + + makePartModelElement(model, endFace, false, faceEndpoints, 0.0f, 0, 1, + x1, y1, z1, x2, y2, z2, side, end, SIDE_KEY, END_KEY, + this.sideActive != null, this.endActive != null); + + makePartModelElement(model, endFace, true, faceEndpoints, 0.001f, 0, 1, + x1, y1, z1, x2, y2, z2, sideSecondary, endSecondary, SIDE_SECONDARY_KEY, END_SECONDARY_KEY, + this.sideSecondaryActive != null, this.endSecondaryActive != null); + + makePartModelElement(model, endFace, true, faceEndpoints, 0.002f, 2, 2, + x1, y1, z1, x2, y2, z2, sideOverlay, endOverlay, SIDE_OVERLAY_KEY, END_OVERLAY_KEY, + this.sideOverlayActive != null, this.endOverlayActive != null); return model; } + protected > void makePartModelElement(T model, @Nullable Direction endFace, + boolean useEndWithFullCube, + Reference2FloatMap faceEndpoints, + float offset, int sideTintIndex, int endTintIndex, + final float x1, final float y1, final float z1, + final float x2, final float y2, final float z2, + @Nullable ResourceLocation sideTexture, + @Nullable ResourceLocation endTexture, + String sideKey, String endKey, + boolean sideEmissive, boolean endEmissive) { + this.makePartModelElement(model, endFace, useEndWithFullCube, faceEndpoints, offset, + sideTintIndex, endTintIndex, x1, y1, z1, x2, y2, z2, sideTexture, endTexture, sideKey, endKey, + (face, textureKey, builder) -> { + if (activeEmissivity == 0) { + return; + } + if (sideEmissive && textureKey.equals(sideKey)) { + builder.emissivity(activeEmissivity, activeEmissivity).ao(false); + } else if (endEmissive && textureKey.equals(endKey)) { + builder.emissivity(activeEmissivity, activeEmissivity).ao(false); + } + }); + } + @Override public IGeneratedBlockState createBlockState() { if (!this.getBlock().defaultBlockState().hasProperty(GTBlockStateProperties.ACTIVE)) { diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java index 83f0ceeb9ca..3fa772c5756 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java @@ -21,6 +21,7 @@ import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -78,6 +79,16 @@ */ public class PipeModel { + // spotless:off + public static final String + SIDE_KEY = "side", + END_KEY = "end", + SIDE_SECONDARY_KEY = "side_secondary", + END_SECONDARY_KEY = "end_secondary", + SIDE_OVERLAY_KEY = "side_overlay", + END_OVERLAY_KEY = "end_overlay"; + // spotless:on + public static final Set DYNAMIC_MODELS = new HashSet<>(); public static void initDynamicModels() { @@ -149,6 +160,7 @@ public final void dynamicModel() { * @see #getOrCreateCenterElement() * @see #getOrCreateConnectionElement() */ + @MustBeInvokedByOverriders public void initModels() { getOrCreateCenterElement(); getOrCreateConnectionElement(); @@ -174,8 +186,7 @@ protected BlockModelBuilder getOrCreateBlockModel() { return this.blockModel = this.provider.models().getBuilder(this.blockId.toString()) // make the "default" model be based on the center part's model .parent(this.getOrCreateCenterElement()) - .customLoader(PipeModelBuilder::begin) - .thickness(this.thickness).provider(this.provider) + .customLoader(PipeModelBuilder.begin(this.thickness, this.provider)) .centerModels(this.getOrCreateCenterElement().getLocation()) .connectionModels(this.getOrCreateConnectionElement().getLocation()) .end(); @@ -227,7 +238,10 @@ protected BlockModelBuilder getOrCreateConnectionElement() { */ @ApiStatus.OverrideOnly protected ItemModelBuilder getOrCreateItemModel() { - return createItemModel(this.blockId, this.minCoord, this.maxCoord); + if (this.itemModel != null) { + return this.itemModel; + } + return this.itemModel = createItemModel(this.blockId, this.minCoord, this.maxCoord); } /** @@ -271,11 +285,12 @@ protected ItemModelBuilder createItemModel(ResourceLocation name, float min, flo ItemModelBuilder model = this.provider.itemModels().getBuilder(name.toString()) .parent(this.getOrCreateCenterElement()); makePartModelElement(model, Direction.NORTH, false, faceEndpoints, 0.0f, 0, 1, - min, min, 0, max, max, 16, this.side, this.end, "side", "end"); + min, min, 0, max, max, 16, this.side, this.end, SIDE_KEY, END_KEY); makePartModelElement(model, Direction.NORTH, true, faceEndpoints, 0.001f, 0, 1, - min, min, 0, max, max, 16, this.sideSecondary, this.endSecondary, "side_secondary", "end_secondary"); + min, min, 0, max, max, 16, this.sideSecondary, this.endSecondary, SIDE_SECONDARY_KEY, + END_SECONDARY_KEY); makePartModelElement(model, Direction.NORTH, true, faceEndpoints, 0.002f, 2, 2, - min, min, 0, max, max, 16, this.sideOverlay, this.endOverlay, "side_overlay", "end_overlay"); + min, min, 0, max, max, 16, this.sideOverlay, this.endOverlay, SIDE_OVERLAY_KEY, END_OVERLAY_KEY); return model; } @@ -295,23 +310,12 @@ protected ItemModelBuilder createItemModel(ResourceLocation name, float min, flo protected BlockModelBuilder makeElementModel(ResourceLocation name, @Nullable Direction endFace, final float x1, final float y1, final float z1, final float x2, final float y2, final float z2) { - Reference2FloatMap faceEndpoints = new Reference2FloatOpenHashMap<>(); - faceEndpoints.defaultReturnValue(GTMath.max(x1, y1, z1, x2, y2, z2)); - for (Direction dir : GTUtil.DIRECTIONS) { - faceEndpoints.put(dir, switch (dir) { - case DOWN -> Math.min(y1, y2); - case UP -> Math.max(y1, y2); - case NORTH -> Math.min(z1, z2); - case SOUTH -> Math.max(z1, z2); - case WEST -> Math.min(x1, x2); - case EAST -> Math.max(x1, x2); - }); - } + Reference2FloatMap faceEndpoints = makeFaceEndpointMap(x1, y1, z1, x2, y2, z2); BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) .parent(new ModelFile.UncheckedModelFile("block/block")); makePartModelElement(model, endFace, false, faceEndpoints, 0.0f, 0, 1, - x1, y1, z1, x2, y2, z2, this.side, this.end, "side", "end"); + x1, y1, z1, x2, y2, z2, this.side, this.end, SIDE_KEY, END_KEY); makePartModelElement(model, endFace, true, faceEndpoints, 0.001f, 0, 1, x1, y1, z1, x2, y2, z2, this.sideSecondary, this.endSecondary, "side_secondary", "end_secondary"); makePartModelElement(model, endFace, true, faceEndpoints, 0.002f, 2, 2, @@ -328,11 +332,26 @@ protected > void makePartModelElement(T model, @Nullab @Nullable ResourceLocation sideTexture, @Nullable ResourceLocation endTexture, String sideKey, String endKey) { - if (sideTexture == null && endTexture == null) { + makePartModelElement(model, endFace, useEndWithFullCube, faceEndpoints, + offset, sideTintIndex, endTintIndex, x1, y1, z1, x2, y2, z2, + sideTexture, endTexture, sideKey, endKey, (face, texture, builder) -> {}); + } + + protected > void makePartModelElement(T model, @Nullable Direction endFace, + boolean useEndWithFullCube, + Reference2FloatMap faceEndpoints, + float offset, int sideTintIndex, int endTintIndex, + final float x1, final float y1, final float z1, + final float x2, final float y2, final float z2, + @Nullable ResourceLocation sideTexture, + @Nullable ResourceLocation endTexture, + String sideKey, String endKey, + FaceConfigurator faceConfigurator) { + if (sideTexture == null && (endFace == null || endTexture == null)) { return; } if (sideTexture != null) model.texture(sideKey, sideTexture); - if (endTexture != null) model.texture(endKey, endTexture); + if (endFace != null && endTexture != null) model.texture(endKey, endTexture); boolean fullCube = !useEndWithFullCube && (x1 == y1 && x1 == z1 && x1 <= 0.0f) && @@ -344,11 +363,13 @@ protected > void makePartModelElement(T model, @Nullab for (Direction dir : GTUtil.DIRECTIONS) { ModelBuilder.ElementBuilder.FaceBuilder face = null; - boolean isEnd = (endFace == dir || endFace == dir.getOpposite()) && !fullCube; + boolean isEnd = !fullCube && endFace != null && (endFace == dir || endFace == dir.getOpposite()); if (isEnd && endTexture != null) { face = element.face(dir).texture("#" + endKey).tintindex(endTintIndex); + faceConfigurator.accept(dir, endKey, face); } else if (!isEnd && sideTexture != null) { face = element.face(dir).texture("#" + sideKey).tintindex(sideTintIndex); + faceConfigurator.accept(dir, sideKey, face); } float faceEnd = faceEndpoints.getFloat(dir); @@ -358,6 +379,23 @@ protected > void makePartModelElement(T model, @Nullab } } + protected final Reference2FloatMap makeFaceEndpointMap(final float x1, final float y1, final float z1, + final float x2, final float y2, final float z2) { + Reference2FloatMap faceEndpoints = new Reference2FloatOpenHashMap<>(); + faceEndpoints.defaultReturnValue(GTMath.max(x1, y1, z1, x2, y2, z2)); + for (Direction dir : GTUtil.DIRECTIONS) { + faceEndpoints.put(dir, switch (dir) { + case DOWN -> Math.min(y1, y2); + case UP -> Math.max(y1, y2); + case NORTH -> Math.min(z1, z2); + case SOUTH -> Math.max(z1, z2); + case WEST -> Math.min(x1, x2); + case EAST -> Math.max(x1, x2); + }); + } + return faceEndpoints; + } + @Override public boolean equals(Object o) { if (!(o instanceof PipeModel pipeModel)) return false; @@ -374,4 +412,22 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(block, side, end, sideSecondary, endSecondary, sideOverlay, endOverlay); } + + @FunctionalInterface + public interface FaceConfigurator> { + + /** + * This is a callback for modifying a block element face builder in ways not supported by "basic" API.
+ * For example, you can make faces emissive, like {@link ActivablePipeModel#makePartModelElement}. + * + * @param face The normal direction of this face. + * @param texture The texture of the face, usually in {@code #reference} format. + * Note that the String does NOT begin with {@code #}. + * @param builder The face builder. + * @see ActivablePipeModel#makePartModelElement(ModelBuilder, Direction, boolean, Reference2FloatMap, float, + * int, int, float, float, float, float, float, float, ResourceLocation, ResourceLocation, String, String, + * boolean, boolean) ActivablePipeModel.makePartModelElement + */ + void accept(Direction face, String texture, ModelBuilder.ElementBuilder.FaceBuilder builder); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java index 917e3996be2..57ffd1f470c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java @@ -23,15 +23,14 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.Getter; -import lombok.Setter; import lombok.experimental.Accessors; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Range; import org.joml.Vector3f; import java.util.*; +import java.util.function.BiFunction; import static com.gregtechceu.gtceu.data.model.builder.MachineModelBuilder.configuredModelListToJSON; import static com.gregtechceu.gtceu.data.model.builder.MachineModelBuilder.configuredModelToJSON; @@ -40,23 +39,28 @@ @SuppressWarnings("UnusedReturnValue") public class PipeModelBuilder> extends CustomLoaderBuilder { - public static > PipeModelBuilder begin(T parent, - ExistingFileHelper existingFileHelper) { - return new PipeModelBuilder<>(parent, existingFileHelper); + // spotless:off + public static > BiFunction> begin(@Range(from = 0, to = 16) float thickness, + GTBlockstateProvider provider) { + return (parent, existingFileHelper) -> new PipeModelBuilder<>(parent, existingFileHelper, thickness, provider); } + // spotless:on @Accessors(fluent = false) @Getter - private final Map parts = new IdentityHashMap<>(); - @Setter - @Range(from = 0, to = 16) - private float thickness = Float.MIN_VALUE; - @Setter - private @NotNull GTBlockstateProvider provider; - private BlockModelBuilder[] restrictors = null; - - protected PipeModelBuilder(T parent, ExistingFileHelper existingFileHelper) { + private final Map<@Nullable Direction, ConfiguredModelList> parts = new IdentityHashMap<>(); + private final float thickness; + private final GTBlockstateProvider provider; + private BlockModelBuilder @Nullable [] restrictors = null; + + protected PipeModelBuilder(T parent, ExistingFileHelper existingFileHelper, + float thickness, GTBlockstateProvider provider) { super(PipeModelLoader.ID, parent, existingFileHelper); + + Preconditions.checkArgument(thickness > 0.0f && thickness <= 16.0f, + "Thickness must be between 0 (exclusive) and 16 (inclusive). It is %s", thickness); + this.thickness = thickness; + this.provider = provider; } /** @@ -289,12 +293,6 @@ public T end() { @Override public JsonObject toJson(JsonObject json) { - Preconditions.checkState(thickness != Float.MIN_VALUE, "A thickness value must be set!"); - Preconditions.checkState(thickness > 0.0f || thickness <= 16.0f, - "Thickness must be between 0 (exclusive) and 16 (inclusive). is %s", thickness); - // noinspection ConstantValue - Preconditions.checkState(provider != null, "You must pass in a GTBlockStateProvider!"); - json = super.toJson(json); if (!getParts().isEmpty()) { @@ -368,7 +366,7 @@ private static BlockModelBuilder[] getOrCreateRestrictorModels(BlockModelProvide return RESTRICTOR_MODEL_CACHE.apply(provider, thickness); } - private static final MemoizedBiFunction RESTRICTOR_MODEL_CACHE = GTMemoizer + private static final MemoizedBiFunction RESTRICTOR_MODEL_CACHE = GTMemoizer .memoizeFunctionWeakIdent(PipeModelBuilder::makeRestrictorModels); private static BlockModelBuilder[] makeRestrictorModels(BlockModelProvider provider, float thickness) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/model/builder/package-info.java b/src/main/java/com/gregtechceu/gtceu/data/model/builder/package-info.java new file mode 100644 index 00000000000..2f6102b3cd1 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/model/builder/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.data.model.builder; + +import org.jetbrains.annotations.NotNullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeExistingFileHelper.java b/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeExistingFileHelper.java index e6e7c50d4c4..f2d04d3629d 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeExistingFileHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/data/RuntimeExistingFileHelper.java @@ -12,7 +12,7 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.FileNotFoundException; import java.util.Collections; @@ -23,25 +23,41 @@ /** * Existing file helper that wraps the client/server resource manager instead of creating its own.
* Useful for using data generators outside datagen. + *

+ * By default, this class assumes all resources exist and does not check any references' validity. + * To enable actual checking, you may use a try-with-resources statement like this: + * + *

{@code
+ * try (var helper = RuntimeExistingFileHelper.INSTANCE.activeHelper()) {
+ *     // If you don't use a try-with-resources or try-finally block to
+ *     // enable checking, calling `exists` will always return true.
+ *     if (helper.exists(texture, GTBlockstateProvider.TEXTURE)) {
+ *         // do stuff
+ *     }
+ * }
+ * }
+ * */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class RuntimeExistingFileHelper extends ExistingFileHelper { - public static final RuntimeExistingFileHelper INSTANCE = new RuntimeExistingFileHelper(); + public static final RuntimeExistingFileHelper INSTANCE = new RuntimeExistingFileHelper(HashMultimap.create()); - protected final Multimap generated = HashMultimap.create(); + protected final Multimap generated; + protected @Nullable Active activeHelper; - protected RuntimeExistingFileHelper() { + protected RuntimeExistingFileHelper(Multimap generated) { super(Collections.emptySet(), Collections.emptySet(), false, null, null); + this.generated = generated; } - public static @NotNull ResourceManager getManager(PackType packType) { + public static ResourceManager getManager(PackType packType) { if (packType == PackType.CLIENT_RESOURCES) { return Minecraft.getInstance().getResourceManager(); } else if (packType == PackType.SERVER_DATA) { if (GTCEu.getMinecraftServer() == null) { - throw new IllegalStateException("Cannot get server resources without a server or on a remote client."); + throw new IllegalStateException("Cannot get server resources without a server / on a remote client."); } return GTCEu.getMinecraftServer().getResourceManager(); } else { @@ -53,11 +69,26 @@ protected ResourceLocation getLocation(ResourceLocation base, String prefix, Str return base.withPath(path -> prefix + "/" + path + suffix); } + public RuntimeExistingFileHelper.Active activeHelper() { + if (this.activeHelper == null) { + // pass the same generated resources map into the subclass + // so any resources added/checked by it are automatically updated here + this.activeHelper = new Active(this.generated); + } + return this.activeHelper; + } + + /** + * Bypass the normal {@code exists} function so missing/invalid references etc. don't cause runtime errors.
+ * A toggle for enabling proper functionality is implemented in the form of {@link #activeHelper()}- + */ @Override public boolean exists(ResourceLocation loc, PackType packType) { - return generated.get(packType).contains(loc) || getManager(packType).getResource(loc).isPresent(); + return true; } + /// Implement a copy of the normal {@code exists} function that we can use for checking + @Override public void trackGenerated(ResourceLocation loc, IResourceType type) { trackGenerated(loc, type.getPackType(), type.getSuffix(), type.getPrefix()); @@ -83,4 +114,31 @@ public Resource getResource(ResourceLocation loc, PackType packType) throws File public List getResourceStack(ResourceLocation loc, PackType packType) { return getManager(packType).getResourceStack(loc); } + + /** + * This class implements {@link AutoCloseable} for ease of enabling actual checking when it is required. + *

+ * Note that it's safe to ignore "unclosed AutoCloseable"/{@code resource} warnings on this class, as is done in + * {@linkplain com.gregtechceu.gtceu.client.model.machine.overlays.WorkableOverlays#get WorkableOverlays#get}. + *

+ */ + public static class Active extends RuntimeExistingFileHelper implements AutoCloseable { + + protected Active(Multimap parentGenerated) { + super(parentGenerated); + } + + @Override + public Active activeHelper() { + return this; + } + + @Override + public boolean exists(ResourceLocation loc, PackType packType) { + return this.generated.get(packType).contains(loc) || getManager(packType).getResource(loc).isPresent(); + } + + @Override + public void close() {} + } } From 7075fc094090facb5488bcefeba1b4718312e197 Mon Sep 17 00:00:00 2001 From: Mqrius Date: Tue, 3 Feb 2026 07:44:47 +0100 Subject: [PATCH 15/78] Fix bug in NBTPredicateIngredient serializer (#4536) --- .../gtceu/api/recipe/ingredient/NBTPredicateIngredient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTPredicateIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTPredicateIngredient.java index 2fde075f7b6..b0cd45576d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTPredicateIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTPredicateIngredient.java @@ -96,7 +96,7 @@ public static class Serializer implements IIngredientSerializer Date: Tue, 3 Feb 2026 15:08:17 +0800 Subject: [PATCH 16/78] Fix dust disassembly recipes (#4456) --- .../gtceu/api/recipe/StrictShapedRecipe.java | 17 +++++- .../data/recipe/VanillaRecipeHelper.java | 61 +++++++++++++++---- .../recipe/builder/ShapedRecipeBuilder.java | 9 +++ .../generated/MaterialRecipeHandler.java | 10 ++- 4 files changed, 80 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java index 529e54e4fce..e8501709ab2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.Level; import com.google.gson.JsonObject; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -28,13 +29,18 @@ public class StrictShapedRecipe extends ShapedRecipe { public static final RecipeSerializer SERIALIZER = new Serializer(); + @Getter + private final boolean matchSize; + public StrictShapedRecipe(ResourceLocation id, String group, CraftingBookCategory category, int width, int height, - NonNullList recipeItems, ItemStack result) { + NonNullList recipeItems, ItemStack result, boolean matchSize) { super(id, group, category, width, height, recipeItems, result); + this.matchSize = matchSize; } @Override public boolean matches(CraftingContainer inv, Level level) { + if (matchSize && (inv.getWidth() != this.getWidth() || inv.getHeight() != this.getHeight())) return false; for (int i = 0; i <= inv.getWidth() - this.getWidth(); ++i) { for (int j = 0; j <= inv.getHeight() - this.getHeight(); ++j) { if (this.matches(inv, i, j)) { @@ -82,7 +88,9 @@ public StrictShapedRecipe fromJson(ResourceLocation recipeId, JsonObject json) { int j = strings.length; NonNullList nonNullList = ShapedRecipeAccessor.callDissolvePattern(strings, map, i, j); ItemStack itemStack = StrictShapedRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(json, "result")); - return new StrictShapedRecipe(recipeId, string, craftingBookCategory, i, j, nonNullList, itemStack); + boolean matchSize = json.get("matchSize").getAsBoolean(); + return new StrictShapedRecipe(recipeId, string, craftingBookCategory, i, j, nonNullList, itemStack, + matchSize); } @Override @@ -94,7 +102,9 @@ public StrictShapedRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf NonNullList nonNullList = NonNullList.withSize(i * j, Ingredient.EMPTY); nonNullList.replaceAll(ignored -> Ingredient.fromNetwork(buffer)); ItemStack itemStack = buffer.readItem(); - return new StrictShapedRecipe(recipeId, string, craftingBookCategory, i, j, nonNullList, itemStack); + boolean matchSize = buffer.readBoolean(); + return new StrictShapedRecipe(recipeId, string, craftingBookCategory, i, j, nonNullList, itemStack, + matchSize); } @Override @@ -107,6 +117,7 @@ public void toNetwork(FriendlyByteBuf buffer, StrictShapedRecipe recipe) { ingredient.toNetwork(buffer); } buffer.writeItem(((ShapedRecipeAccessor) recipe).getResult()); + buffer.writeBoolean(recipe.matchSize); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java index ee3b7ff2257..1cfd3ddac9f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java @@ -224,7 +224,7 @@ public static void addShapedNBTClearingRecipe(Consumer provider, } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addShapedRecipe(Consumer provider, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { @@ -232,7 +232,7 @@ public static void addShapedRecipe(Consumer provider, @NotNull S } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { @@ -240,7 +240,7 @@ public static void addShapedRecipe(Consumer provider, @NotNull R } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addStrictShapedRecipe(Consumer provider, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { @@ -248,7 +248,7 @@ public static void addStrictShapedRecipe(Consumer provider, @Not } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addStrictShapedRecipe(Consumer provider, boolean setMaterialInfoData, @NotNull String regName, @@ -257,13 +257,38 @@ public static void addStrictShapedRecipe(Consumer provider, bool } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addStrictShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { addStrictShapedRecipe(provider, false, regName, result, recipe); } + /** + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) + */ + public static void addStrictSizeShapedRecipe(Consumer provider, @NotNull String regName, + @NotNull ItemStack result, @NotNull Object... recipe) { + addStrictSizeShapedRecipe(provider, GTCEu.id(regName), result, recipe); + } + + /** + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) + */ + public static void addStrictSizeShapedRecipe(Consumer provider, boolean setMaterialInfoData, + @NotNull String regName, + @NotNull ItemStack result, @NotNull Object... recipe) { + addStrictSizeShapedRecipe(provider, setMaterialInfoData, GTCEu.id(regName), result, recipe); + } + + /** + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) + */ + public static void addStrictSizeShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, + @NotNull ItemStack result, @NotNull Object... recipe) { + addStrictSizeShapedRecipe(provider, false, regName, result, recipe); + } + /** * Adds Shaped Crafting Recipes. *

@@ -284,17 +309,20 @@ public static void addStrictShapedRecipe(Consumer provider, @Not *

  • {@code 'w'} - {@code craftingToolWrench}
  • *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • * - * + * * @param setMaterialInfoData whether to add material decomposition information to the recipe output + * + * @param matchSize * @param regName the registry name for the recipe * @param result the output for the recipe * @param recipe the contents of the recipe */ public static void addShapedRecipe(Consumer provider, boolean setMaterialInfoData, boolean isStrict, - @NotNull ResourceLocation regName, @NotNull ItemStack result, + boolean matchSize, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { var builder = new ShapedRecipeBuilder(regName).output(result); builder.isStrict(isStrict); + builder.matchSize(matchSize); final CharSet tools = ToolHelper.getToolSymbols(); CharSet foundTools = new CharArraySet(9); for (int i = 0; i < recipe.length; i++) { @@ -354,7 +382,7 @@ public static void addShapedRecipe(Consumer provider, boolean se } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addShapedRecipe(Consumer provider, boolean setMaterialInfoData, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { @@ -362,21 +390,30 @@ public static void addShapedRecipe(Consumer provider, boolean se } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addShapedRecipe(Consumer provider, boolean setMaterialInfoData, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { - addShapedRecipe(provider, setMaterialInfoData, false, regName, result, recipe); + addShapedRecipe(provider, setMaterialInfoData, false, false, regName, result, recipe); } /** - * @see #addShapedRecipe(Consumer, boolean, boolean, ResourceLocation, ItemStack, Object...) + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) */ public static void addStrictShapedRecipe(Consumer provider, boolean setMaterialInfoData, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { - addShapedRecipe(provider, setMaterialInfoData, true, regName, result, recipe); + addShapedRecipe(provider, setMaterialInfoData, true, false, regName, result, recipe); + } + + /** + * @see #addShapedRecipe(Consumer, boolean, boolean, boolean, ResourceLocation, ItemStack, Object...) + */ + public static void addStrictSizeShapedRecipe(Consumer provider, boolean setMaterialInfoData, + @NotNull ResourceLocation regName, @NotNull ItemStack result, + @NotNull Object... recipe) { + addShapedRecipe(provider, setMaterialInfoData, true, true, regName, result, recipe); } public static void addShapelessRecipe(Consumer provider, @NotNull String regName, diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java index 26d6f675325..b871319e325 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java @@ -30,6 +30,7 @@ public class ShapedRecipeBuilder extends Builder provider, ItemStack smallDustStack = ChemicalHelper.get(dustSmall, material); ItemStack dustStack = ChemicalHelper.get(dust, material); - VanillaRecipeHelper.addStrictShapedRecipe(provider, + VanillaRecipeHelper.addStrictSizeShapedRecipe(provider, String.format("small_dust_disassembling_%s", material.getName()), smallDustStack.copyWithCount(4), " X", " ", 'X', new MaterialEntry(dust, material)); + VanillaRecipeHelper.addStrictSizeShapedRecipe(provider, + String.format("small_dust_disassembling_3x3_%s", material.getName()), + smallDustStack.copyWithCount(4), " X ", " ", " ", 'X', new MaterialEntry(dust, material)); VanillaRecipeHelper.addShapedRecipe(provider, String.format("small_dust_assembling_%s", material.getName()), dustStack, "XX", "XX", 'X', new MaterialEntry(dustSmall, material)); @@ -282,9 +285,12 @@ private static void processTinyDust(@NotNull Consumer provider, ItemStack tinyDustStack = ChemicalHelper.get(dustTiny, material); ItemStack dustStack = ChemicalHelper.get(dust, material); - VanillaRecipeHelper.addStrictShapedRecipe(provider, + VanillaRecipeHelper.addStrictSizeShapedRecipe(provider, String.format("tiny_dust_disassembling_%s", material.getName()), tinyDustStack.copyWithCount(9), "X ", " ", 'X', new MaterialEntry(dust, material)); + VanillaRecipeHelper.addStrictSizeShapedRecipe(provider, + String.format("tiny_dust_disassembling_3x3_%s", material.getName()), + tinyDustStack.copyWithCount(9), "X ", " ", " ", 'X', new MaterialEntry(dust, material)); VanillaRecipeHelper.addShapedRecipe(provider, String.format("tiny_dust_assembling_%s", material.getName()), dustStack, "XXX", "XXX", "XXX", 'X', new MaterialEntry(dustTiny, material)); From 33a95021ee4996c5b14f14eeb5d48f4c4c1b328f Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Tue, 3 Feb 2026 10:37:41 +0100 Subject: [PATCH 17/78] Re-run ranged input tests multiple times (#4538) --- .../IntProviderFluidIngredientTest.java | 24 ++++++++++++++----- .../ingredient/IntProviderIngredientTest.java | 24 ++++++++++++++----- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index 36a06165618..8e40cfbf616 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -596,7 +596,9 @@ public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -668,7 +670,9 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -742,7 +746,9 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -814,7 +820,9 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -888,7 +896,9 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 500) + timeoutTicks = 500, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -965,7 +975,9 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 500) + timeoutTicks = 500, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 51120392ffb..520ff1bbb76 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -585,7 +585,9 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -655,7 +657,9 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -729,7 +733,9 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -799,7 +805,9 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200) + timeoutTicks = 200, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -873,7 +881,9 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 500) + timeoutTicks = 500, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -955,7 +965,9 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 500) + timeoutTicks = 500, + requiredSuccesses = 1, + attempts = 10) public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); From b02c901ae92347249f634e6d6c6d1eeba0f2fb83 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:42:35 +0200 Subject: [PATCH 18/78] Fix pipes missing break particle textures (#4533) --- .../assets/gtceu/models/block/pipe/huge_duct_pipe/center.json | 1 + .../gtceu/models/block/pipe/huge_duct_pipe/connection.json | 1 + .../assets/gtceu/models/block/pipe/large_duct_pipe/center.json | 1 + .../gtceu/models/block/pipe/large_duct_pipe/connection.json | 1 + .../gtceu/models/block/pipe/normal_duct_pipe/center.json | 1 + .../gtceu/models/block/pipe/normal_duct_pipe/connection.json | 1 + .../gtceu/models/block/pipe/normal_laser_pipe/center.json | 1 + .../models/block/pipe/normal_laser_pipe/center_active.json | 1 + .../gtceu/models/block/pipe/normal_laser_pipe/connection.json | 1 + .../models/block/pipe/normal_laser_pipe/connection_active.json | 1 + .../gtceu/models/block/pipe/normal_optical_pipe/center.json | 1 + .../models/block/pipe/normal_optical_pipe/center_active.json | 1 + .../models/block/pipe/normal_optical_pipe/connection.json | 1 + .../block/pipe/normal_optical_pipe/connection_active.json | 1 + .../assets/gtceu/models/block/pipe/small_duct_pipe/center.json | 1 + .../gtceu/models/block/pipe/small_duct_pipe/connection.json | 1 + .../gtceu/client/model/pipe/ActivablePipeModel.java | 3 ++- .../com/gregtechceu/gtceu/client/model/pipe/PipeModel.java | 3 ++- 18 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json index 1916aa7d966..02a16c80e83 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json @@ -41,6 +41,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json index b5f34317735..2226641a443 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json @@ -43,6 +43,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_duct_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json index 39b3a894eac..a55cb442878 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json @@ -41,6 +41,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json index e5504c54c2b..99be7317456 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json @@ -43,6 +43,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_duct_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json index 1c7b6fe9ce9..2d0b6ace2aa 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json @@ -41,6 +41,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json index c004f0de717..0204502f18f 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json @@ -43,6 +43,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_duct_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json index 9de7a83201f..d42a077b7d3 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json @@ -79,6 +79,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json index 088aa774a9f..4415d9932a9 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json @@ -109,6 +109,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay_emissive" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json index 7dc25d11fdd..ca2bd68f7d2 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json @@ -73,6 +73,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_laser_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json index 83cb7127326..a589a8af80f 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json @@ -93,6 +93,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_laser_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_laser_side", "side_overlay": "gtceu:block/pipe/pipe_laser_side_overlay_emissive" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json index 1c46b15f85c..7ce8bf8c21a 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json @@ -79,6 +79,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json index 3a643f6dcc4..552b717cf3e 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json @@ -109,6 +109,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay_active" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json index b7ee34bd7f4..4c0b091c60a 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json @@ -73,6 +73,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_optical_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json index 962efa95cf6..ec0d096c1a0 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json @@ -93,6 +93,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_optical_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_optical_side", "side_overlay": "gtceu:block/pipe/pipe_optical_side_overlay_active" } diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json index cf2698d2453..73b8cd699db 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json @@ -41,6 +41,7 @@ } ], "textures": { + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json index 569180a1fba..c6d3c85d4b0 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json @@ -43,6 +43,7 @@ ], "textures": { "end": "gtceu:block/pipe/pipe_duct_in", + "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" } } \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java index 4213be34926..74da42c293b 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java @@ -139,7 +139,8 @@ protected BlockModelBuilder makeActiveElementModel(ResourceLocation name, @Nulla Reference2FloatMap faceEndpoints = makeFaceEndpointMap(x1, y1, z1, x2, y2, z2); BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) - .parent(new ModelFile.UncheckedModelFile("block/block")); + .parent(new ModelFile.UncheckedModelFile("block/block")) + .texture("particle", "#" + (this.side != null ? SIDE_KEY : END_KEY)); ResourceLocation side = this.sideActive != null ? this.sideActive : this.side; ResourceLocation end = this.endActive != null ? this.endActive : this.end; diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java index 3fa772c5756..68cbe9f0e22 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java @@ -313,7 +313,8 @@ protected BlockModelBuilder makeElementModel(ResourceLocation name, @Nullable Di Reference2FloatMap faceEndpoints = makeFaceEndpointMap(x1, y1, z1, x2, y2, z2); BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) - .parent(new ModelFile.UncheckedModelFile("block/block")); + .parent(new ModelFile.UncheckedModelFile("block/block")) + .texture("particle", "#" + (this.side != null ? SIDE_KEY : END_KEY)); makePartModelElement(model, endFace, false, faceEndpoints, 0.0f, 0, 1, x1, y1, z1, x2, y2, z2, this.side, this.end, SIDE_KEY, END_KEY); makePartModelElement(model, endFace, true, faceEndpoints, 0.001f, 0, 1, From 2fbef83df2b2444ce317ae4bbaa96dc2333cc5cf Mon Sep 17 00:00:00 2001 From: "Nikola J." <72603953+GirixK@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:33:58 +0100 Subject: [PATCH 19/78] Remove muffler hatch requirement from Large Distillery (#4195) Co-authored-by: GirixK Co-authored-by: Jurre Groenendijk --- docs/content/Modpacks/Changes/v7.5.0.md | 5 ++++- .../gregtechceu/gtceu/common/data/machines/GCYMMachines.java | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index efe36c8eadb..f7adb890ff2 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -10,6 +10,9 @@ We have added a second Generic argument to our (Multiblock)MachineBuilder. This ## Machine & Cover Copy/Paste System A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers. +## Multiblock Structure Change +The Large Fractionating Still no longer requires a muffler hatch, allowing it to be used in cleanrooms. + ## RecipeCondition Generics We have added a Generic argument to `RecipeCondition` describing the condition. This means that your custom recipe conditions now need to extend `RecipeCondition` (whereas before they just extended `RecipeCondition`). @@ -71,4 +74,4 @@ you should **NOT** use `PipeModel#dynamicModel()` and instead set the model with ## Lamp Predicates Previously, lamps were not useable with the terminal in multiblocks. There are new lamp predicates that will help solve this problem. The predicate to use all lamps is: `Predicates.anyLamp()` -The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. +The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java index e793954c8f5..4fffdc064a9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java @@ -636,7 +636,7 @@ public static void init() {} .aisle("#YYY#", "YYYYY", "YYYYY", "YYYYY", "#YYY#") .aisle("#YSY#", "YAAAY", "YAAAY", "YAAAY", "#YYY#") .aisle("##X##", "#XAX#", "XAPAX", "#XAX#", "##X##").setRepeatable(1, 12) - .aisle("#####", "#ZZZ#", "#ZCZ#", "#ZZZ#", "#####") + .aisle("#####", "#ZZZ#", "#ZZZ#", "#ZZZ#", "#####") .where('S', controller(blocks(definition.get()))) .where('Y', casingPredicate.or(abilities(IMPORT_ITEMS)) .or(abilities(INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2)) @@ -646,7 +646,6 @@ public static void init() {} .where('X', casingPredicate.or(exportPredicate)) .where('Z', casingPredicate) .where('P', blocks(CASING_STEEL_PIPE.get())) - .where('C', abilities(MUFFLER)) .where('A', air()) .where('#', any()) .build(); From aaea1cc630e6bb27665d0514351b2dc31ba1d94d Mon Sep 17 00:00:00 2001 From: zetrock1 <144679746+zetrock1@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:32:09 +0000 Subject: [PATCH 20/78] Trinium spring (#4470) --- .../gtceu/common/data/materials/ElementMaterials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java index d006d0cd977..62409787155 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java @@ -1026,7 +1026,7 @@ public static void register() { Trinium = new Material.Builder(GTCEu.id("trinium")) .ingot(7).fluid() .color(0x81808a).secondaryColor(0x351d4b).iconSet(SHINY) - .flags(GENERATE_FOIL, GENERATE_BOLT_SCREW, GENERATE_GEAR) + .flags(GENERATE_FOIL, GENERATE_BOLT_SCREW, GENERATE_GEAR, GENERATE_SPRING) .element(GTElements.Ke) .cableProperties(V[ZPM], 6, 4) .blast(b -> b.temp(7200, GasTier.HIGH) From 1cbd9d60da3cc2a6f50e0f35a7aa9c59aee8f0a9 Mon Sep 17 00:00:00 2001 From: Pyritie Date: Wed, 4 Feb 2026 09:33:16 +0000 Subject: [PATCH 21/78] Remove apatite bolt and screw, remove rubber bolt, screw, and gears (#4495) --- .../gtceu/common/data/materials/OrganicChemistryMaterials.java | 2 +- .../gtceu/common/data/materials/SecondDegreeMaterials.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java index 545e3030f6e..b581ac7cf73 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java @@ -509,7 +509,7 @@ public static void register() { .color(0x353529).secondaryColor(0x080808) .toolStats( ToolProperty.Builder.of(1.0F, 1.0F, 256, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) - .flags(GENERATE_GEAR, GENERATE_RING, GENERATE_FOIL, GENERATE_BOLT_SCREW) + .flags(GENERATE_RING, GENERATE_FOIL) .components(Carbon, 5, Hydrogen, 8) .buildAndRegister(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java index 0bd7ea7c667..4ece776f76b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java @@ -107,7 +107,7 @@ public static void register() { Apatite = new Material.Builder(GTCEu.id("apatite")) .gem(1).ore(4, 2) .color(0x06cdf1).secondaryColor(0x701c07).iconSet(DIAMOND) - .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_BOLT_SCREW, DISABLE_DECOMPOSITION) + .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, DISABLE_DECOMPOSITION) .components(Calcium, 5, Phosphate, 3, Chlorine, 1) .buildAndRegister(); From 2f3a6a1bcb2ab9bc0094999a1cd20009582086b6 Mon Sep 17 00:00:00 2001 From: Pyritie Date: Wed, 4 Feb 2026 09:40:08 +0000 Subject: [PATCH 22/78] Give three alloy smelter glass recipes the right category (#4497) --- .../com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java | 2 ++ .../gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java | 1 + .../gtceu/data/recipe/misc/VanillaStandardRecipes.java | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java index ea1ca537eff..36f3b7e7a2e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.MarkerMaterials.Color; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialEntry; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; +import com.gregtechceu.gtceu.common.data.GTRecipeCategories; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; @@ -338,6 +339,7 @@ private static void componentRecipes(Consumer provider) { .inputItems(dust, Glass) .notConsumable(SHAPE_MOLD_BALL) .outputItems(GLASS_TUBE) + .category(GTRecipeCategories.INGOT_MOLDING) .duration(160).EUt(16).save(provider); FLUID_SOLIDFICATION_RECIPES.recipeBuilder("solidify_glass_tube") diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index df745a5e92b..38914de3715 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -401,6 +401,7 @@ public static void init(Consumer provider) { .inputItems(dust, Glass, 2) .notConsumable(SHAPE_MOLD_PLATE) .outputItems(plate, Glass) + .category(GTRecipeCategories.INGOT_MOLDING) .duration(40).EUt(6).save(provider); // Dyed Lens Recipes diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index 7543739d90e..7d996a54f0b 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -225,6 +225,7 @@ private static void glassRecipes(Consumer provider) { .inputItems(dust, Glass) .notConsumable(SHAPE_MOLD_BOTTLE) .outputItems(new ItemStack(Items.GLASS_BOTTLE)) + .category(GTRecipeCategories.INGOT_MOLDING) .addMaterialInfo(true) .save(provider); @@ -250,6 +251,7 @@ private static void glassRecipes(Consumer provider) { .inputItems(dust, Glass) .notConsumable(SHAPE_MOLD_BLOCK) .outputItems(new ItemStack(Blocks.GLASS, 1)) + .category(GTRecipeCategories.INGOT_MOLDING) .save(provider); CUTTER_RECIPES.recipeBuilder("cut_glass_block_to_plate").duration(50).EUt(VA[ULV]) From 2c5fe8ab5d7f14467ecc58419e86d6666125cd26 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Wed, 4 Feb 2026 23:58:24 +0200 Subject: [PATCH 23/78] Simplify material block models and fix issues they had with shaders (#4532) Co-authored-by: Ghostipedia / Caitlynn <46772882+Ghostipedia@users.noreply.github.com> --- .../material/info/MaterialIconType.java | 1 + .../gtceu/api/data/tag/TagPrefix.java | 12 ++ .../renderer/block/MaterialBlockRenderer.java | 8 +- .../renderer/block/OreBlockRenderer.java | 115 ++++++++++++------ .../gtceu/config/ConfigHolder.java | 7 +- .../mixins/client/LevelRendererMixin.java | 55 ++------- .../data/pack/GTDynamicResourcePack.java | 4 +- .../block/material_sets/diamond/ore.json | 51 ++++++++ .../material_sets/diamond/ore_emissive.json | 53 ++++++++ .../block/material_sets/dull/block.json | 28 ++++- .../block/material_sets/dull/frame_gt.json | 28 ++++- .../models/block/material_sets/dull/ore.json | 51 ++++++++ .../material_sets/dull/ore_emissive.json | 53 ++++++++ .../block/material_sets/emerald/block.json | 28 ++++- .../block/material_sets/fine/block.json | 28 ++++- .../models/block/material_sets/fine/ore.json | 51 ++++++++ .../material_sets/fine/ore_emissive.json | 53 ++++++++ .../models/block/material_sets/flint/ore.json | 51 ++++++++ .../material_sets/flint/ore_emissive.json | 53 ++++++++ .../block/material_sets/lapis/block.json | 28 ++++- .../models/block/material_sets/lapis/ore.json | 51 ++++++++ .../material_sets/lapis/ore_emissive.json | 53 ++++++++ .../block/material_sets/lignite/block.json | 28 ++++- .../block/material_sets/lignite/ore.json | 51 ++++++++ .../material_sets/lignite/ore_emissive.json | 53 ++++++++ .../block/material_sets/netherstar/block.json | 28 ++++- .../block/material_sets/opal/block.json | 28 ++++- .../models/block/material_sets/paper/ore.json | 51 ++++++++ .../material_sets/paper/ore_emissive.json | 53 ++++++++ .../block/material_sets/powder/ore.json | 51 ++++++++ .../material_sets/powder/ore_emissive.json | 53 ++++++++ .../block/material_sets/quartz/block.json | 28 ++++- .../block/material_sets/quartz/ore.json | 51 ++++++++ .../material_sets/quartz/ore_emissive.json | 53 ++++++++ .../material_sets/radioactive/block.json | 24 +++- .../material_sets/radioactive/frame_gt.json | 24 +++- .../block/material_sets/rough/block.json | 28 ++++- .../models/block/material_sets/rough/ore.json | 51 ++++++++ .../material_sets/rough/ore_emissive.json | 53 ++++++++ .../block/material_sets/sand/block.json | 28 ++++- .../block/material_sets/shiny/block.json | 28 ++++- .../block/material_sets/wood/block.json | 28 ++++- .../block/material_sets/paper/foil.png | Bin 588 -> 0 bytes .../paper/{wire.png => wire_side.png} | Bin 44 files changed, 1505 insertions(+), 149 deletions(-) create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/dull/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/dull/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/fine/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/fine/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/flint/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/flint/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/paper/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/paper/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/powder/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/powder/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore_emissive.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/rough/ore.json create mode 100644 src/main/resources/assets/gtceu/models/block/material_sets/rough/ore_emissive.json delete mode 100644 src/main/resources/assets/gtceu/textures/block/material_sets/paper/foil.png rename src/main/resources/assets/gtceu/textures/block/material_sets/paper/{wire.png => wire_side.png} (100%) diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java index c96add6eaf3..52d57bac337 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java @@ -97,6 +97,7 @@ public record MaterialIconType(String name) { public static final MaterialIconType molten = new MaterialIconType("molten"); public static final MaterialIconType block = new MaterialIconType("block"); public static final MaterialIconType ore = new MaterialIconType("ore"); + public static final MaterialIconType oreEmissive = new MaterialIconType("oreEmissive"); public static final MaterialIconType oreSmall = new MaterialIconType("oreSmall"); public static final MaterialIconType frameGt = new MaterialIconType("frameGt"); public static final MaterialIconType wire = new MaterialIconType("wire"); 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 777131be6e6..a518f4a4493 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 @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; import com.gregtechceu.gtceu.api.item.MaterialBlockItem; @@ -1232,6 +1233,17 @@ public boolean doGenerateBlock(Material material) { hasItemTable() && this.itemTable.get() != null && getItemFromTable(material) != null; } + public MaterialIconType getMaterialIconType(Material material) { + // special case emissive ores + if (materialIconType == MaterialIconType.ore && material.hasProperty(PropertyKey.ORE)) { + OreProperty oreProp = material.getProperty(PropertyKey.ORE); + if (oreProp.isEmissive()) { + return MaterialIconType.oreEmissive; + } + } + return materialIconType; + } + public String getLowerCaseName() { return FormattingUtil.toLowerCaseUnderscore(this.name); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java index 193c889179f..f6559abfce2 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java @@ -15,7 +15,6 @@ public class MaterialBlockRenderer { - public static final String LAYER_2_SUFFIX = "_layer2"; private static final Set MODELS = new HashSet<>(); public static void create(Block block, MaterialIconType type, MaterialIconSet iconSet) { @@ -25,12 +24,11 @@ public static void create(Block block, MaterialIconType type, MaterialIconSet ic public static void reinitModels() { for (MaterialBlockRenderer model : MODELS) { ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(model.block); - ResourceLocation modelId = blockId.withPrefix("block/"); - GTDynamicResourcePack.addBlockModel(blockId, - new DelegatedModel(model.type.getBlockModelPath(model.iconSet, true))); + ResourceLocation modelId = model.type.getBlockModelPath(model.iconSet, true); + GTDynamicResourcePack.addBlockState(blockId, BlockModelGenerators.createSimpleBlock(model.block, modelId)); GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.block.asItem()), - new DelegatedModel(ModelLocationUtils.getModelLocation(model.block))); + new DelegatedModel(modelId)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java index fbd6bff6240..8453f93fbce 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java @@ -3,10 +3,12 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.MaterialBlock; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; +import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; +import com.gregtechceu.gtceu.utils.memoization.GTMemoizer; +import com.gregtechceu.gtceu.utils.memoization.function.MemoizedBiFunction; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.Minecraft; @@ -14,22 +16,32 @@ import net.minecraft.data.models.BlockModelGenerators; import net.minecraft.data.models.model.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.GsonHelper; -import com.google.common.base.Preconditions; import com.google.gson.JsonObject; +import org.jetbrains.annotations.ApiStatus; import java.io.BufferedReader; import java.io.IOException; import java.util.HashSet; +import java.util.Optional; import java.util.Set; @MethodsReturnNonnullByDefault public class OreBlockRenderer { - private static final Set MODELS = new HashSet<>(); + protected static final Set MODELS = new HashSet<>(); - private final MaterialBlock block; + protected static final JsonObject NULL_ELEMENT_MARKER = new JsonObject(); + protected static final MemoizedBiFunction TEMPLATE_MODEL_CACHE = GTMemoizer + .memoizeFunctionWeakIdent(OreBlockRenderer::loadTemplateOreModel); + + // First format key is material set name, 2nd is stone type prefix's name, 3rd is icon type's name + public static final String ORE_MODEL_NAME_FORMAT = "block/material_sets/%s/ores/%s/%s"; + + protected final MaterialBlock block; public static void create(MaterialBlock block) { MODELS.add(new OreBlockRenderer(block)); @@ -39,56 +51,81 @@ public OreBlockRenderer(MaterialBlock block) { this.block = block; } + @ApiStatus.Internal public static void reinitModels() { + // first set up all the stone types for all tag prefixes + for (MaterialIconSet iconSet : MaterialIconSet.ICON_SETS.values()) { + for (var entry : TagPrefix.ORES.entrySet()) { + copyOreModelWithBaseStone(entry.getKey(), entry.getValue(), MaterialIconType.ore, iconSet); + copyOreModelWithBaseStone(entry.getKey(), entry.getValue(), MaterialIconType.oreEmissive, iconSet); + // TODO uncomment if/when small ores are added + // copyOreModelWithBaseStone(entry.getKey(), entry.getValue(), MaterialIconType.oreSmall, iconSet); + } + } + + // then create block state JSONs for all ore blocks with those models for (OreBlockRenderer model : MODELS) { + Material material = model.block.material; + TagPrefix tagPrefix = model.block.tagPrefix; + MaterialIconSet iconSet = material.getMaterialIconSet(); + MaterialIconType iconType = tagPrefix.getMaterialIconType(material); + ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(model.block); - ResourceLocation modelId = blockId.withPrefix("block/"); - OreBlockRenderer.cloneBlockModel(blockId, model.block.tagPrefix, model.block.material); + ResourceLocation modelId = GTCEu.id(ORE_MODEL_NAME_FORMAT + .formatted(iconSet.name, tagPrefix.name, iconType.name())); + GTDynamicResourcePack.addBlockState(blockId, BlockModelGenerators.createSimpleBlock(model.block, modelId)); GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.block.asItem()), - new DelegatedModel(ModelLocationUtils.getModelLocation(model.block))); + new DelegatedModel(modelId)); } - } - /** - * Clones & modifies the base JSON for a single ore block. - * - * @param modelId the model id (usually {@code gtceu:block/}) - * @param prefix the TagPrefix of the block being added. - * @param material the material of the block being added. must have an ore property. - */ - public static void cloneBlockModel(ResourceLocation modelId, TagPrefix prefix, Material material) { - OreProperty prop = material.getProperty(PropertyKey.ORE); - Preconditions.checkNotNull(prop, - "material %s has no ore property, but needs one for an ore model!".formatted(material.getName())); + TEMPLATE_MODEL_CACHE.getCache().clear(); + } + /// This is called for every combination of tag prefix + icon type + icon set + protected static void copyOreModelWithBaseStone(TagPrefix tagPrefix, TagPrefix.OreType oreType, + MaterialIconType iconType, MaterialIconSet iconSet) { // read the base ore model JSON JsonObject original; - try (BufferedReader reader = Minecraft.getInstance().getResourceManager() - .openAsReader(GTCEu.id("models/block/ore%s.json".formatted(prop.isEmissive() ? "_emissive" : "")))) { - original = GsonHelper.parse(reader, true); - } catch (IOException e) { - throw new RuntimeException(e); + try { + original = TEMPLATE_MODEL_CACHE.apply(iconType, iconSet); + } catch (RuntimeException e) { + GTCEu.LOGGER.error("Could not load template block model for ore type {}, icon type '{}', icon set '{}'", + tagPrefix.name, iconType.name(), iconSet.name, e); + return; + } + if (original == NULL_ELEMENT_MARKER) { + // if the icon set doesn't have an ore model (somehow...), skip it + return; } - // clone it + // copy it JsonObject newJson = original.deepCopy(); - JsonObject children = newJson.getAsJsonObject("children"); - // add the base stone texture. - children.getAsJsonObject("base_stone") - .addProperty("parent", TagPrefix.ORES.get(prefix).baseModelLocation().toString()); + // add the base stone model. + newJson.getAsJsonObject("children") + .getAsJsonObject("base_stone") + .addProperty("parent", oreType.baseModelLocation().toString()); - ResourceLocation layer0 = prefix.materialIconType() - .getBlockTexturePath(material.getMaterialIconSet(), true); - ResourceLocation layer1 = prefix.materialIconType() - .getBlockTexturePath(material.getMaterialIconSet(), "layer2", true); + GTDynamicResourcePack.addBlockModel( + GTCEu.id(ORE_MODEL_NAME_FORMAT.formatted(iconSet.name, tagPrefix.name, iconType.name())), newJson); + } - JsonObject oresTextures = children.getAsJsonObject("ore_texture").getAsJsonObject("textures"); - oresTextures.addProperty("layer0", layer0.toString()); - oresTextures.addProperty("layer1", layer1.toString()); + private static JsonObject loadTemplateOreModel(MaterialIconType iconType, MaterialIconSet iconSet) { + ResourceLocation baseModelPath = iconType.getBlockModelPath(iconSet, true); + baseModelPath = GTDynamicResourcePack.MODEL_ID_CONVERTER.idToFile(baseModelPath); - newJson.getAsJsonObject("textures").addProperty("particle", layer0.toString()); + ResourceManager resourceManager = Minecraft.getInstance().getResourceManager(); + Optional modelResource = resourceManager.getResource(baseModelPath); - GTDynamicResourcePack.addBlockModel(modelId, newJson); + if (modelResource.isEmpty()) { + // if the icon set doesn't have an ore model (somehow...), skip it gracefully + return NULL_ELEMENT_MARKER; + } + // read & cache the base ore model JSON + try (BufferedReader reader = modelResource.get().openAsReader()) { + return GsonHelper.parse(reader, true); + } catch (IOException e) { + throw new RuntimeException(e); + } } } diff --git a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java index 0956ffa83be..34384172da0 100644 --- a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java @@ -862,13 +862,18 @@ public static class RendererConfigs { @Configurable.Comment({ "Render growing plants in multiblocks that support them?", "Default: true" }) public boolean renderGrowingPlants = true; + @Configurable + @Configurable.Comment({ "Whether or not to color material/ore block highlights in the material color", + "Default: true" }) + public boolean coloredMaterialBlockOutline = true; + @Configurable @Configurable.Comment({ "Whether or not to color tiered machine highlights in the tier color", "Default: true" }) public boolean coloredTieredMachineOutline = true; @Configurable - @Configurable.Comment({ "Whether or not to color wire/cable highlights based on voltage tier", + @Configurable.Comment({ "Whether or not to color wire/cable highlights based on voltage tier or material color", "Default: true" }) public boolean coloredWireOutline = true; } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/client/LevelRendererMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/client/LevelRendererMixin.java index 06f24b56d02..6176d65c52e 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/client/LevelRendererMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/client/LevelRendererMixin.java @@ -19,7 +19,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.*; -import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.core.BlockPos; import net.minecraft.server.level.BlockDestructionProgress; @@ -44,7 +43,6 @@ import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator; import com.mojang.blaze3d.vertex.VertexConsumer; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Final; @@ -177,26 +175,25 @@ private static void renderShape(PoseStack poseStack, VertexConsumer consumer, Vo assert level != null; var rendererCfg = ConfigHolder.INSTANCE.client.renderer; int rgb = 0; - boolean doRenderColoredOutline = false; + boolean renderColoredOutline = false; // spotless:off - // if it's translucent and a material block, always do the colored outline - MaterialEntry materialEntry = gtceu$getTranslucentBlockMaterial(state, pos); - if (!materialEntry.isEmpty()) { - doRenderColoredOutline = true; + MaterialEntry materialEntry = ChemicalHelper.getMaterialEntry(state.getBlock()); + if (rendererCfg.coloredMaterialBlockOutline && !materialEntry.isEmpty()) { + renderColoredOutline = true; rgb = materialEntry.material().getMaterialRGB(); } else if (level.getBlockEntity(pos) instanceof IMachineBlockEntity mbe) { if (rendererCfg.coloredTieredMachineOutline) { if (mbe.getMetaMachine() instanceof SteamMachine steam) { - doRenderColoredOutline = true; + renderColoredOutline = true; rgb = steam.isHighPressure() ? GTValues.VC_HP_STEAM : GTValues.VC_LP_STEAM; } else if (mbe.getMetaMachine() instanceof ITieredMachine tiered) { - doRenderColoredOutline = true; + renderColoredOutline = true; rgb = GTValues.VCM[tiered.getTier()]; } } } else if (rendererCfg.coloredWireOutline && level.getBlockEntity(pos) instanceof IPipeNode pipe) { - doRenderColoredOutline = true; + renderColoredOutline = true; if (!pipe.getFrameMaterial().isNull()) { rgb = pipe.getFrameMaterial().getMaterialRGB(); } else if (pipe instanceof CableBlockEntity cable) { @@ -205,48 +202,18 @@ private static void renderShape(PoseStack poseStack, VertexConsumer consumer, Vo rgb = materialPipe.material.getMaterialRGB(); } } - - VoxelShape blockShape = state.getShape(level, pos, CollisionContext.of(entity)); // spotless:on - if (doRenderColoredOutline) { + VoxelShape blockShape = state.getShape(level, pos, CollisionContext.of(entity)); + + if (renderColoredOutline) { float red = FastColor.ARGB32.red(rgb) / 255f; float green = FastColor.ARGB32.green(rgb) / 255f; float blue = FastColor.ARGB32.blue(rgb) / 255f; renderShape(poseStack, consumer, blockShape, pos.getX() - camX, pos.getY() - camY, pos.getZ() - camZ, - red, green, blue, 1f); + red, green, blue, 0.4f); return; } - BlockPos.MutableBlockPos mutable = pos.mutable(); - for (BlockPos o : GTUtil.NON_CORNER_NEIGHBOURS) { - BlockPos offset = mutable.setWithOffset(pos, o); - if (!gtceu$getTranslucentBlockMaterial(level.getBlockState(offset), offset).isEmpty()) { - renderShape(poseStack, consumer, blockShape, - pos.getX() - camX, pos.getY() - camY, pos.getZ() - camZ, - 0, 0, 0, 1f); - return; - } - } original.call(instance, poseStack, consumer, entity, camX, camY, camZ, pos, state); } - - @Unique - private @NotNull MaterialEntry gtceu$getTranslucentBlockMaterial(BlockState state, BlockPos pos) { - assert level != null; - // skip non-solid blocks from other mods (like vanilla ice blocks) - if (!state.isSolidRender(level, pos) && !(state.getBlock() instanceof MaterialBlock)) { - return MaterialEntry.NULL_ENTRY; - } - - BakedModel blockModel = minecraft.getBlockRenderer().getBlockModel(state); - ModelData modelData = level.getModelDataManager().getAt(pos); - if (modelData == null) modelData = ModelData.EMPTY; - modelData = blockModel.getModelData(level, pos, state, modelData); - - gtceu$modelRandom.setSeed(state.getSeed(pos)); - if (blockModel.getRenderTypes(state, gtceu$modelRandom, modelData).contains(RenderType.translucent())) { - return ChemicalHelper.getMaterialEntry(state.getBlock()); - } - return MaterialEntry.NULL_ENTRY; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java index a33acec7fff..986d7be8744 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java @@ -56,9 +56,9 @@ public class GTDynamicResourcePack implements PackResources { protected static final GTDynamicPackContents CONTENTS = new GTDynamicPackContents(); private static final FileToIdConverter ATLAS_ID_CONVERTER = FileToIdConverter.json("atlases"); - private static final FileToIdConverter TEXTURE_ID_CONVERTER = SpriteSource.TEXTURE_ID_CONVERTER; + public static final FileToIdConverter TEXTURE_ID_CONVERTER = SpriteSource.TEXTURE_ID_CONVERTER; public static final FileToIdConverter BLOCKSTATE_ID_CONVERTER = FileToIdConverter.json("blockstates"); - private static final FileToIdConverter MODEL_ID_CONVERTER = FileToIdConverter.json("models"); + public static final FileToIdConverter MODEL_ID_CONVERTER = FileToIdConverter.json("models"); private final String name; diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore.json new file mode 100644 index 00000000000..239cf811df9 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/diamond/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/diamond/ore", + "layer1": "gtceu:block/material_sets/diamond/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore_emissive.json new file mode 100644 index 00000000000..530e76750b5 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/diamond/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/diamond/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/diamond/ore_emissive", + "layer1": "gtceu:block/material_sets/diamond/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/dull/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/dull/block.json index f3e2aec258c..9220a964136 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/dull/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/dull/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/dull/block", - "top_all": "gtceu:block/material_sets/dull/block_secondary" - } + "particle": "gtceu:block/material_sets/dull/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/dull/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/dull/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/dull/frame_gt.json b/src/main/resources/assets/gtceu/models/block/material_sets/dull/frame_gt.json index 4145d0ceb64..b74dc0fe62f 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/dull/frame_gt.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/dull/frame_gt.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/dull/frame_gt", - "top_all": "gtceu:block/material_sets/dull/frame_gt_secondary" - } + "particle": "gtceu:block/material_sets/dull/frame_gt" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "cutout", + "textures": { + "all": "gtceu:block/material_sets/dull/frame_gt" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/dull/frame_gt_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/dull/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/dull/ore.json new file mode 100644 index 00000000000..87059560e15 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/dull/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/dull/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/dull/ore", + "layer1": "gtceu:block/material_sets/dull/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/dull/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/dull/ore_emissive.json new file mode 100644 index 00000000000..41b0e9971cd --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/dull/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/dull/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/dull/ore_emissive", + "layer1": "gtceu:block/material_sets/dull/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/emerald/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/emerald/block.json index 4c82d064ae1..561f7ff3061 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/emerald/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/emerald/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/emerald/block", - "top_all": "gtceu:block/material_sets/emerald/block_secondary" - } + "particle": "gtceu:block/material_sets/emerald/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/emerald/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/emerald/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/fine/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/fine/block.json index f0ea3273608..e67185edb1a 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/fine/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/fine/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/fine/block", - "top_all": "gtceu:block/material_sets/fine/block_secondary" - } + "particle": "gtceu:block/material_sets/fine/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/fine/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/fine/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/fine/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/fine/ore.json new file mode 100644 index 00000000000..d1a151c2ed9 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/fine/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/fine/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/fine/ore", + "layer1": "gtceu:block/material_sets/fine/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/fine/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/fine/ore_emissive.json new file mode 100644 index 00000000000..1f3a55ddf91 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/fine/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/fine/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/fine/ore_emissive", + "layer1": "gtceu:block/material_sets/fine/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/flint/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/flint/ore.json new file mode 100644 index 00000000000..db813a630ac --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/flint/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/flint/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/flint/ore", + "layer1": "gtceu:block/material_sets/flint/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/flint/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/flint/ore_emissive.json new file mode 100644 index 00000000000..d1dac37287d --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/flint/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/flint/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/flint/ore_emissive", + "layer1": "gtceu:block/material_sets/flint/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/lapis/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/lapis/block.json index 5470aee534b..c9d66e5f5a7 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/lapis/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/lapis/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/lapis/block", - "top_all": "gtceu:block/material_sets/lapis/block_secondary" - } + "particle": "gtceu:block/material_sets/lapis/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/lapis/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/lapis/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore.json new file mode 100644 index 00000000000..df02a9b8199 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/lapis/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/lapis/ore", + "layer1": "gtceu:block/material_sets/lapis/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore_emissive.json new file mode 100644 index 00000000000..bb285c1e3b6 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/lapis/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/lapis/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/lapis/ore_emissive", + "layer1": "gtceu:block/material_sets/lapis/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/lignite/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/lignite/block.json index 4509d7f85d4..e29ae1c608f 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/lignite/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/lignite/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/lignite/block", - "top_all": "gtceu:block/material_sets/lignite/block_secondary" - } + "particle": "gtceu:block/material_sets/lignite/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/lignite/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/lignite/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore.json new file mode 100644 index 00000000000..7bff65a2d15 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/lignite/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/lignite/ore", + "layer1": "gtceu:block/material_sets/lignite/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore_emissive.json new file mode 100644 index 00000000000..c37c4c6f90f --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/lignite/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/lignite/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/lignite/ore_emissive", + "layer1": "gtceu:block/material_sets/lignite/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/netherstar/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/netherstar/block.json index 3ec8294e7d3..78c44413ca4 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/netherstar/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/netherstar/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/netherstar/block", - "top_all": "gtceu:block/material_sets/netherstar/block_secondary" - } + "particle": "gtceu:block/material_sets/netherstar/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/netherstar/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/netherstar/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/opal/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/opal/block.json index 03c9569efef..c50e7409747 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/opal/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/opal/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/opal/block", - "top_all": "gtceu:block/material_sets/opal/block_secondary" - } + "particle": "gtceu:block/material_sets/opal/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/opal/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/opal/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/paper/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/paper/ore.json new file mode 100644 index 00000000000..b49f3ceee85 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/paper/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/paper/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/paper/ore", + "layer1": "gtceu:block/material_sets/paper/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/paper/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/paper/ore_emissive.json new file mode 100644 index 00000000000..d5a86695f64 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/paper/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/paper/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/paper/ore_emissive", + "layer1": "gtceu:block/material_sets/paper/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/powder/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/powder/ore.json new file mode 100644 index 00000000000..f8cbb176f81 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/powder/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/powder/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/powder/ore", + "layer1": "gtceu:block/material_sets/powder/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/powder/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/powder/ore_emissive.json new file mode 100644 index 00000000000..001449aa154 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/powder/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/powder/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/powder/ore_emissive", + "layer1": "gtceu:block/material_sets/powder/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/quartz/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/quartz/block.json index 8c4b0140993..5241a54615e 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/quartz/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/quartz/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/quartz/block", - "top_all": "gtceu:block/material_sets/quartz/block_secondary" - } + "particle": "gtceu:block/material_sets/quartz/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/quartz/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/quartz/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore.json new file mode 100644 index 00000000000..228158d1450 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/quartz/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/quartz/ore", + "layer1": "gtceu:block/material_sets/quartz/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore_emissive.json new file mode 100644 index 00000000000..646132f17cd --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/quartz/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/quartz/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/quartz/ore_emissive", + "layer1": "gtceu:block/material_sets/quartz/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/block.json index 5158d10858e..5194e406e48 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/block.json @@ -1,6 +1,24 @@ { "parent": "gtceu:block/material_sets/dull/block", - "textures": { - "top_all": "gtceu:block/material_sets/radioactive/block_secondary" - } + "loader": "forge:composite", + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/dull/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/radioactive/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/frame_gt.json b/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/frame_gt.json index 03b56173f7f..b3050276fa1 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/frame_gt.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/radioactive/frame_gt.json @@ -1,6 +1,24 @@ { "parent": "gtceu:block/material_sets/dull/frame_gt", - "textures": { - "top_all": "gtceu:block/material_sets/radioactive/frame_gt_secondary" - } + "loader": "forge:composite", + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "cutout", + "textures": { + "all": "gtceu:block/material_sets/dull/frame_gt" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/radioactive/frame_gt_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/rough/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/rough/block.json index 52fa4e18cb6..0564fbf8739 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/rough/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/rough/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/rough/block", - "top_all": "gtceu:block/material_sets/rough/block_secondary" - } + "particle": "gtceu:block/material_sets/rough/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/rough/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/rough/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/rough/ore.json b/src/main/resources/assets/gtceu/models/block/material_sets/rough/ore.json new file mode 100644 index 00000000000..5f76ff8831f --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/rough/ore.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/rough/ore" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/rough/ore", + "layer1": "gtceu:block/material_sets/rough/ore_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": 0 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": 1 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": 1 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": 1 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": 1 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/rough/ore_emissive.json b/src/main/resources/assets/gtceu/models/block/material_sets/rough/ore_emissive.json new file mode 100644 index 00000000000..cfb1d0996a4 --- /dev/null +++ b/src/main/resources/assets/gtceu/models/block/material_sets/rough/ore_emissive.json @@ -0,0 +1,53 @@ +{ + "parent": "block/block", + "loader": "forge:composite", + "textures": { + "particle": "gtceu:block/material_sets/rough/ore_emissive" + }, + "children": { + "base_stone": { + "render_type": "solid" + }, + "ore_texture": { + "parent": "block/block", + "textures": { + "layer0": "gtceu:block/material_sets/rough/ore_emissive", + "layer1": "gtceu:block/material_sets/rough/ore_emissive_layer2", + "particle": "#layer0" + }, + "render_type": "translucent", + "elements": [ + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer0", "cullface": "down", "tintindex": -101 }, + "up": { "texture": "#layer0", "cullface": "up", "tintindex": -101 }, + "north": { "texture": "#layer0", "cullface": "north", "tintindex": -101 }, + "south": { "texture": "#layer0", "cullface": "south", "tintindex": -101 }, + "west": { "texture": "#layer0", "cullface": "west", "tintindex": -101 }, + "east": { "texture": "#layer0", "cullface": "east", "tintindex": -101 } + } + }, + { + "from": [0, 0, 0 ], + "to": [16, 16, 16], + "forge_data": { "block_light": 15, "sky_light": 15 }, + "faces": { + "down": { "texture": "#layer1", "cullface": "down", "tintindex": -102 }, + "up": { "texture": "#layer1", "cullface": "up", "tintindex": -102 }, + "north": { "texture": "#layer1", "cullface": "north", "tintindex": -102 }, + "south": { "texture": "#layer1", "cullface": "south", "tintindex": -102 }, + "west": { "texture": "#layer1", "cullface": "west", "tintindex": -102 }, + "east": { "texture": "#layer1", "cullface": "east", "tintindex": -102 } + } + } + ] + } + }, + "item_render_order": [ + "base_stone", + "ore_texture" + ] +} diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/sand/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/sand/block.json index 5c23ce2fa58..99feb35f9bd 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/sand/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/sand/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/sand/block", - "top_all": "gtceu:block/material_sets/sand/block_secondary" - } + "particle": "gtceu:block/material_sets/sand/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/sand/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/sand/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/shiny/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/shiny/block.json index c260da6326c..2c9c91c7368 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/shiny/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/shiny/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/shiny/block", - "top_all": "gtceu:block/material_sets/shiny/block_secondary" - } + "particle": "gtceu:block/material_sets/shiny/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/shiny/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/shiny/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/models/block/material_sets/wood/block.json b/src/main/resources/assets/gtceu/models/block/material_sets/wood/block.json index 847ff131455..375e29e2abf 100644 --- a/src/main/resources/assets/gtceu/models/block/material_sets/wood/block.json +++ b/src/main/resources/assets/gtceu/models/block/material_sets/wood/block.json @@ -1,7 +1,27 @@ { - "parent": "gtceu:block/cube_2_layer/tinted_both/all_translucent", + "parent": "block/block", + "loader": "forge:composite", "textures": { - "bot_all": "gtceu:block/material_sets/wood/block", - "top_all": "gtceu:block/material_sets/wood/block_secondary" - } + "particle": "gtceu:block/material_sets/wood/block" + }, + "children": { + "base": { + "parent": "gtceu:block/cube/tinted/all_0", + "render_type": "solid", + "textures": { + "all": "gtceu:block/material_sets/wood/block" + } + }, + "secondary": { + "parent": "gtceu:block/cube/tinted/all", + "render_type": "translucent", + "textures": { + "all": "gtceu:block/material_sets/wood/block_secondary" + } + } + }, + "item_render_order": [ + "base", + "secondary" + ] } diff --git a/src/main/resources/assets/gtceu/textures/block/material_sets/paper/foil.png b/src/main/resources/assets/gtceu/textures/block/material_sets/paper/foil.png deleted file mode 100644 index 2f1b92d5cdc310b7575a1028e66b8240e9015def..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 588 zcmV-S0<-;zP)Tt>m0Jj)UVkXst2EKx(b1D!uphsVXr> zdhdAeQB`uze0_cK`}@n!&(Fe0jFIQ(XH=Dx(z5Tp$2o_YalKvvNGYvO%nT7hy!W)$ zXsw~Ds|)WvW`?SA90xgPRFzq{_x>z?UYKBjecurg#uyyOK`Djn^-8T3GsDanW1K5o zE*D;2Ue-jDOjW715<(!Q#NFK;tu=b@nAw?M1Q8MTeP65-SZk%VwiE$E2#hfZA+T-R zxk4$0Qp#fQy;DkAxu;^zc}186&N<}f=7y)IC(LXS&CTar0IIrTdhZD#oCE-$pP#F+ z8DaJ?9jNM>&^bp4;p}1G_eC(Lnit0y%h|r~^xg>}5JEsiD5ab$JU%|sdnf0-8lK>} z#I|jO5CHzU5HsWZ`+NN;wblimPDF&;+gn8B-(xZ}q_xKT`}>-3o-xK!3n5@;IOkR` aQ{)c-#ng`#f;WW#0000 Date: Wed, 4 Feb 2026 23:59:22 +0200 Subject: [PATCH 24/78] Fix pipes' block break animation being the wrong shape (#4543) --- .../block/pipe/huge_duct_pipe/center.json | 1 + .../block/pipe/huge_duct_pipe/connection.json | 1 + .../block/pipe/large_duct_pipe/center.json | 1 + .../pipe/large_duct_pipe/connection.json | 1 + .../block/pipe/normal_duct_pipe/center.json | 1 + .../pipe/normal_duct_pipe/connection.json | 1 + .../block/pipe/normal_laser_pipe/center.json | 1 + .../pipe/normal_laser_pipe/center_active.json | 1 + .../pipe/normal_laser_pipe/connection.json | 1 + .../normal_laser_pipe/connection_active.json | 1 + .../pipe/normal_optical_pipe/center.json | 1 + .../normal_optical_pipe/center_active.json | 1 + .../pipe/normal_optical_pipe/connection.json | 1 + .../connection_active.json | 1 + .../block/pipe/small_duct_pipe/center.json | 1 + .../pipe/small_duct_pipe/connection.json | 1 + .../api/blockentity/PipeBlockEntity.java | 4 +- .../gtceu/api/pipenet/IPipeNode.java | 25 ++++++++++++- .../gtceu/client/model/GTModelProperties.java | 2 - .../client/model/pipe/ActivablePipeModel.java | 5 ++- .../client/model/pipe/BakedPipeModel.java | 37 ++++++++++++------- .../gtceu/client/model/pipe/PipeModel.java | 6 ++- 22 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json index 02a16c80e83..94e63584b2c 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/center.json @@ -40,6 +40,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json index 2226641a443..e76d23f3a85 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/huge_duct_pipe/connection.json @@ -41,6 +41,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_duct_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json index a55cb442878..a2321bea230 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/center.json @@ -40,6 +40,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json index 99be7317456..3cbd0c515e5 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/large_duct_pipe/connection.json @@ -41,6 +41,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_duct_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json index 2d0b6ace2aa..1c26580e3bf 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/center.json @@ -40,6 +40,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json index 0204502f18f..8dd3319f1de 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_duct_pipe/connection.json @@ -41,6 +41,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_duct_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json index d42a077b7d3..465a616919f 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center.json @@ -78,6 +78,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_laser_side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json index 4415d9932a9..d7ad0f481b2 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/center_active.json @@ -108,6 +108,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_laser_side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json index ca2bd68f7d2..9e2730a1c5b 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection.json @@ -71,6 +71,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_laser_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json index a589a8af80f..f45e0d010d3 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_laser_pipe/connection_active.json @@ -91,6 +91,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_laser_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json index 7ce8bf8c21a..ff938952e9e 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center.json @@ -78,6 +78,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_optical_side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json index 552b717cf3e..ca30b085f41 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/center_active.json @@ -108,6 +108,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_optical_side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json index 4c0b091c60a..d01e5420817 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection.json @@ -71,6 +71,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_optical_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json index ec0d096c1a0..1f89bf4bc9c 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/normal_optical_pipe/connection_active.json @@ -91,6 +91,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_optical_in", "particle": "#side", diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json index 73b8cd699db..1033b2f0f73 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/center.json @@ -40,6 +40,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "particle": "#side", "side": "gtceu:block/pipe/pipe_duct_side" diff --git a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json index c6d3c85d4b0..c7eb5ea67dc 100644 --- a/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json +++ b/src/generated/resources/assets/gtceu/models/block/pipe/small_duct_pipe/connection.json @@ -41,6 +41,7 @@ ] } ], + "render_type": "minecraft:cutout_mipped", "textures": { "end": "gtceu:block/pipe/pipe_duct_in", "particle": "#side", 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 bc5757ac7b8..471e8ca1f77 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -250,8 +250,8 @@ public int getVisualConnections() { @Override public void setConnection(Direction side, boolean connected, boolean fromNeighbor) { - // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to - // it. + // fix desync between two connections. + // Can happen if a pipe side is blocked, and a new pipe is placed next to it. if (!getLevel().isClientSide) { if (isConnected(side) == connected) { return; diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java index f002edec6e8..83284557af6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.client.model.GTModelProperties; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -14,12 +15,16 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.client.model.data.ModelData; +import net.minecraftforge.client.model.data.ModelDataManager; +import net.minecraftforge.common.extensions.IForgeBlockEntity; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface IPipeNode & IPipeType, NodeDataType> - extends ITickSubscription, IPaintable { + extends ITickSubscription, IPaintable, IForgeBlockEntity { long getOffsetTimer(); @@ -140,12 +145,19 @@ default NodeDataType getNodeData() { void notifyBlockUpdate(); + @SuppressWarnings("UnstableApiUsage") default void scheduleRenderUpdate() { var pos = getPipePos(); var level = getPipeLevel(); if (level != null) { var state = level.getBlockState(pos); if (level.isClientSide) { + // simplified from requestModelDataUpdate + ModelDataManager manager = level.getModelDataManager(); + if (manager != null) { + manager.requestRefresh(self()); + } + level.sendBlockUpdated(pos, state, state, Block.UPDATE_IMMEDIATE); } else { level.blockEvent(pos, state.getBlock(), 1, 0); @@ -176,4 +188,15 @@ default int getDefaultPaintingColor() { @NotNull Material getFrameMaterial(); + + @ApiStatus.Internal + @Override + default @NotNull ModelData getModelData() { + return ModelData.builder() + .with(GTModelProperties.LEVEL, self().getLevel()) + .with(GTModelProperties.POS, self().getBlockPos()) + .with(GTModelProperties.PIPE_CONNECTION_MASK, this.getVisualConnections()) + .with(GTModelProperties.PIPE_BLOCKED_MASK, this.getBlockedConnections()) + .build(); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java b/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java index 2f58894072b..547af6d647e 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/GTModelProperties.java @@ -11,6 +11,4 @@ public class GTModelProperties { public static final ModelProperty PIPE_CONNECTION_MASK = new ModelProperty<>(); public static final ModelProperty PIPE_BLOCKED_MASK = new ModelProperty<>(); - - public static final ModelProperty PIPE_ACTIVE = new ModelProperty<>(); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java index 74da42c293b..46331b3fb90 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/ActivablePipeModel.java @@ -58,7 +58,7 @@ public void initModels() { } /** - * Override this to change the actual model {@link #block this.block} will use. + * Override this to change the active model {@link #block this.block} will use. * * @return A model builder for the block's actual model. * @see #getOrCreateBlockModel() @@ -140,7 +140,8 @@ protected BlockModelBuilder makeActiveElementModel(ResourceLocation name, @Nulla BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) .parent(new ModelFile.UncheckedModelFile("block/block")) - .texture("particle", "#" + (this.side != null ? SIDE_KEY : END_KEY)); + .texture("particle", "#" + (this.side != null ? SIDE_KEY : END_KEY)) + .renderType(RENDERTYPE_CUTOUT_MIPPED); ResourceLocation side = this.sideActive != null ? this.sideActive : this.side; ResourceLocation end = this.endActive != null ? this.endActive : this.end; diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java index cba98fe97b3..3553bd37510 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/BakedPipeModel.java @@ -58,12 +58,16 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction Integer connectionMask = modelData.get(GTModelProperties.PIPE_CONNECTION_MASK); Integer blockedMask = modelData.get(GTModelProperties.PIPE_BLOCKED_MASK); - if (level == null || pos == null || state == null) { + if (state == null) { connectionMask = ITEM_CONNECTIONS; blockedMask = Node.ALL_CLOSED; } if (connectionMask == null || connectionMask != Node.ALL_OPENED) { - quads.addAll(parts.get(null).getQuads(state, side, rand, modelData, renderType)); + BakedModel centerModel = parts.get(null); + if (renderType == null || + state != null && centerModel.getRenderTypes(state, rand, modelData).contains(renderType)) { + quads.addAll(centerModel.getQuads(state, side, rand, modelData, renderType)); + } if (connectionMask == null) { // return unconnected base model if the model property isn't set return quads; @@ -71,9 +75,17 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction } for (Direction dir : GTUtil.DIRECTIONS) { if (PipeBlockEntity.isConnected(connectionMask, dir)) { - quads.addAll(parts.get(dir).getQuads(state, side, rand, modelData, renderType)); + BakedModel model = parts.get(dir); + if (renderType == null || + (state != null && model.getRenderTypes(state, rand, modelData).contains(renderType))) { + quads.addAll(model.getQuads(state, side, rand, modelData, renderType)); + } if (blockedMask != null && PipeBlockEntity.isFaceBlocked(blockedMask, dir)) { - quads.addAll(restrictors.get(dir).getQuads(state, side, rand, modelData, renderType)); + model = restrictors.get(dir); + if (renderType == null || + (state != null && model.getRenderTypes(state, rand, modelData).contains(renderType))) { + quads.addAll(model.getQuads(state, side, rand, modelData, renderType)); + } } } } @@ -83,7 +95,7 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction ICoverableRenderer.super.renderCovers(quads, pipeNode.getCoverContainer(), pos, level, side, rand, modelData, renderType); - if (pipeNode.getFrameMaterial().isNull() || (renderType != null && renderType != RenderType.translucent())) { + if (pipeNode.getFrameMaterial().isNull()) { return quads; } var frameBlockEntry = GTMaterialBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, pipeNode.getFrameMaterial()); @@ -123,16 +135,13 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction @Override public ModelData getModelData(BlockAndTintGetter level, BlockPos pos, BlockState state, ModelData modelData) { - ModelData.Builder builder = modelData.derive() - .with(GTModelProperties.LEVEL, level) - .with(GTModelProperties.POS, pos); - - if (!(level.getBlockEntity(pos) instanceof PipeBlockEntity blockEntity)) { - return builder.build(); + for (BakedModel part : this.parts.values()) { + modelData = part.getModelData(level, pos, state, modelData); + } + for (BakedModel restrictor : this.restrictors.values()) { + modelData = restrictor.getModelData(level, pos, state, modelData); } - return builder.with(GTModelProperties.PIPE_CONNECTION_MASK, blockEntity.getVisualConnections()) - .with(GTModelProperties.PIPE_BLOCKED_MASK, blockEntity.getBlockedConnections()) - .build(); + return modelData; } @SuppressWarnings("deprecation") diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java index 68cbe9f0e22..5f440b0214f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/pipe/PipeModel.java @@ -88,6 +88,7 @@ public class PipeModel { SIDE_OVERLAY_KEY = "side_overlay", END_OVERLAY_KEY = "end_overlay"; // spotless:on + protected static final ResourceLocation RENDERTYPE_CUTOUT_MIPPED = new ResourceLocation("cutout_mipped"); public static final Set DYNAMIC_MODELS = new HashSet<>(); @@ -98,7 +99,7 @@ public static void initDynamicModels() { } @Getter - private final PipeBlock block; + protected final PipeBlock block; public final @NotNull ResourceLocation blockId; protected final GTBlockstateProvider provider; @@ -314,7 +315,8 @@ protected BlockModelBuilder makeElementModel(ResourceLocation name, @Nullable Di BlockModelBuilder model = this.provider.models().getBuilder(name.toString()) .parent(new ModelFile.UncheckedModelFile("block/block")) - .texture("particle", "#" + (this.side != null ? SIDE_KEY : END_KEY)); + .texture("particle", "#" + (this.side != null ? SIDE_KEY : END_KEY)) + .renderType(RENDERTYPE_CUTOUT_MIPPED); makePartModelElement(model, endFace, false, faceEndpoints, 0.0f, 0, 1, x1, y1, z1, x2, y2, z2, this.side, this.end, SIDE_KEY, END_KEY); makePartModelElement(model, endFace, true, faceEndpoints, 0.001f, 0, 1, From 04a829909bea23239f07c8305349a82446db2c77 Mon Sep 17 00:00:00 2001 From: Haze Date: Wed, 4 Feb 2026 17:00:38 -0500 Subject: [PATCH 25/78] Fixed tooltip order for Large Assembler (#4552) --- .../gregtechceu/gtceu/common/data/machines/GCYMMachines.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java index 4fffdc064a9..8682cc2e563 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java @@ -283,9 +283,9 @@ public static void init() {} .multiblock("large_assembler", WorkableElectricMultiblockMachine::new) .langValue("Large Assembling Factory") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.multiblock.exact_hatch_1.tooltip")) .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.assembler"))) + .tooltips(Component.translatable("gtceu.multiblock.exact_hatch_1.tooltip")) .conditionalTooltip(GTMachineUtils.defaultEnvironmentRequirement(), ConfigHolder.INSTANCE.gameplay.environmentalHazards) .rotationState(RotationState.ALL) From 83ecd01a8d1d3bd07dea2f95fd25cf1b79993119 Mon Sep 17 00:00:00 2001 From: iouter <62897714+iouter@users.noreply.github.com> Date: Sat, 7 Feb 2026 06:40:50 +0800 Subject: [PATCH 26/78] Update zh_cn.json (#4516) --- .../resources/assets/gtceu/lang/zh_cn.json | 81 +++++++++++++++---- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/src/main/resources/assets/gtceu/lang/zh_cn.json b/src/main/resources/assets/gtceu/lang/zh_cn.json index ca9c93f6ff7..057f5ffa80c 100644 --- a/src/main/resources/assets/gtceu/lang/zh_cn.json +++ b/src/main/resources/assets/gtceu/lang/zh_cn.json @@ -64,8 +64,16 @@ "behaviour.lighter.tooltip.description": "可以点火", "behaviour.lighter.tooltip.usage": "潜行右击以开/关", "behaviour.lighter.uses": "剩余次数:%d", - "behaviour.meta.machine.config.copy.tooltip": "§7潜行右键单击以复制机器配置", - "behaviour.meta.machine.config.paste.tooltip": "§7右键单击以粘贴机器配置", + "behaviour.memory_card.client_msg.cleared": "已清除存储的配置", + "behaviour.memory_card.client_msg.copied": "已复制机器配置", + "behaviour.memory_card.client_msg.pasted": "已应用机器配置", + "behaviour.memory_card.copy_target": "复制源:%s", + "behaviour.memory_card.disabled": "§c已禁用§r", + "behaviour.memory_card.enabled": "§a已启用§r", + "behaviour.memory_card.tooltip.copy": "§7潜行+右键单击机器或管道复制配置,单击其他方块则会清除数据", + "behaviour.memory_card.tooltip.items_to_paste": "应用此配置需要以下物品:", + "behaviour.memory_card.tooltip.paste": "§7右键单击以粘贴机器配置", + "behaviour.memory_card.tooltip.view_stored": "§8<潜行以查看存储的配置>", "behaviour.paintspray.black.tooltip": "可以将物品染成黑色", "behaviour.paintspray.blue.tooltip": "可以将物品染成蓝色", "behaviour.paintspray.brown.tooltip": "可以将物品染成棕色", @@ -85,10 +93,15 @@ "behaviour.paintspray.white.tooltip": "可以将物品染成白色", "behaviour.paintspray.yellow.tooltip": "可以将物品染成黄色", "behaviour.prospecting": "适用于探矿", - "behaviour.setting.allow.input.from.output.tooltip": "%s-允许从输出面输入:%s", - "behaviour.setting.item_auto_output.tooltip": "%s-自动输出:%s", - "behaviour.setting.muffled.tooltip": "静音:%s", - "behaviour.setting.output.direction.tooltip": "%s-输出面方向:%s", + "behaviour.setting.tooltip.allow_input": "§2允许输入§r", + "behaviour.setting.tooltip.auto_output": "§2自动输出§r", + "behaviour.setting.tooltip.auto_output_allow_input": "§2自动输出/允许输入§r", + "behaviour.setting.tooltip.circuit_config": "编程电路:", + "behaviour.setting.tooltip.fluid_io": "流体输出:%s(%s)", + "behaviour.setting.tooltip.item_io": "物品输出:%s(%s)", + "behaviour.setting.tooltip.muffled": "静音%s", + "behaviour.setting.tooltip.pipe_blocked_connections": "管道禁入:%s", + "behaviour.setting.tooltip.pipe_connections": "管道连接:%s", "behaviour.soft_hammer": "用来开启与关闭机器", "behaviour.soft_hammer.disabled": "已暂停工作", "behaviour.soft_hammer.disabled_cycle": "本运行周期后暂停工作", @@ -1731,7 +1744,6 @@ "command.gtceu.share_prospection_data.notification": "%s向你分享了矿脉数据!", "config.gtceu.option.addLoot": "添加战利品", "config.gtceu.option.ae2": "ae2", - "config.gtceu.option.allUniqueStoneTypes": "所有独特石头类型", "config.gtceu.option.allowDrumsInputFluidsFromOutputSide": "允许桶从输出面输入流体", "config.gtceu.option.animationTime": "动画时间", "config.gtceu.option.arcRecyclingYield": "电弧炉回收率", @@ -1880,6 +1892,7 @@ "config.gtceu.option.steelSteamMultiblocks": "用钢的蒸汽多方块结构", "config.gtceu.option.surfaceRockProspectRange": "地表岩石探测半径", "config.gtceu.option.tankItemFluidPreview": "储罐流体预览", + "config.gtceu.option.temperaturesInKelvin": "开尔文温度", "config.gtceu.option.titaniumBoilerHeatSpeed": "钛锅炉-加热速度", "config.gtceu.option.titaniumBoilerMaxTemperature": "钛锅炉-最高温度", "config.gtceu.option.toggle": "切换", @@ -1906,6 +1919,7 @@ "config.gtceu.option.yOffset": "y偏移", "config.gtceu.option.zombieSpawnWithSabers": "带纳米剑的僵尸生成", "config.jade.plugin_gtceu.auto_output_info": "[GTCEu] 自动输出信息", + "config.jade.plugin_gtceu.battery_info": "[GTCEu] 电池信息", "config.jade.plugin_gtceu.cable_info": "[GTCEu] 线缆信息", "config.jade.plugin_gtceu.controllable_provider": "[GTCEu] 是否停工", "config.jade.plugin_gtceu.data_bank": "[GTCEu] 数据库信息", @@ -1913,6 +1927,7 @@ "config.jade.plugin_gtceu.energy_converter_provider": "[GTCEu] 能量转换器模式", "config.jade.plugin_gtceu.exhaust_vent_info": "[GTCEu] 排气口信息", "config.jade.plugin_gtceu.hazard_cleaner_provider": "[GTCEu] 污染清理", + "config.jade.plugin_gtceu.ldp_endpoint": "[GTCEu] 长距离管道接口信息", "config.jade.plugin_gtceu.machine_mode": "[GTCEu] 机器模式", "config.jade.plugin_gtceu.maintenance_info": "[GTCEu] 维护信息", "config.jade.plugin_gtceu.me_pattern_buffer": "[GTCEu] 样板总成信息", @@ -1961,7 +1976,7 @@ "cover.advanced_fluid_detector.invert.enabled.1": "", "cover.advanced_fluid_detector.invert.enabled.2": "切换以反转红石逻辑", "cover.advanced_fluid_detector.invert.enabled.3": "默认情况下,流体量介于所设定的最小值和最大值之间时覆盖板将发出红石信号,小于最小值时则停止发出红石信号", - "cover.advanced_fluid_detector.label": "进阶流体探测器", + "cover.advanced_fluid_detector.label": "进阶流体探测覆盖板", "cover.advanced_fluid_detector.max": "最大流体量(mB)", "cover.advanced_fluid_detector.min": "最小流体量(mB)", "cover.advanced_item_detector.invert.disabled.0": "输出:普通", @@ -1972,7 +1987,7 @@ "cover.advanced_item_detector.invert.enabled.1": "", "cover.advanced_item_detector.invert.enabled.2": "切换以反转红石逻辑", "cover.advanced_item_detector.invert.enabled.3": "默认情况下,物品数量介于所设定的最小值和最大值之间时覆盖板将发出红石信号,小于最小值时则停止发出红石信号", - "cover.advanced_item_detector.label": "进阶物品探测器", + "cover.advanced_item_detector.label": "进阶物品探测覆盖板", "cover.advanced_item_detector.max": "最大物品数量", "cover.advanced_item_detector.min": "最小物品数量", "cover.bucket.mode.bucket": "B", @@ -2293,8 +2308,10 @@ "gtceu.electrolyzer": "电解机", "gtceu.electromagnetic_separator": "电磁选矿机", "gtceu.ender_item_link_cover.title": "末影物品连接", + "gtceu.ender_item_link_cover.tooltip": "作§f覆盖板§7时利用§f无线§7§d末影§f连接§7传输§f物品§7。", "gtceu.ender_redstone_link_cover.label": "红石信号强度:%d", "gtceu.ender_redstone_link_cover.title": "末影红石连接", + "gtceu.ender_redstone_link_cover.tooltip": "作§f覆盖板§7时利用§f无线§7§d末影§f连接§7传输§f红石信号§7。", "gtceu.extractor": "提取机", "gtceu.extruder": "压模器", "gtceu.fermenter": "发酵槽", @@ -2312,7 +2329,7 @@ "gtceu.fluid.state_gas": "§a状态:气态", "gtceu.fluid.state_liquid": "§a状态:液态", "gtceu.fluid.state_plasma": "§a状态:等离子态", - "gtceu.fluid.temperature": "§c温度:%d", + "gtceu.fluid.temperature": "§c温度:%s", "gtceu.fluid.temperature.cryogenic": "§b低温流体!轻拿轻放!", "gtceu.fluid.type_acid.tooltip": "§6酸性流体!轻拿轻放!", "gtceu.fluid_heater": "流体加热器", @@ -2394,6 +2411,8 @@ "gtceu.gui.content.units.per_second": "/s", "gtceu.gui.content.units.per_tick": "/t", "gtceu.gui.cover_setting.title": "覆盖板设置", + "gtceu.gui.directional_setting.tab_tooltip": "更改方向设置", + "gtceu.gui.directional_setting.title": "方向设置", "gtceu.gui.editor.group.recipe_type": "封顶", "gtceu.gui.editor.tips.citation": "引用次数", "gtceu.gui.fisher_mode.tooltip.0": "捕捉垃圾物品", @@ -2486,12 +2505,20 @@ "gtceu.item_pipe.priority": "§9优先级:§f%d", "gtceu.jade.amperage_use": "%s A", "gtceu.jade.at": " @ ", + "gtceu.jade.changes_eu_sec": "%sEU/s", "gtceu.jade.cleaned_this_second": "污染清理速率:%s/s", + "gtceu.jade.days": "%s天", "gtceu.jade.energy_stored": "%d / %d EU", "gtceu.jade.fluid_use": "%s mB/t", + "gtceu.jade.hours": "%s小时", + "gtceu.jade.minutes": "%s分钟", "gtceu.jade.progress_computation": "%s / %s CWU", "gtceu.jade.progress_sec": "%s / %s s", "gtceu.jade.progress_tick": "%s / %s t", + "gtceu.jade.remaining_charge_time": "预计充满时间:%s", + "gtceu.jade.remaining_discharge_time": "预计耗空时间:%s", + "gtceu.jade.seconds": "%s秒", + "gtceu.jade.years": "%s年", "gtceu.jei.bedrock_fluid.heavy_oil_deposit": "重油矿藏", "gtceu.jei.bedrock_fluid.lava_deposit": "熔岩矿藏", "gtceu.jei.bedrock_fluid.light_oil_deposit": "轻油矿藏", @@ -2589,6 +2616,7 @@ "gtceu.key.armor_mode_switch": "切换盔甲模式", "gtceu.key.enable_boots": "启用跳跃提升", "gtceu.key.enable_jetpack": "启用喷气背包", + "gtceu.key.enable_step_assist": "启用步行辅助", "gtceu.key.tool_aoe_change": "切换工具范围模式", "gtceu.large_boiler": "大型锅炉", "gtceu.large_chemical_reactor": "大型化学反应釜", @@ -3541,6 +3569,10 @@ "gtceu.placeholder_info.block.0": "返回方块符号‘█’。", "gtceu.placeholder_info.block.1": "用法:", "gtceu.placeholder_info.block.2": " {block} -> '█'", + "gtceu.placeholder_info.blockNbt.0": "返回方块实体的NBT", + "gtceu.placeholder_info.blockNbt.1": "用法:", + "gtceu.placeholder_info.blockNbt.2": " {blockNbt} -> 方块实体的全部NBT", + "gtceu.placeholder_info.blockNbt.3": " {blockNbt [键1] [键2] ...} -> 部分NBT", "gtceu.placeholder_info.bufferText.0": "返回ComputerCraft可访问的缓冲区中的文本", "gtceu.placeholder_info.bufferText.1": "用法:", "gtceu.placeholder_info.bufferText.2": " {bufferText <行>} -> 缓冲区中指定行的文本(行号为1-100)", @@ -3852,6 +3884,10 @@ "gtceu.top.fuel_none": "无燃料", "gtceu.top.invalid_structure": "结构不完整", "gtceu.top.item_auto_output": "物品输出:%s", + "gtceu.top.ldp_endpoint.io_type": "IO类型:%s", + "gtceu.top.ldp_endpoint.is_formed": "§a管路已成型§r", + "gtceu.top.ldp_endpoint.not_formed": "§c管路未连接§r", + "gtceu.top.ldp_endpoint.output_direction": "输出方向:%s", "gtceu.top.link_cover.color": "颜色:", "gtceu.top.machine_mode": "机器模式:", "gtceu.top.maintenance.crowbar": "这东西不属于这儿", @@ -3943,12 +3979,12 @@ "item.glass_lens": "玻璃透镜(白色)", "item.gtceu.activity_detector_cover": "活跃探测覆盖板", "item.gtceu.activity_detector_cover.tooltip": "§7作§f覆盖板§7时依照§f机器活跃状态§7发出红石信号。", - "item.gtceu.advanced_activity_detector_cover": "进阶活跃状态探测器", + "item.gtceu.advanced_activity_detector_cover": "进阶活跃状态探测覆盖板", "item.gtceu.advanced_activity_detector_cover.tooltip": "§7作§f覆盖板§7时依照§f机器处理进度§7发出红石信号。", "item.gtceu.advanced_electric_jetpack": "进阶电力喷气背包", "item.gtceu.advanced_energy_detector_cover": "进阶能量探测覆盖板", "item.gtceu.advanced_energy_detector_cover.tooltip": "§7作§f覆盖板§7时依照由§fRS锁存器§7控制的§f能量状态§7发出红石信号。", - "item.gtceu.advanced_fluid_detector_cover": "进阶流体探测器", + "item.gtceu.advanced_fluid_detector_cover": "进阶流体探测覆盖板", "item.gtceu.advanced_fluid_detector_cover.tooltip": "作§f覆盖板§7时依照由§fRS锁存器§7控制的§f流体存储状态§7发出红石信号。", "item.gtceu.advanced_fluid_voiding_cover": "进阶流体销毁覆盖板", "item.gtceu.advanced_fluid_voiding_cover.tooltip.0": "§7作§f覆盖板§7时允许按数量销毁§f流体§7。", @@ -3956,7 +3992,7 @@ "item.gtceu.advanced_integrated_circuit": "进阶集成电路", "item.gtceu.advanced_integrated_circuit.tooltip.0": "§7更小也更强", "item.gtceu.advanced_integrated_circuit.tooltip.1": "§6HV级电路", - "item.gtceu.advanced_item_detector_cover": "进阶物品探测器", + "item.gtceu.advanced_item_detector_cover": "进阶物品探测覆盖板", "item.gtceu.advanced_item_detector_cover.tooltip": "作§f覆盖板§7时依照由§fRS锁存器§7控制的§f物品存储状态§7发出红石信号。", "item.gtceu.advanced_item_voiding_cover": "进阶物品销毁覆盖板", "item.gtceu.advanced_item_voiding_cover.tooltip.0": "§7作§f覆盖板§7时销毁物品。", @@ -4743,7 +4779,7 @@ "item.gtceu.tool.behavior.block_rotation": "§2精械师傅:§f旋转方块", "item.gtceu.tool.behavior.crop_harvesting": "§a庄稼收割:§f收获成熟的作物", "item.gtceu.tool.behavior.damage_boost": "§4伤害增益:§f对%s造成额外伤害", - "item.gtceu.tool.behavior.dowse_campfire": "§F消防战士:§f扑灭营火", + "item.gtceu.tool.behavior.dowse_campfire": "§1消防战士:§f扑灭营火", "item.gtceu.tool.behavior.grass_path": "§e园林策划:§f制造草径", "item.gtceu.tool.behavior.ground_tilling": "§e耕地农夫:§f耕耘土地", "item.gtceu.tool.behavior.plunger": "§9水管工人:§f清除流体", @@ -4781,10 +4817,15 @@ "item.gtceu.tool.hoe": "%s锄", "item.gtceu.tool.hv_chainsaw": "%s链锯(§6HV§r)", "item.gtceu.tool.hv_drill": "%s电钻(§6HV§r)", + "item.gtceu.tool.hv_screwdriver": "%s螺丝刀(§6HV§r)", + "item.gtceu.tool.hv_screwdriver.tooltip": "§8调整覆盖板和机器", "item.gtceu.tool.hv_wirecutter": "%s剪线钳(HV)", "item.gtceu.tool.hv_wrench": "%s扳手(§6HV§r)", "item.gtceu.tool.hv_wrench.tooltip": "§8按住左键以拆卸机器", + "item.gtceu.tool.iv_chainsaw": "%s链锯(§9IV§r)", "item.gtceu.tool.iv_drill": "%s电钻(§9IV§r)", + "item.gtceu.tool.iv_screwdriver": "%s螺丝刀(§9IV§r)", + "item.gtceu.tool.iv_screwdriver.tooltip": "§8调整覆盖板和机器", "item.gtceu.tool.iv_wirecutter": "%s剪线钳(IV)", "item.gtceu.tool.iv_wrench": "%s扳手(§9IV§r)", "item.gtceu.tool.iv_wrench.tooltip": "§8按住左键以拆卸机器", @@ -4965,7 +5006,6 @@ "item.gtceu.zpm_voltage_coil.tooltip": "超级线圈", "item.invalid.name": "无效物品", "item.netherrack_nether_quartz": "下界石英矿石", - "item.toggle.advanced.info.tooltip": "§8<按住Shift查阅已存储配置信息>", "itemGroup.gtceu.decoration": "格雷科技 | 装饰方块", "itemGroup.gtceu.item": "格雷科技 | 物品", "itemGroup.gtceu.machine": "格雷科技 | 机器", @@ -5592,6 +5632,7 @@ "material.gtceu.tritanium": "三钛", "material.gtceu.tritium": "氚", "material.gtceu.trona": "天然碱", + "material.gtceu.tuff": "凝灰岩", "material.gtceu.tungstate": "钨酸锂", "material.gtceu.tungsten": "钨", "material.gtceu.tungsten_carbide": "碳化钨", @@ -5658,20 +5699,26 @@ "metaarmor.message.nightvision.disabled": "§b夜视:§c关闭", "metaarmor.message.nightvision.enabled": "§b夜视:§a开启", "metaarmor.message.nightvision.error": "§c能量不足!", - "metaarmor.nms.boosted_jump.disabled": "纳米肌体™套装:跳跃提升已禁用", - "metaarmor.nms.boosted_jump.enabled": "纳米肌体™套装:跳跃提升已启用", + "metaarmor.message.step_assist.disabled": "步行辅助:§c关", + "metaarmor.message.step_assist.enabled": "步行辅助:§a开", "metaarmor.nms.nightvision.disabled": "纳米肌体™套装:夜视已禁用", "metaarmor.nms.nightvision.enabled": "纳米肌体™套装:夜视已启用", "metaarmor.nms.nightvision.error": "纳米肌体™套装:§c能量不足!", "metaarmor.nms.share.disable": "纳米肌体™套装:供能模式已禁用", "metaarmor.nms.share.enable": "纳米肌体™套装:供能模式已启用", "metaarmor.nms.share.error": "纳米肌体™套装:§c能量不足,无法供能!", + "metaarmor.nms.step_assist.disabled": "纳米肌体™套装:步行辅助已禁用", + "metaarmor.nms.step_assist.enabled": "纳米肌体™套装:步行辅助已启用", + "metaarmor.qts.boosted_jump.disabled": "夸克高科™套装:跳跃提升已禁用", + "metaarmor.qts.boosted_jump.enabled": "夸克高科™套装:跳跃提升已启用", "metaarmor.qts.nightvision.disabled": "夸克高科™套装:夜视已禁用", "metaarmor.qts.nightvision.enabled": "夸克高科™套装:夜视已启用", "metaarmor.qts.nightvision.error": "夸克高科™套装:§c能量不足!", "metaarmor.qts.share.disable": "夸克高科™套装:供能模式已禁用", "metaarmor.qts.share.enable": "夸克高科™套装:供能模式已启用", "metaarmor.qts.share.error": "夸克高科™套装:§c能量不足,无法供能!", + "metaarmor.qts.step_assist.disabled": "夸克高科™套装:步行辅助已禁用", + "metaarmor.qts.step_assist.enabled": "夸克高科™套装:步行辅助已启用", "metaarmor.tooltip.autoeat": "使用物品栏中的食物补充饱食度", "metaarmor.tooltip.breath": "补充氧气条", "metaarmor.tooltip.burning": "扑灭身上的火焰", From a380ea35acad398ab23a50f87473b0396f8bdb95 Mon Sep 17 00:00:00 2001 From: Karthi <75553966+JuiceyBeans@users.noreply.github.com> Date: Sun, 8 Feb 2026 05:45:55 +0000 Subject: [PATCH 27/78] Add recipes for netherite tools (#4368) --- .../mixins/SmithingTransformRecipeMixin.java | 63 +++++++++++++++++++ .../data/recipe/VanillaRecipeHelper.java | 41 +++++++++++- .../recipe/generated/ToolRecipeHandler.java | 7 +++ src/main/resources/gtceu.mixins.json | 1 + 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/core/mixins/SmithingTransformRecipeMixin.java diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/SmithingTransformRecipeMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/SmithingTransformRecipeMixin.java new file mode 100644 index 00000000000..d349dc17cb2 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/SmithingTransformRecipeMixin.java @@ -0,0 +1,63 @@ +package com.gregtechceu.gtceu.core.mixins; + +import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.item.tool.ToolHelper; + +import net.minecraft.core.RegistryAccess; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.SmithingTransformRecipe; + +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(SmithingTransformRecipe.class) +public class SmithingTransformRecipeMixin { + + @Shadow + @Final + ItemStack result; + + @Inject(method = "assemble", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;setTag(Lnet/minecraft/nbt/CompoundTag;)V")) + private void gtceu$gtToolSmithingTransform1(Container container, RegistryAccess registryAccess, + CallbackInfoReturnable cir, + @Share("newTag") LocalRef sharedTag) { + ItemStack output = this.result.copy(); + + if (!(output.getItem() instanceof IGTTool igtTool)) return; + + CompoundTag originalTag = container.getItem(1).getTag(); + CompoundTag newTag = originalTag != null ? originalTag.copy() : null; + if (newTag == null) return; + + // Remove old tool stats + newTag.remove("GT.Tool"); + + // Copy stats from the upgraded tool + ItemStack newStack = ToolHelper.get(igtTool.getToolType(), igtTool.getMaterial()); + Tag newStats = newStack.getTag() != null ? newStack.getTag().get("GT.Tool") : null; + if (newStats != null) { + newTag.put("GT.Tool", newStats); + sharedTag.set(newTag); + } + } + + @Redirect(method = "assemble", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;setTag(Lnet/minecraft/nbt/CompoundTag;)V")) + private void gtceu$gtToolSmithingTransform2(ItemStack itemStack, CompoundTag tag, + @Share("newTag") LocalRef sharedTag) { + itemStack.setTag(sharedTag.get()); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java index 1cfd3ddac9f..f2035827169 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java @@ -10,10 +10,13 @@ import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialEntry; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.data.recipe.builder.*; import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.SmithingTransformRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; @@ -22,12 +25,16 @@ import net.minecraft.world.level.ItemLike; import com.tterrag.registrate.util.entry.ItemProviderEntry; -import it.unimi.dsi.fastutil.chars.*; +import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap; +import it.unimi.dsi.fastutil.chars.CharArraySet; +import it.unimi.dsi.fastutil.chars.CharSet; import it.unimi.dsi.fastutil.objects.Reference2LongOpenHashMap; import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; +import static com.tterrag.registrate.providers.RegistrateRecipeProvider.has; + public class VanillaRecipeHelper { public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, TagKey input, @@ -618,6 +625,38 @@ public static void addShapelessRecipe(Consumer provider, @NotNul builder.save(provider); } + public static void addSmithingTransformRecipe(Consumer provider, @NotNull ResourceLocation regName, + @NotNull Item result, @NotNull ItemLike baseInput, + @NotNull ItemLike template, @NotNull ItemLike addition, + @NotNull RecipeCategory category) { + SmithingTransformRecipeBuilder + .smithing(Ingredient.of(template), Ingredient.of(baseInput), Ingredient.of(addition), category, result) + .unlocks(String.format("has_%s", baseInput), has(baseInput)) + .save(provider, regName); + } + + public static void addSmithingTransformRecipe(Consumer provider, @NotNull String regName, + @NotNull Item result, @NotNull ItemLike baseInput, + @NotNull ItemLike template, @NotNull ItemLike addition) { + addSmithingTransformRecipe(provider, GTCEu.id(regName), result, baseInput, template, addition, + RecipeCategory.MISC); + } + + public static void addToolUpgradingRecipe(@NotNull Consumer provider, @NotNull GTToolType tool, + @NotNull Material upgradeMaterial, @NotNull Material baseMaterial, + @NotNull ItemLike template, @NotNull ItemLike addition) { + ItemStack upgradeToolStack = ToolHelper.get(tool, upgradeMaterial); + ItemStack baseToolStack = ToolHelper.get(tool, baseMaterial); + + if (upgradeToolStack.isEmpty() || baseToolStack.isEmpty()) return; + + VanillaRecipeHelper.addSmithingTransformRecipe(provider, + String.format("%s_%s_smithing_transform_from_%s", upgradeMaterial.getName(), tool.name, + baseMaterial.getName()), + upgradeToolStack.getItem(), baseToolStack.getItem(), + template, addition); + } + /** * @param material the material to check * @return if the material is a wood diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java index 79f2bf28a5a..1b809ec0bd5 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java @@ -201,6 +201,8 @@ private static void processTool(@NotNull Consumer provider, @Not GTCEu.LOGGER.warn("Did not find rod for " + material.getName() + ", skipping wirecutter, butchery knife, screwdriver, crowbar recipes"); } + + GTToolType.getTypes().forEach((s, gtToolType) -> addNetheriteToolRecipe(provider, gtToolType)); } private static void processElectricTool(@NotNull Consumer provider, @NotNull ToolProperty property, @@ -356,6 +358,11 @@ public static void addToolRecipe(@NotNull Consumer provider, @No } } + public static void addNetheriteToolRecipe(@NotNull Consumer provider, @NotNull GTToolType tool) { + VanillaRecipeHelper.addToolUpgradingRecipe(provider, tool, GTMaterials.Netherite, GTMaterials.Diamond, + Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, ChemicalHelper.get(ingot, GTMaterials.Netherite).getItem()); + } + public static void addArmorRecipe(Consumer provider, @NotNull Material material, @NotNull ArmorItem.Type armor, Object... recipe) { ItemStack armorStack = ToolHelper.getArmor(armor, material); diff --git a/src/main/resources/gtceu.mixins.json b/src/main/resources/gtceu.mixins.json index 3ade6f7cca3..79b50f5d84e 100644 --- a/src/main/resources/gtceu.mixins.json +++ b/src/main/resources/gtceu.mixins.json @@ -57,6 +57,7 @@ "ServerGamePacketListenerImplAccessor", "ShapedRecipeAccessor", "SidedRedstoneConnectivityMixin", + "SmithingTransformRecipeMixin", "TagLoaderMixin", "TagManagerMixin", "TagValueAccessor", From 53dc2bf6262e933e7b17cb7cc7db44f06c31d973 Mon Sep 17 00:00:00 2001 From: zetrock1 <144679746+zetrock1@users.noreply.github.com> Date: Sun, 8 Feb 2026 05:53:48 +0000 Subject: [PATCH 28/78] Output bus filtering (#4337) Co-authored-by: jurrejelle --- .../multiblock/part/ItemBusPartMachine.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java index 279dd585e38..0038b49e98e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java @@ -2,6 +2,9 @@ import com.gregtechceu.gtceu.api.blockentity.IPaintable; import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.cover.filter.FilterHandler; +import com.gregtechceu.gtceu.api.cover.filter.FilterHandlers; +import com.gregtechceu.gtceu.api.cover.filter.ItemFilter; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.ConfiguratorPanel; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; @@ -78,12 +81,17 @@ public class ItemBusPartMachine extends TieredIOPartMachine @Persisted @DescSynced private boolean isDistinct = false; + @Persisted + @DescSynced + @Getter + protected final FilterHandler filterHandler; public ItemBusPartMachine(IMachineBlockEntity holder, int tier, IO io, Object... args) { super(holder, tier, io); this.inventory = createInventory(args); this.circuitSlotEnabled = true; this.circuitInventory = createCircuitItemHandler(io).shouldSearchContent(false); + filterHandler = FilterHandlers.item(this); } ////////////////////////////////////// @@ -99,8 +107,14 @@ protected int getInventorySize() { return sizeRoot * sizeRoot; } + protected boolean matchesFilter(ItemStack stack) { + if (filterHandler.isFilterPresent()) + return filterHandler.getFilter().test(stack); + return true; + } + protected NotifiableItemStackHandler createInventory(Object... args) { - return new NotifiableItemStackHandler(this, getInventorySize(), io); + return new NotifiableItemStackHandler(this, getInventorySize(), io).setFilter(this::matchesFilter); } protected NotifiableItemStackHandler createCircuitItemHandler(Object... args) { @@ -318,6 +332,7 @@ public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 18 * rowSize + 16, 18 * colSize + 16); var container = new WidgetGroup(4, 4, 18 * rowSize + 8, 18 * colSize + 8); int index = 0; + group.addWidget(filterHandler.createFilterSlotUI(-115 + (18 * rowSize) / 2, 35 + 11 * rowSize)); for (int y = 0; y < colSize; y++) { for (int x = 0; x < rowSize; x++) { container.addWidget( @@ -329,7 +344,6 @@ public Widget createUIWidget() { container.setBackground(GuiTextures.BACKGROUND_INVERSE); group.addWidget(container); - return group; } } From 5c91489f43ebcb46ca97c3a7997e13018340191d Mon Sep 17 00:00:00 2001 From: Tar Laboratories <159147059+TarLaboratories@users.noreply.github.com> Date: Sun, 8 Feb 2026 08:54:44 +0300 Subject: [PATCH 29/78] Allow rendering other modules from placeholders (#3900) --- docs/content/Gameplay/Central-Monitor.md | 72 +++++++ .../Modpacks/Other-Topics/Central-Monitor.md | 107 +++++++++++ .../item/component/IMonitorModuleItem.java | 5 +- .../api/placeholder/GraphicsComponent.java | 60 ++++++ .../api/placeholder/IPlaceholderRenderer.java | 15 ++ .../api/placeholder/MultiLineComponent.java | 56 +++++- .../api/placeholder/PlaceholderContext.java | 15 +- .../api/placeholder/PlaceholderHandler.java | 60 ++++-- .../api/placeholder/PlaceholderUtils.java | 4 + .../gtceu/client/renderer/GTRenderTypes.java | 11 ++ .../machine/impl/CentralMonitorRender.java | 2 +- .../renderer/monitor/MonitorTextRenderer.java | 26 ++- .../ModulePlaceholderRenderer.java | 31 +++ .../placeholder/QuadPlaceholderRenderer.java | 35 ++++ .../placeholder/RectPlaceholderRenderer.java | 34 ++++ .../gtceu/common/data/GTPlaceholders.java | 181 ++++++++++++++++-- .../item/modules/ImageModuleBehaviour.java | 2 +- .../item/modules/TextModuleBehaviour.java | 36 ++-- .../electric/CentralMonitorMachine.java | 2 +- .../electric/monitor/MonitorGroup.java | 5 +- .../gtceu/data/lang/LangHandler.java | 21 ++ .../gtceu/syncdata/MonitorGroupPayload.java | 2 +- 22 files changed, 709 insertions(+), 73 deletions(-) create mode 100644 docs/content/Gameplay/Central-Monitor.md create mode 100644 docs/content/Modpacks/Other-Topics/Central-Monitor.md create mode 100644 src/main/java/com/gregtechceu/gtceu/api/placeholder/GraphicsComponent.java create mode 100644 src/main/java/com/gregtechceu/gtceu/api/placeholder/IPlaceholderRenderer.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/ModulePlaceholderRenderer.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/QuadPlaceholderRenderer.java create mode 100644 src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/RectPlaceholderRenderer.java diff --git a/docs/content/Gameplay/Central-Monitor.md b/docs/content/Gameplay/Central-Monitor.md new file mode 100644 index 00000000000..037ab83c6e2 --- /dev/null +++ b/docs/content/Gameplay/Central-Monitor.md @@ -0,0 +1,72 @@ +--- +title: The Central Monitor & Placeholder System +--- + +### The Central Monitor + +The Central Monitor is a multiblock that allows you to insert modules into it to render images and text.
    +Images update every 120 seconds, text update rate depends on the voltage provided to the multiblock. +Guide on how to use the central monitor: + +1. Right-click the controller +2. In the UI, you will see a grid of monitors, the controller, energy hatch and (optionally) a data hatch +3. Select some of the monitors (in any configuration) by left-clicking on them +4. Click the "Create group" button +5. You should see a group appear on the left of the UI, click on it to select all monitors in that group, click again to unselect +6. Click on the gear icon next to the name of the group you want to edit +7. A UI with a single slot should open, put a module into that slot (while it is possible to put a stack of modules in, that does literally nothing) +8. If it's a text/image module a new field should appear, where you can enter some text (for image it'll be a single line for a URL) +9. Once you've entered your text, click on the green checkmark below the slot, that will save the text you entered +10. Click on the gear icon next to the group you're editing to go back to the main menu +11. You should see the text/image on the Central Monitor + +To remove a group, select it and click "Remove from group". To remove a single monitor from a group select only it and click "Remove from group". +You cannot add monitors to a group after it has been created. Image dimensions are determined by the left-up corner of the group and the right-down corner, +the blocks between them have to be in the same group. The text module will only display text on monitors of its group. + +!!! warning "The image module is a bit buggy, so the image may not appear immediately" + +### Text Module + +You may have noticed that the text module has a number input in its UI. It is the text scale, where 1 represents a line height of 1/16th of a block. +You may have also noticed that the text module has some additional slots on the left. +Those are referenced by placeholders, you can put any item in them. Most placeholders also need a target block to work. To select a target for your monitor group, +in the main UI of the controller select the group, right-click the block you want to target and click "Set target". You may want to target a block that is not in the +central monitor, to do that you have to use a Wireless Transmitter Cover. Place it on the block you want to target and right-click it with a data stick. Then put that +data stick into a data hatch in the Central Monitor multiblock. If you select the data hatch as a target, you will see a new number field appear. Enter the number of the +slot your data stick is in and click "Set target". The target will be set to the block the Wireless Transmitter Cover is on. It can work cross-dimensionally. + +!!! note "For the Computer Monitor Cover, the targeted block is always the block it's placed on." + +### Placeholders +Placeholders can be used by players in the monitor text module, or in the computer monitor cover (though a bit more limited). +For example, a player may write something like this in a text module: +``` +Hello on day {calc {tick} / 20000}! +Current energy buffer: {formatInt {energy}}/{formatInt {energyCapacity}} EU\ +{if {cmp {energy} < 5000000} {color red "\nLOW ENERGY!"}} +Here's some random stuff: +{repeat 5 {repeat {random 2 10} {block}} +``` +And something like this would be displayed: +``` +Hello on day 420! +Current energy buffer: 4.2M/6.9M EU +LOW ENERGY! +Here's some random stuff: +███████ +██ +█████ +████ +██████████ +``` +This system is turing-complete (i.e. if the player really wanted to play Doom on the Central Monitor, they could).
    +All placeholders work on strings (or, more specifically, `Component`s to allow text formatting), so when you write `{calc {calc 2 + 4} * 3}`, +first `{calc 2 + 4}` will be evaluated into `6`, then it will be converted to a string and back to an int, and then it will be passed into the second placeholder +to evaluate `{calc 6 * 3}` into `18`, which will be turned into a string again. That also allows for things like `{calc 3 + 1}2`, which will evaluate into `42`, +since outside of placeholders text is simply concatenated. Placeholder arguments are separated by spaces, which may be a bit annoying, when wanting to pass a string +with a space into a placeholder, for example `{if 1 string with spaces}`, which will cause an error. In these cases, double quotes can be used: `{if 1 "string with spaces"}` +will work perfectly fine. There are placeholders that need reference items, to achieve that, there are 8 slots in the text module's UI on the left. +Items can be inserted/extracted from these slots automatically using the `ender` placeholder by interacting with Ender Item Links.
    + +!!! tip "The full list of placeholders with explanations on what they do and usage examples can be found in-game in the text module or computer monitor UI on the left." \ No newline at end of file diff --git a/docs/content/Modpacks/Other-Topics/Central-Monitor.md b/docs/content/Modpacks/Other-Topics/Central-Monitor.md new file mode 100644 index 00000000000..c199ae1790d --- /dev/null +++ b/docs/content/Modpacks/Other-Topics/Central-Monitor.md @@ -0,0 +1,107 @@ +--- +title: Central Monitor & Placeholder System +--- + +### Custom monitor modules +If you want to add a monitor module, simply attach a component that implements `IMonitorModuleItem` to your `ComponentItem`. +Modules can have a custom UI, can be ticked (in a placeholder or not) and, most importantly, rendered. +??? example "Example of a custom module in Java" + ```java + public class ExampleModuleBehaviour implements IMonitorModuleItem { + @Override + public String getType() { + // can be any string, this is currently only used for CC: Tweaked compat + return "example"; + } + + @Override + public void tick(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { + // this is only called on the logical server + // put all of your module's logic here instead of in getRenderer(stack) + // can also be left completely empty (like in the image module) + } + + @Override + public void tickInPlaceholder(ItemStack stack, PlaceholderContext context) { + // this is also only called on the logical server, but only when a placeholder accesses this module and wants to render it + // this *isn't* called on each tick + // you can even put the same code here as in the tick() method, like the text module does + } + + @Override + public IMonitorRenderer getRenderer(ItemStack stack) { + // this is only called on the logical client + // should return a new instance of the renderer for this module (not null) + // for examples of renderer code look in the GTCEu Modern github: + // https://github.com/GregTechCEu/GregTech-Modern/tree/1.20.1/src/main/java/com/gregtechceu/gtceu/client/renderer + return new MonitorTextRenderer(MultiLineComponent.of("this text is displayed on the monitor"), 1.0); + } + + @Override + public Widget createUIWidget(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { + // should create the UI for your module and return it + // if the module doesn't need a UI just return new WidgetGroup() + return new WidgetGroup(); + } + } + ``` + +!!! info "For info on the placeholder system itself, see [the gameplay wiki page](../../Gameplay/Central-Monitor.md)" + +### Adding custom placeholders + +Placeholders can be added by calling `PlaceholderHandler.addPlaceholder(...)` at any point during runtime (preferably at mod init time). +They can take any number of arguments in the form of a `List`. They also take an instance of `PlaceholderContext` and +must return a `MultiLineComponent`. Placeholders can also render literally anything, not only text, using `MultiLineComponent.addRenderer()`, +`GraphicsComponent` and an `IPlaceholderRenderer` (that has to be registered separately using `PlaceholderHandler.addRenderer(...)`) + +??? example "Example of a `sum` placeholder in Java" + ```java + public class Example { + // you should call this function at mod initialization + public static void addPlaceholders() { + int priority = 1; // by default the priority of all placeholders is 0 (you don't have to specify it) + PlaceholderHandler.addPlaceholder(new Placeholder("sum", priority) { + @Override + public MultiLineComponent apply(PlaceholderContext ctx, List args) throws PlaceholderException { + PlaceholderUtils.checkArgs(args, 2); // check that there are exactly 2 arguments + double a = PlaceholderUtils.toDouble(args.get(0)); + double b = PlaceholderUtils.toDouble(args.get(1)); + return MultiLineComponent.literal(a + b); + } + }); + // you can call addPlaceholder as many times as you need + // if you want to override an existing placeholder, simply add a new one with the same name and a higher or equal priority + } + } + ``` + +!!! tip "Placeholder exceptions" + Any runtime exception that occurs while processing a placeholder will be caught and even displayed to the player. + Instead of relying on runtime exceptions though, you should throw any subclass of `PlaceholderException`, for example + `InvalidNumberException` or `MissingItemException`. All the `PlaceholderUtils` methods throw these, so you should use them + instead of calling `parseDouble` yourself, for example. + +!!! note "Placeholder data" + If your placeholder needs to save any data specific to the placeholder caller, you can use `getData(ctx)` at any point in + a placeholder. It will return a `CompoundTag` that is automatically saved, and you're free to modify it in whatever way you want. + +### Placeholder graphics + +You may have noticed, that some placeholders output graphics instead of text, for example `rect` or `quad`. +To achieve that you have to write your own class that implements `IPlaceholderRenderer`, or use an existing one. +They work similarly to normal renderers, except you can pass a `CompoundTag` into them from your placeholder. +To register one, call `PlaceholderHandler.addRenderer("put_id_here", new YourRendererClassHere())`. +After that, you can reference it from any placeholder by calling `output.addGraphics(new GraphicsComponent(x, y, "put_id_here", renderData)` +on the object that your placeholder will return. `renderData` is the same `CompoundTag` that will be passed into your renderer as an argument. +This is done to avoid calling rendering code on the server side, as all placeholders are processed server-side only. A neat side effect of that +is that all players will (almost always) see the same thing on the monitor. + +!!! warning "Graphics do not work on the Computer Monitor Cover" + +### Placeholder parsing + +You may want to add something that needs to parse a string containing placeholders. To achieve that, you can use +`PlaceholderHandler.processPlaceholders(string, context)`. You can also use `PlaceholderHandler.placeholderExists(name)` +to check if a placeholder exists, or `PlaceholderHandler.getAllPlaceholderNames()` to get all placeholders. +To get a `PlaceholderContext`, you just have to call its constructor (it takes in basic parameters like `Level`, `BlockPos`, etc., most of which can be `null`). \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IMonitorModuleItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IMonitorModuleItem.java index 6bfa55da341..91a12e74343 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IMonitorModuleItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IMonitorModuleItem.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.item.component; +import com.gregtechceu.gtceu.api.placeholder.PlaceholderContext; import com.gregtechceu.gtceu.client.renderer.monitor.IMonitorRenderer; import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; @@ -12,7 +13,9 @@ public interface IMonitorModuleItem extends IItemComponent { default void tick(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) {} - IMonitorRenderer getRenderer(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group); + default void tickInPlaceholder(ItemStack stack, PlaceholderContext context) {} + + IMonitorRenderer getRenderer(ItemStack stack); Widget createUIWidget(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group); diff --git a/src/main/java/com/gregtechceu/gtceu/api/placeholder/GraphicsComponent.java b/src/main/java/com/gregtechceu/gtceu/api/placeholder/GraphicsComponent.java new file mode 100644 index 00000000000..650f2645202 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/placeholder/GraphicsComponent.java @@ -0,0 +1,60 @@ +package com.gregtechceu.gtceu.api.placeholder; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.client.renderer.monitor.IMonitorRenderer; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; + +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +import java.util.function.Supplier; + +public record GraphicsComponent(float x, float y, float x2, float y2, String rendererId, CompoundTag renderData) + implements Supplier { + + public GraphicsComponent(double x, double y, double x2, double y2, String rendererId, CompoundTag renderData) { + this((float) x, (float) y, (float) x2, (float) y2, rendererId, renderData); + } + + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.FLOAT.fieldOf("x").forGetter(GraphicsComponent::x), + Codec.FLOAT.fieldOf("y").forGetter(GraphicsComponent::y), + Codec.FLOAT.fieldOf("x2").forGetter(GraphicsComponent::x2), + Codec.FLOAT.fieldOf("y2").forGetter(GraphicsComponent::y2), + Codec.STRING.fieldOf("rendererId").forGetter(GraphicsComponent::rendererId), + CompoundTag.CODEC.fieldOf("renderData").forGetter(GraphicsComponent::renderData)) + .apply(instance, GraphicsComponent::new)); + + @Override + public IMonitorRenderer get() { + return new IMonitorRenderer() { + + private final IMonitorRenderer renderer = PlaceholderHandler.getRenderer(rendererId, renderData); + + @Override + public void render(CentralMonitorMachine machine, MonitorGroup group, float partialTick, + PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { + poseStack.pushPose(); + poseStack.translate(x, y, 0); + assert this.renderer != null; + this.renderer.render(machine, group, partialTick, poseStack, buffer, packedLight, packedOverlay); + poseStack.popPose(); + } + }; + } + + public Tag toTag() { + return CODEC.encodeStart(NbtOps.INSTANCE, this).getOrThrow(false, GTCEu.LOGGER::error); + } + + public static GraphicsComponent fromTag(Tag tag) { + return CODEC.decode(NbtOps.INSTANCE, tag).getOrThrow(false, GTCEu.LOGGER::error).getFirst(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/placeholder/IPlaceholderRenderer.java b/src/main/java/com/gregtechceu/gtceu/api/placeholder/IPlaceholderRenderer.java new file mode 100644 index 00000000000..5d55415ee85 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/placeholder/IPlaceholderRenderer.java @@ -0,0 +1,15 @@ +package com.gregtechceu.gtceu.api.placeholder; + +import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; + +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.nbt.CompoundTag; + +import com.mojang.blaze3d.vertex.PoseStack; + +public interface IPlaceholderRenderer { + + void render(CentralMonitorMachine machine, MonitorGroup group, float partialTick, PoseStack poseStack, + MultiBufferSource buffer, int packedLight, int packedOverlay, CompoundTag tag); +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/placeholder/MultiLineComponent.java b/src/main/java/com/gregtechceu/gtceu/api/placeholder/MultiLineComponent.java index 0889644579b..ac19946fe1b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/placeholder/MultiLineComponent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/placeholder/MultiLineComponent.java @@ -3,23 +3,32 @@ import com.gregtechceu.gtceu.utils.GTUtil; import net.minecraft.ChatFormatting; +import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.*; import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Objects; +@Accessors(chain = true) public class MultiLineComponent extends ArrayList { @Getter + @Setter private boolean ignoreSpaces = false; + @Getter + private final List graphics = new ArrayList<>(); + public MultiLineComponent(List components) { super(); this.addAll(components); @@ -79,7 +88,10 @@ public double toDouble() { public int toInt() { if (this.isEmpty()) return 0; if (this.size() > 1) throw new NumberFormatException(this.toString()); - return Integer.parseInt(this.get(0).getString()); + String s = this.get(0).getString(); + if (s.startsWith("0x")) return Integer.parseInt(s.substring(2), 16); + if (s.startsWith("0b")) return Integer.parseInt(s.substring(2), 2); + return Integer.parseInt(s); } public void append(@Nullable String s) { @@ -102,6 +114,12 @@ public MultiLineComponent append(@Nullable List lines) { return this; } + public MultiLineComponent append(MultiLineComponent multiLineComponent) { + if (multiLineComponent == null) return this; + this.graphics.addAll(multiLineComponent.getGraphics()); + return this.append(multiLineComponent.toImmutable()); + } + public void appendNewline() { this.add(MutableComponent.create(ComponentContents.EMPTY)); } @@ -131,18 +149,33 @@ public List toImmutable() { } public Tag toTag() { + CompoundTag compoundTag = new CompoundTag(); ListTag tag = new ListTag(); for (MutableComponent component : this) { tag.add(StringTag.valueOf(Component.Serializer.toJson(component))); } - return tag; + compoundTag.put("text", tag); + ListTag graphicsTag = new ListTag(); + for (GraphicsComponent component : this.getGraphics()) { + graphicsTag.add(component.toTag()); + } + compoundTag.put("graphics", graphicsTag); + return compoundTag; } - public static MultiLineComponent fromTag(ListTag tag) { + public static MultiLineComponent fromTag(@Nullable Tag tag) { MultiLineComponent out = MultiLineComponent.empty(); out.clear(); - for (Tag i : tag) { - out.add(Component.Serializer.fromJson(i.getAsString())); + if (tag == null) return out; + if (tag instanceof ListTag listTag) { + for (Tag i : listTag) { + out.add(Component.Serializer.fromJson(i.getAsString())); + } + } else if (tag instanceof CompoundTag compoundTag) { + ListTag textTag = compoundTag.getList("text", Tag.TAG_STRING); + for (Tag i : textTag) out.add(Component.Serializer.fromJson(i.getAsString())); + ListTag graphicsTag = compoundTag.getList("graphics", Tag.TAG_COMPOUND); + for (Tag i : graphicsTag) out.addGraphics(GraphicsComponent.fromTag(i)); } return out; } @@ -150,11 +183,18 @@ public static MultiLineComponent fromTag(ListTag tag) { public long toLong() { if (this.isEmpty()) return 0; if (this.size() > 1) throw new NumberFormatException(this.toString()); - return Long.parseLong(this.get(0).getString()); + String s = this.get(0).getString(); + if (s.startsWith("0b")) return Long.parseLong(s.substring(2), 2); + if (s.startsWith("0x")) return Long.parseLong(s.substring(2), 16); + return Long.parseLong(s); + } + + public MultiLineComponent addGraphics(GraphicsComponent... graphicsComponents) { + return this.addGraphics(List.of(graphicsComponents)); } - public MultiLineComponent setIgnoreSpaces(boolean ignoreSpaces) { - this.ignoreSpaces = ignoreSpaces; + public MultiLineComponent addGraphics(Collection graphicsComponents) { + this.graphics.addAll(graphicsComponents); return this; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderContext.java b/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderContext.java index 9e55e356f85..223692a7b6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderContext.java +++ b/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderContext.java @@ -7,6 +7,7 @@ import net.minecraft.world.level.Level; import net.minecraftforge.items.ItemStackHandler; +import lombok.With; import org.jetbrains.annotations.Nullable; import java.util.UUID; @@ -17,4 +18,16 @@ public record PlaceholderContext(Level level, @Nullable ItemStackHandler itemStackHandler, @Nullable CoverBehavior cover, @Nullable MultiLineComponent previousText, - UUID uuid) {} + UUID uuid, + @With int index) { + + public PlaceholderContext(Level level, + BlockPos pos, + Direction side, + @Nullable ItemStackHandler itemStackHandler, + @Nullable CoverBehavior cover, + @Nullable MultiLineComponent previousText, + UUID uuid) { + this(level, pos, side, itemStackHandler, cover, previousText, uuid, 0); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderHandler.java b/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderHandler.java index 86edbd0bd77..00a80df2825 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderHandler.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.placeholder.exceptions.UnclosedBracketException; import com.gregtechceu.gtceu.api.placeholder.exceptions.UnexpectedBracketException; import com.gregtechceu.gtceu.api.placeholder.exceptions.UnknownPlaceholderException; +import com.gregtechceu.gtceu.client.renderer.monitor.IMonitorRenderer; import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.GTStringUtils; import com.gregtechceu.gtceu.utils.GTUtil; @@ -14,16 +15,20 @@ import com.lowdragmc.lowdraglib.gui.widget.TextTextureWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import com.lowdragmc.lowdraglib.gui.widget.codeeditor.language.LanguageDefinition; -import com.lowdragmc.lowdraglib.gui.widget.codeeditor.language.TokenTypes; import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.MutableComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import java.util.*; import java.util.function.Consumer; +import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault @@ -40,18 +45,11 @@ public class PlaceholderHandler { private static final Map placeholders = new HashMap<>(); - public static final LanguageDefinition LANG_DEFINITION = new LanguageDefinition( - "Placeholders", - List.of( - TokenTypes.KEYWORD.createTokenType(PlaceholderHandler.getAllPlaceholderNames().stream().toList()), - TokenTypes.IDENTIFIER, - TokenTypes.STRING, - TokenTypes.COMMENT, - TokenTypes.NUMBER, - TokenTypes.OPERATOR, - TokenTypes.WHITESPACE, - TokenTypes.OTHER), - Set.of()); + @OnlyIn(Dist.CLIENT) + private static final class RendererHolder { + + public static final Map renderers = new HashMap<>(); + } public static void addPlaceholder(Placeholder placeholder) { if (placeholders.containsKey(placeholder.getName())) { @@ -65,11 +63,35 @@ public static boolean placeholderExists(MultiLineComponent placeholder) { return placeholders.containsKey(placeholder.toString()); } + @OnlyIn(Dist.CLIENT) + public static void addRenderer(String id, IPlaceholderRenderer renderer) { + RendererHolder.renderers.put(id, renderer); + } + + @OnlyIn(Dist.CLIENT) + public static @Nullable IMonitorRenderer getRenderer(String id, CompoundTag renderData) { + if (!RendererHolder.renderers.containsKey(id)) { + GTCEu.LOGGER.warn("Attempt to access a placeholder renderer that doesn't exist ({})", id); + return null; + } + IPlaceholderRenderer renderer = RendererHolder.renderers.get(id); + CompoundTag tag = renderData.copy(); + return (machine, group, + partialTick, poseStack, buffer, + packedLight, packedOverlay) -> renderer.render( + machine, group, + partialTick, poseStack, buffer, + packedLight, packedOverlay, tag); + } + public static MultiLineComponent processPlaceholder(List placeholder, - PlaceholderContext context) throws PlaceholderException { + PlaceholderContext context, + Object2IntOpenHashMap indices) throws PlaceholderException { if (!placeholderExists(placeholder.get(0))) throw new UnknownPlaceholderException(placeholder.get(0).toString()); - return placeholders.get(placeholder.get(0).toString()).apply(context, + String name = placeholder.get(0).toString(); + indices.addTo(name, 1); + return placeholders.get(name).apply(context.withIndex(indices.getInt(name)), placeholder.subList(1, placeholder.size())); } @@ -77,6 +99,7 @@ public static MultiLineComponent processPlaceholders(String s, PlaceholderContex if (ctx.level().isClientSide) GTCEu.LOGGER.warn("Placeholder processing is running on client instead of server!"); List exceptions = new ArrayList<>(); + Object2IntOpenHashMap indices = new Object2IntOpenHashMap<>(); boolean escape = false; boolean escapeNext = false; boolean literalEscape = false; @@ -110,7 +133,7 @@ public static MultiLineComponent processPlaceholders(String s, PlaceholderContex case PLACEHOLDER_END -> { List placeholder = stack.pop(); if (stack.isEmpty()) throw new UnexpectedBracketException(); - MultiLineComponent result = processPlaceholder(placeholder, ctx); + MultiLineComponent result = processPlaceholder(placeholder, ctx, indices); if (result.isIgnoreSpaces() || stack.size() == 1) { GTUtil.getLast(stack.peek()).append(result); } else { @@ -155,7 +178,8 @@ public static MultiLineComponent processPlaceholders(String s, PlaceholderContex } if (exceptions.isEmpty()) return stack.peek().stream().reduce(MultiLineComponent.empty(), MultiLineComponent::append); - MultiLineComponent out = MultiLineComponent.empty(); + MultiLineComponent out = MultiLineComponent.literal("Exceptions:"); + out.appendNewline(); exceptions.forEach(exception -> { out.append(exception.getMessage()); out.appendNewline(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderUtils.java b/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderUtils.java index eeb8f00cff3..31cb62f1881 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/api/placeholder/PlaceholderUtils.java @@ -29,6 +29,10 @@ public static double toDouble(MultiLineComponent component) throws InvalidNumber } } + public static float toFloat(MultiLineComponent component) throws InvalidNumberException { + return (float) toDouble(component); + } + public static void checkArgs(List args, int args_num) throws WrongNumberOfArgsException { if (args.size() != args_num) throw new WrongNumberOfArgsException(args_num, args.size()); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRenderTypes.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRenderTypes.java index c36a41a91e6..ce3fea89a5d 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRenderTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRenderTypes.java @@ -22,6 +22,13 @@ public class GTRenderTypes extends RenderType { .setShaderState(RenderStateShard.POSITION_COLOR_SHADER) .setTransparencyState(RenderStateShard.TRANSLUCENT_TRANSPARENCY) .createCompositeState(false)); + private static final RenderType MONITOR = RenderType.create("central_monitor", + DefaultVertexFormat.POSITION_COLOR, VertexFormat.Mode.QUADS, 256, false, false, + RenderType.CompositeState.builder() + .setCullState(NO_CULL) + .setShaderState(POSITION_COLOR_SHADER) + .setTransparencyState(TRANSLUCENT_TRANSPARENCY) + .createCompositeState(false)); private static final Function GUI_TEXTURE = Util.memoize((texture) -> { return create("gui_texture", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP, VertexFormat.Mode.QUADS, RenderType.TRANSIENT_BUFFER_SIZE, false, true, @@ -42,6 +49,10 @@ public static RenderType getLightRing() { return LIGHT_RING; } + public static RenderType getMonitor() { + return MONITOR; + } + public static RenderType guiTexture(ResourceLocation texture) { return GUI_TEXTURE.apply(texture); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/CentralMonitorRender.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/CentralMonitorRender.java index 8ce0183cafc..468f1efb3ed 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/CentralMonitorRender.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/CentralMonitorRender.java @@ -54,7 +54,7 @@ public void render(CentralMonitorMachine machine, float partialTick, PoseStack p continue; } poseStack.pushPose(); - module.getRenderer(group.getItemStackHandler().getStackInSlot(0), machine, group) + module.getRenderer(group.getItemStackHandler().getStackInSlot(0)) .render(machine, group, partialTick, poseStack, buffer, packedLight, packedOverlay); poseStack.popPose(); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/monitor/MonitorTextRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/monitor/MonitorTextRenderer.java index 029a85b5223..01865761749 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/monitor/MonitorTextRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/monitor/MonitorTextRenderer.java @@ -1,5 +1,7 @@ package com.gregtechceu.gtceu.client.renderer.monitor; +import com.gregtechceu.gtceu.api.placeholder.GraphicsComponent; +import com.gregtechceu.gtceu.api.placeholder.MultiLineComponent; import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; @@ -10,18 +12,17 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; +import net.minecraft.util.Mth; import com.mojang.blaze3d.vertex.PoseStack; -import java.util.List; - public class MonitorTextRenderer implements IMonitorRenderer { private static final float TEXT_SCALE = 1 / 144f; - private final List text; + private final MultiLineComponent text; private final float scale; - public MonitorTextRenderer(List text, double scale) { + public MonitorTextRenderer(MultiLineComponent text, double scale) { this.text = text; this.scale = (float) scale; } @@ -34,6 +35,23 @@ public void render(CentralMonitorMachine machine, MonitorGroup group, float part int row = 0; int columns = group.getRow(0, machine::toRelative).size(); poseStack.translate(rel.getX(), rel.getY(), rel.getZ()); + int layer = 0; + for (GraphicsComponent graphics : text.getGraphics()) { + if (graphics.x() < 0 || graphics.y() < 0) continue; + float maxX = graphics.x2(); + float maxY = graphics.y2(); + if (maxX == Math.floor(maxX)) maxX--; + if (maxY == Math.floor(maxY)) maxY--; + BlockPos relativePos = rel.offset(Mth.floor(maxX), -Mth.floor(maxY), 0); + if (!group.getMonitorPositions().stream().map(machine::toRelative).toList().contains(relativePos)) + continue; + poseStack.pushPose(); + poseStack.translate(graphics.x(), graphics.y(), layer * .001f); + graphics.get().render(machine, group, partialTick, poseStack, buffer, packedLight, packedOverlay); + poseStack.popPose(); + layer++; + } + poseStack.translate(0, 0, layer * .001f); poseStack.scale(TEXT_SCALE * scale, TEXT_SCALE * scale, TEXT_SCALE * scale); float y = 9; for (Component s : text) { diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/ModulePlaceholderRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/ModulePlaceholderRenderer.java new file mode 100644 index 00000000000..1df2c9ef08f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/ModulePlaceholderRenderer.java @@ -0,0 +1,31 @@ +package com.gregtechceu.gtceu.client.renderer.placeholder; + +import com.gregtechceu.gtceu.api.item.IComponentItem; +import com.gregtechceu.gtceu.api.item.component.IItemComponent; +import com.gregtechceu.gtceu.api.item.component.IMonitorModuleItem; +import com.gregtechceu.gtceu.api.placeholder.IPlaceholderRenderer; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; + +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.ItemStack; + +import com.mojang.blaze3d.vertex.PoseStack; + +public class ModulePlaceholderRenderer implements IPlaceholderRenderer { + + @Override + public void render(CentralMonitorMachine machine, MonitorGroup group, float partialTick, PoseStack poseStack, + MultiBufferSource buffer, int packedLight, int packedOverlay, CompoundTag tag) { + ItemStack stack = ItemStack.of(tag); + if (stack.getItem() instanceof IComponentItem componentItem) { + for (IItemComponent component : componentItem.getComponents()) { + if (component instanceof IMonitorModuleItem module) { + module.getRenderer(stack).render(machine, group, partialTick, poseStack, buffer, packedLight, + packedOverlay); + } + } + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/QuadPlaceholderRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/QuadPlaceholderRenderer.java new file mode 100644 index 00000000000..2d347e1d960 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/QuadPlaceholderRenderer.java @@ -0,0 +1,35 @@ +package com.gregtechceu.gtceu.client.renderer.placeholder; + +import com.gregtechceu.gtceu.api.placeholder.IPlaceholderRenderer; +import com.gregtechceu.gtceu.client.renderer.GTRenderTypes; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; + +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.nbt.CompoundTag; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import org.joml.Matrix4f; + +public class QuadPlaceholderRenderer implements IPlaceholderRenderer { + + @Override + public void render(CentralMonitorMachine machine, MonitorGroup group, float partialTick, PoseStack poseStack, + MultiBufferSource buffer, int packedLight, int packedOverlay, CompoundTag tag) { + poseStack.pushPose(); + VertexConsumer consumer = buffer.getBuffer(GTRenderTypes.getMonitor()); + Matrix4f pose = poseStack.last().pose(); + + consumer.vertex(pose, tag.getFloat("x1"), tag.getFloat("y1"), 0).color(tag.getInt("color1")) + .uv2(LightTexture.FULL_BRIGHT).endVertex(); + consumer.vertex(pose, tag.getFloat("x2"), tag.getFloat("y2"), 0).color(tag.getInt("color2")) + .uv2(LightTexture.FULL_BRIGHT).endVertex(); + consumer.vertex(pose, tag.getFloat("x3"), tag.getFloat("y3"), 0).color(tag.getInt("color3")) + .uv2(LightTexture.FULL_BRIGHT).endVertex(); + consumer.vertex(pose, tag.getFloat("x4"), tag.getFloat("y4"), 0).color(tag.getInt("color4")) + .uv2(LightTexture.FULL_BRIGHT).endVertex(); + poseStack.popPose(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/RectPlaceholderRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/RectPlaceholderRenderer.java new file mode 100644 index 00000000000..1e2c5dbff8b --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/placeholder/RectPlaceholderRenderer.java @@ -0,0 +1,34 @@ +package com.gregtechceu.gtceu.client.renderer.placeholder; + +import com.gregtechceu.gtceu.api.placeholder.IPlaceholderRenderer; +import com.gregtechceu.gtceu.client.renderer.GTRenderTypes; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.CentralMonitorMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.electric.monitor.MonitorGroup; + +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.nbt.CompoundTag; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import org.joml.Matrix4f; + +public class RectPlaceholderRenderer implements IPlaceholderRenderer { + + @Override + public void render(CentralMonitorMachine machine, MonitorGroup group, float partialTick, PoseStack poseStack, + MultiBufferSource buffer, int packedLight, int packedOverlay, CompoundTag tag) { + poseStack.pushPose(); + VertexConsumer consumer = buffer.getBuffer(GTRenderTypes.getMonitor()); + Matrix4f pose = poseStack.last().pose(); + float minX = 0, maxX = tag.getFloat("width"); + float minY = 0, maxY = tag.getFloat("height"); + int color = tag.getInt("color"); + + consumer.vertex(pose, minX, maxY, 0).color(color).uv2(LightTexture.FULL_BRIGHT).endVertex(); + consumer.vertex(pose, maxX, maxY, 0).color(color).uv2(LightTexture.FULL_BRIGHT).endVertex(); + consumer.vertex(pose, maxX, minY, 0).color(color).uv2(LightTexture.FULL_BRIGHT).endVertex(); + consumer.vertex(pose, minX, minY, 0).color(color).uv2(LightTexture.FULL_BRIGHT).endVertex(); + poseStack.popPose(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java index 78df4b96671..1392bd7ebc8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlaceholders.java @@ -7,8 +7,10 @@ import com.gregtechceu.gtceu.api.capability.IWorkable; import com.gregtechceu.gtceu.api.cover.filter.ItemFilter; import com.gregtechceu.gtceu.api.item.ComponentItem; +import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.component.IDataItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; +import com.gregtechceu.gtceu.api.item.component.IMonitorModuleItem; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; @@ -16,8 +18,13 @@ import com.gregtechceu.gtceu.api.misc.virtualregistry.VirtualEnderRegistry; import com.gregtechceu.gtceu.api.placeholder.*; import com.gregtechceu.gtceu.api.placeholder.exceptions.*; +import com.gregtechceu.gtceu.client.renderer.placeholder.ModulePlaceholderRenderer; +import com.gregtechceu.gtceu.client.renderer.placeholder.QuadPlaceholderRenderer; +import com.gregtechceu.gtceu.client.renderer.placeholder.RectPlaceholderRenderer; import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; +import com.gregtechceu.gtceu.common.item.modules.ImageModuleBehaviour; import com.gregtechceu.gtceu.common.machine.multiblock.part.monitor.AdvancedMonitorPartMachine; +import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.GTStringUtils; import com.gregtechceu.gtceu.utils.GTTransferUtils; @@ -38,8 +45,11 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.registries.ForgeRegistries; @@ -85,6 +95,7 @@ public static int countItems(@Nullable ItemFilter filter, @Nullable IItemHandler } public static void initPlaceholders() { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> GTPlaceholders::initRenderers); PlaceholderHandler.addPlaceholder(new Placeholder("energy") { @Override @@ -135,10 +146,10 @@ public MultiLineComponent apply(PlaceholderContext ctx, .literal(countItems(GTStringUtils.componentsToString(args.get(0)), itemHandler)); if (GTStringUtils.equals(args.get(0), "filter")) { int slot = PlaceholderUtils.toInt(args.get(1)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); + if (ctx.itemStackHandler() == null) + throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); try { - if (ctx.itemStackHandler() == null) - throw new NotSupportedException(); return MultiLineComponent.literal(countItems( ItemFilter.loadFilter(ctx.itemStackHandler().getStackInSlot(slot - 1)), itemHandler)); } catch (NullPointerException e) { @@ -258,9 +269,7 @@ public MultiLineComponent apply(PlaceholderContext ctx, public MultiLineComponent apply(PlaceholderContext ctx, List args) throws PlaceholderException { PlaceholderUtils.checkArgs(args, 0); - if (ctx.cover() instanceof IPlaceholderInfoProviderCover cover) - return MultiLineComponent.literal(cover.getTicksSincePlaced()); - throw new NotSupportedException(); + return MultiLineComponent.literal(ctx.level().getGameTime()); } }); PlaceholderHandler.addPlaceholder(new Placeholder("select") { @@ -402,8 +411,8 @@ public MultiLineComponent apply(PlaceholderContext ctx, PlaceholderUtils.checkArgs(args, 2, true); try { int slot = PlaceholderUtils.toInt(args.get(1)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); if (ctx.itemStackHandler() == null) throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot - 1); int capacity = -1; if (stack.getItem() instanceof ComponentItem componentItem) { @@ -464,8 +473,8 @@ public MultiLineComponent apply(PlaceholderContext ctx, List args) throws PlaceholderException { PlaceholderUtils.checkArgs(args, 1, true); int slot = GTStringUtils.toInt(args.get(0)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); if (ctx.itemStackHandler() == null) throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); Tag tag = ctx.itemStackHandler().getStackInSlot(slot - 1).getOrCreateTag(); for (int i = 1; i < args.size() - 1; i++) { if (!(tag instanceof CompoundTag compoundTag)) return MultiLineComponent.empty(); @@ -549,8 +558,8 @@ public MultiLineComponent apply(PlaceholderContext ctx, List args) throws PlaceholderException { PlaceholderUtils.checkArgs(args, 2); int slot = PlaceholderUtils.toInt(args.get(0)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); if (ctx.itemStackHandler() == null) throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot - 1); int capacity = -1; if (stack.getItem() instanceof ComponentItem componentItem) { @@ -562,6 +571,9 @@ public MultiLineComponent apply(PlaceholderContext ctx, } } if (capacity == -1) throw new MissingItemException("any data item", slot); + if (!stack.getOrCreateTag().contains("computer_monitor_cover_data")) { + stack.getOrCreateTag().put("computer_monitor_cover_data", new ListTag()); + } ListTag tag = stack.getOrCreateTag().getList("computer_monitor_cover_data", Tag.TAG_STRING); int operationsLeft = 5000; int p = 0, start = 0, cnt = 0; @@ -589,19 +601,27 @@ public MultiLineComponent apply(PlaceholderContext ctx, if (cur != null) codeBuilder.append(cnt).append(cur); String code = codeBuilder.toString(); Stack loops = new Stack<>(); - if (!getData(ctx).getBoolean("completed")) { - p = getData(ctx).getInt("pointer"); - start = getData(ctx).getInt("index"); + if (!getData(ctx).contains(String.valueOf(ctx.index()))) { + getData(ctx).put(String.valueOf(ctx.index()), new CompoundTag()); } - getData(ctx).putBoolean("completed", true); + CompoundTag data = getData(ctx).getCompound(String.valueOf(ctx.index())); int num = 0; + if (!data.getBoolean("completed")) { + p = data.getInt("pointer"); + start = data.getInt("index"); + num = data.getInt("num"); + } + data.putBoolean("completed", true); for (int i = start; i < code.length(); i++) { if (operationsLeft <= 0) { - getData(ctx).putBoolean("completed", false); - getData(ctx).putInt("pointer", p); - getData(ctx).putInt("index", i); + data.putBoolean("completed", false); + data.putInt("pointer", p); + data.putInt("index", i); + data.putInt("num", num); break; } + if (p > capacity) p = p % capacity; + if (p < 0) p = (capacity - ((-p) % capacity)) % capacity; while (tag.size() <= p) tag.add(StringTag.valueOf("0")); if (tag.getString(p).isEmpty()) tag.set(i, StringTag.valueOf("0")); switch (code.charAt(i)) { @@ -617,7 +637,7 @@ public MultiLineComponent apply(PlaceholderContext ctx, case '[' -> loops.push(i); case ']' -> { if (Integer.parseInt(tag.getString(p)) == 0) loops.pop(); - else i = loops.peek(); + else i = loops.peek() + 1; } } if (Character.isDigit(code.charAt(i))) { @@ -636,7 +656,7 @@ public MultiLineComponent apply(PlaceholderContext ctx, PlaceholderUtils.checkArgs(args, 2); if (ctx.itemStackHandler() == null) throw new NotSupportedException(); int slot = PlaceholderUtils.toInt(args.get(0)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot - 1); if (!stack.getOrCreateTag().contains("boundPlayerPermLevel")) throw new MissingItemException("any data item bound to player", slot); @@ -745,7 +765,7 @@ public MultiLineComponent apply(PlaceholderContext ctx, if (args.size() > 2 && !args.get(2).toString().isEmpty()) { if (ctx.itemStackHandler() == null) throw new NotSupportedException(); int slot = PlaceholderUtils.toInt(args.get(2)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot - 1); if (stack.getOrCreateTag().contains("boundPlayerUUID")) owner = UUID.fromString(stack.getOrCreateTag().getString("boundPlayerUUID")); @@ -759,7 +779,7 @@ public MultiLineComponent apply(PlaceholderContext ctx, if (args.size() > 4) { if (ctx.itemStackHandler() == null) throw new NotSupportedException(); int slot = PlaceholderUtils.toInt(args.get(3)); - PlaceholderUtils.checkRange("slot index", 1, 8, slot); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot - 1); UUID uuid; if (stack.getOrCreateTag().contains("enderRedstoneLinkTransmitterUUID")) { @@ -833,6 +853,127 @@ public MultiLineComponent apply(PlaceholderContext ctx, return PlaceholderHandler.processPlaceholders(args.get(0).toString(), ctx); } }); + PlaceholderHandler.addPlaceholder(new Placeholder("module") { + + @Override + public MultiLineComponent apply(PlaceholderContext ctx, + List args) throws PlaceholderException { + PlaceholderUtils.checkArgs(args, 3); + int slot = PlaceholderUtils.toInt(args.get(0)); + double x = PlaceholderUtils.toDouble(args.get(1)); + double y = PlaceholderUtils.toDouble(args.get(2)); + if (ctx.itemStackHandler() == null) throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); + ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot); + if (stack.getItem() instanceof IComponentItem componentItem) { + for (IItemComponent component : componentItem.getComponents()) { + if (component instanceof IMonitorModuleItem module) module.tickInPlaceholder(stack, ctx); + } + } + return MultiLineComponent.empty().addGraphics(new GraphicsComponent( + x, y, x, y, + "module", + stack.serializeNBT())); + } + }); + PlaceholderHandler.addPlaceholder(new Placeholder("setImage") { + + @Override + public MultiLineComponent apply(PlaceholderContext ctx, + List args) throws PlaceholderException { + PlaceholderUtils.checkArgs(args, 2); + int slot = PlaceholderUtils.toInt(args.get(0)); + String url = args.get(1).toString(); + if (ctx.itemStackHandler() == null) throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); + ItemStack stack = ctx.itemStackHandler().getStackInSlot(slot); + if (stack.getItem() instanceof IComponentItem componentItem) { + for (IItemComponent component : componentItem.getComponents()) { + if (component instanceof ImageModuleBehaviour module) { + module.setUrl(stack, url); + } + } + } + return MultiLineComponent.empty(); + } + }); + PlaceholderHandler.addPlaceholder(new Placeholder("rect") { + + @Override + public MultiLineComponent apply(PlaceholderContext ctx, + List args) throws PlaceholderException { + PlaceholderUtils.checkArgs(args, 5); + double x = PlaceholderUtils.toDouble(args.get(0)); + double y = PlaceholderUtils.toDouble(args.get(1)); + double width = PlaceholderUtils.toDouble(args.get(2)); + double height = PlaceholderUtils.toDouble(args.get(3)); + if (x < 0) x = 0; + if (y < 0) y = 0; + CompoundTag renderData = new CompoundTag(); + renderData.putDouble("x", x); + renderData.putDouble("y", y); + renderData.putDouble("width", width); + renderData.putDouble("height", height); + renderData.putInt("color", 0xFF000000 | PlaceholderUtils.toInt(args.get(4))); + return MultiLineComponent.empty().addGraphics(new GraphicsComponent( + x, y, x + width, y + height, + "rect", + renderData)); + } + }); + PlaceholderHandler.addPlaceholder(new Placeholder("quad") { + + @Override + public MultiLineComponent apply(PlaceholderContext ctx, + List args) throws PlaceholderException { + PlaceholderUtils.checkArgs(args, 12); + CompoundTag renderData = new CompoundTag(); + float x1 = PlaceholderUtils.toFloat(args.get(0)); + float y1 = PlaceholderUtils.toFloat(args.get(1)); + float x2 = PlaceholderUtils.toFloat(args.get(2)); + float y2 = PlaceholderUtils.toFloat(args.get(3)); + float x3 = PlaceholderUtils.toFloat(args.get(4)); + float y3 = PlaceholderUtils.toFloat(args.get(5)); + float x4 = PlaceholderUtils.toFloat(args.get(6)); + float y4 = PlaceholderUtils.toFloat(args.get(7)); + renderData.putFloat("x1", 0); + renderData.putFloat("y1", 0); + renderData.putFloat("x2", x2 - x1); + renderData.putFloat("y2", y2 - y1); + renderData.putFloat("x3", x3 - x1); + renderData.putFloat("y3", y3 - y1); + renderData.putFloat("x4", x4 - x1); + renderData.putFloat("y4", y4 - y1); + renderData.putInt("color1", 0xFF000000 + PlaceholderUtils.toInt(args.get(8))); + renderData.putInt("color2", 0xFF000000 + PlaceholderUtils.toInt(args.get(9))); + renderData.putInt("color3", 0xFF000000 + PlaceholderUtils.toInt(args.get(10))); + renderData.putInt("color4", 0xFF000000 + PlaceholderUtils.toInt(args.get(11))); + return MultiLineComponent.empty().addGraphics(new GraphicsComponent( + GTMath.min(x1, x2, x3, x4), GTMath.min(y1, y2, y3, y4), GTMath.max(x1, x2, x3, x4), + GTMath.max(y1, y2, y3, y4), + "quad", + renderData)); + } + }); + PlaceholderHandler.addPlaceholder(new Placeholder("item") { + + @Override + public MultiLineComponent apply(PlaceholderContext ctx, + List args) throws PlaceholderException { + PlaceholderUtils.checkArgs(args, 1); + int slot = PlaceholderUtils.toInt(args.get(0)); + if (ctx.itemStackHandler() == null) throw new NotSupportedException(); + PlaceholderUtils.checkRange("slot index", 1, ctx.itemStackHandler().getSlots(), slot); + return MultiLineComponent.literal(ctx.itemStackHandler().getStackInSlot(slot - 1).toString()); + } + }); + } + + @OnlyIn(Dist.CLIENT) + public static void initRenderers() { + PlaceholderHandler.addRenderer("module", new ModulePlaceholderRenderer()); + PlaceholderHandler.addRenderer("rect", new RectPlaceholderRenderer()); + PlaceholderHandler.addRenderer("quad", new QuadPlaceholderRenderer()); PlaceholderHandler.addPlaceholder(new Placeholder("blockNbt") { @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/modules/ImageModuleBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/modules/ImageModuleBehaviour.java index fd560be54a5..b21ee3a4750 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/modules/ImageModuleBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/modules/ImageModuleBehaviour.java @@ -19,7 +19,7 @@ public class ImageModuleBehaviour implements IMonitorModuleItem { @Override - public IMonitorRenderer getRenderer(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { + public IMonitorRenderer getRenderer(ItemStack stack) { return new MonitorImageRenderer(getUrl(stack)); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java index d745051fe54..d6762ab6b3f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java @@ -39,32 +39,42 @@ public class TextModuleBehaviour implements IMonitorModuleItem, IAddInformation { - private void updateText(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { + private void updateText(ItemStack stack, PlaceholderContext ctx) { if (!stack.getOrCreateTag().contains("placeholderUUID")) { stack.getOrCreateTag().putUUID("placeholderUUID", UUID.randomUUID()); } MultiLineComponent text = PlaceholderHandler.processPlaceholders( getPlaceholderText(stack), - new PlaceholderContext( - group.getTargetLevel(machine.getLevel()), - group.getTarget(machine.getLevel()), - group.getTargetCoverSide(), - group.getPlaceholderSlotsHandler(), - group.getTargetCover(machine.getLevel()), - null, - stack.getOrCreateTag().getUUID("placeholderUUID"))); + ctx); stack.getOrCreateTag().put("text", text.toTag()); } + private PlaceholderContext makeContext(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { + return new PlaceholderContext( + group.getTargetLevel(machine.getLevel()), + group.getTarget(machine.getLevel()), + group.getTargetCoverSide(), + group.getPlaceholderSlotsHandler(), + group.getTargetCover(machine.getLevel()), + null, + stack.getOrCreateTag().contains("placeholderUUID") ? stack.getOrCreateTag().getUUID("placeholderUUID") : + null); + } + @Override public void tick(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { - this.updateText(stack, machine, group); + this.updateText(stack, makeContext(stack, machine, group)); + } + + @Override + public void tickInPlaceholder(ItemStack stack, PlaceholderContext context) { + this.updateText(stack, context); } @Override - public IMonitorRenderer getRenderer(ItemStack stack, CentralMonitorMachine machine, MonitorGroup group) { + public IMonitorRenderer getRenderer(ItemStack stack) { return new MonitorTextRenderer( - getText(stack).toImmutable(), + getText(stack), Math.max(getScale(stack), .0001)); } @@ -123,7 +133,7 @@ public String getType() { } public MultiLineComponent getText(ItemStack stack) { - return MultiLineComponent.fromTag(stack.getOrCreateTag().getList("text", Tag.TAG_STRING)); + return MultiLineComponent.fromTag(stack.getOrCreateTag().get("text")); } public double getScale(ItemStack stack) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java index a16b7198b46..2c579be5fcb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java @@ -409,7 +409,7 @@ public Widget createUIWidget() { text.setType(TextTexture.TextType.LEFT); label.setButtonTexture(text); label.setOnPressCallback(click -> { - group.getRelativePositions().forEach(pos -> { + group.getMonitorPositions().forEach(pos -> { BlockPos rel = toRelative(pos); if (imageButtons.size() - 1 < rel.getY()) return; if (imageButtons.get(rel.getY()).size() - 1 < rel.getX()) return; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/monitor/MonitorGroup.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/monitor/MonitorGroup.java index c2e0c35dafe..2977aca420f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/monitor/MonitorGroup.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/monitor/MonitorGroup.java @@ -30,6 +30,7 @@ public class MonitorGroup { + @Getter private final Set monitorPositions = new HashSet<>(); @Getter private final String name; @@ -105,10 +106,6 @@ public boolean isEmpty() { return monitorPositions.isEmpty(); } - public Set getRelativePositions() { - return monitorPositions; - } - public @Nullable CoverBehavior getTargetCover(Level level) { if (getTarget(level) != null && targetCoverSide != null) { ICoverable coverable = GTCapabilityHelper.getCoverable(level, getTarget(level), targetCoverSide); diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java index 610acc56226..e515846b6cf 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java @@ -1668,6 +1668,27 @@ public static void init(RegistrateLangProvider provider) { " {eval \"repeating a: {repeat 5 \\\"a \\\"}\" -> repeating a: a a a a a ", " {eval \\\"\"{some random text}\"\\\" -> {some random text}", " {eval \"text \"\\\"\"{something with spaces}\"\\\"\" more text\" -> text {something with spaces} more text"); + multiLang(provider, "gtceu.placeholder_info.module", + "Renders the module in the specified slot onto the central monitor (does not work in a cover)", + "Usage:", + " {module } -> empty string"); + multiLang(provider, "gtceu.placeholder_info.setImage", + "Sets the image URL in an image module in the specified slot", + "Usage:", + " {setImage } -> empty string"); + multiLang(provider, "gtceu.placeholder_info.rect", + "Draws a rectangle at the specified position with the specified coordinates and size", + "Usage:", + " {rect } -> empty string", + " {rect 0.5 0.25 2 1 0xFFFFFFFF} -> draws a white rectangle at (0.5, 0.25) with the size (2, 1)"); + multiLang(provider, "gtceu.placeholder_info.quad", + "Draws a quad (must specify parameters for all 4 vertices)", + "Usage:", + " {quad } -> empty string"); + multiLang(provider, "gtceu.placeholder_info.item", + "Returns the amount and id of the item in a specified slot", + "Usage:", + " {item } -> \"31 minecraft:diamond\" (for example)"); multiLang(provider, "gtceu.placeholder_info.bufferText", "Returns the text from a buffer accessible by ComputerCraft", "Usage:", diff --git a/src/main/java/com/gregtechceu/gtceu/syncdata/MonitorGroupPayload.java b/src/main/java/com/gregtechceu/gtceu/syncdata/MonitorGroupPayload.java index acfa684cc4f..0b8b16ba9ee 100644 --- a/src/main/java/com/gregtechceu/gtceu/syncdata/MonitorGroupPayload.java +++ b/src/main/java/com/gregtechceu/gtceu/syncdata/MonitorGroupPayload.java @@ -20,7 +20,7 @@ public class MonitorGroupPayload extends ObjectTypedPayload { CompoundTag tag = new CompoundTag(); tag.putString("name", payload.getName()); ListTag list = new ListTag(); - payload.getRelativePositions().forEach(pos -> { + payload.getMonitorPositions().forEach(pos -> { list.add(NbtUtils.writeBlockPos(pos)); }); if (payload.getTargetRaw() != null) { From d0e0e1ab4e883055cf2bc0ebd167d3f2cd2051ab Mon Sep 17 00:00:00 2001 From: Spicy Noodles <93035068+SpicyNoodle5@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:02:59 +0000 Subject: [PATCH 30/78] Add gem slurry from purified ore recipes (#4413) --- .../chemistry/GemSlurryRecipes.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java index 801caa333a5..9dd5dbfc532 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java @@ -14,12 +14,18 @@ public class GemSlurryRecipes { public static void init(Consumer provider) { // Ruby - MIXER_RECIPES.recipeBuilder("ruby_slurry").duration(280).EUt(VA[EV]) + MIXER_RECIPES.recipeBuilder("ruby_slurry_from_crushed_ruby").duration(280).EUt(VA[EV]) .inputItems(crushed, Ruby, 2) .inputFluids(AquaRegia.getFluid(3000)) .outputFluids(RubySlurry.getFluid(3000)) .save(provider); + MIXER_RECIPES.recipeBuilder("ruby_slurry_from_washed_ruby").duration(280).EUt(VA[EV]) + .inputItems(crushedPurified, Ruby, 2) + .inputFluids(AquaRegia.getFluid(3000)) + .outputFluids(RubySlurry.getFluid(3000)) + .save(provider); + CENTRIFUGE_RECIPES.recipeBuilder("ruby_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(RubySlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) @@ -31,12 +37,18 @@ public static void init(Consumer provider) { .save(provider); // Sapphire - MIXER_RECIPES.recipeBuilder("sapphire_slurry").duration(280).EUt(VA[EV]) + MIXER_RECIPES.recipeBuilder("sapphire_slurry_from_crushed_sapphire").duration(280).EUt(VA[EV]) .inputItems(crushed, Sapphire, 2) .inputFluids(AquaRegia.getFluid(3000)) .outputFluids(SapphireSlurry.getFluid(3000)) .save(provider); + MIXER_RECIPES.recipeBuilder("sapphire_slurry_from_washed_sapphire").duration(280).EUt(VA[EV]) + .inputItems(crushedPurified, Sapphire, 2) + .inputFluids(AquaRegia.getFluid(3000)) + .outputFluids(SapphireSlurry.getFluid(3000)) + .save(provider); + CENTRIFUGE_RECIPES.recipeBuilder("sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(SapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) @@ -47,12 +59,18 @@ public static void init(Consumer provider) { .save(provider); // Green Sapphire - MIXER_RECIPES.recipeBuilder("green_sapphire_slurry").duration(280).EUt(VA[EV]) + MIXER_RECIPES.recipeBuilder("green_sapphire_slurry_from_crushed_green_sapphire").duration(280).EUt(VA[EV]) .inputItems(crushed, GreenSapphire, 2) .inputFluids(AquaRegia.getFluid(3000)) .outputFluids(GreenSapphireSlurry.getFluid(3000)) .save(provider); + MIXER_RECIPES.recipeBuilder("green_sapphire_slurry_from_washed_green_sapphire").duration(280).EUt(VA[EV]) + .inputItems(crushedPurified, GreenSapphire, 2) + .inputFluids(AquaRegia.getFluid(3000)) + .outputFluids(GreenSapphireSlurry.getFluid(3000)) + .save(provider); + CENTRIFUGE_RECIPES.recipeBuilder("green_sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(GreenSapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) From 7b32b64591e4de5e124a3a5f8f3ccaab96717dff Mon Sep 17 00:00:00 2001 From: illuciaz23 <104995560+illuciaz23@users.noreply.github.com> Date: Sun, 8 Feb 2026 15:03:52 +0800 Subject: [PATCH 31/78] Recipe Fail Reason Display (#4487) --- docs/content/Modpacks/Changes/v7.5.0.md | 47 +++++++++++++++- .../resources/assets/gtceu/lang/en_ud.json | 7 +++ .../resources/assets/gtceu/lang/en_us.json | 7 +++ .../multiblock/MultiblockDisplayText.java | 13 +++++ .../WorkableElectricMultiblockMachine.java | 1 + .../gtceu/api/machine/trait/RecipeLogic.java | 53 ++++++++++++++++--- .../gtceu/api/recipe/RecipeRunner.java | 8 ++- .../api/recipe/modifier/ModifierFunction.java | 24 +++++++++ .../api/recipe/modifier/ParallelLogic.java | 38 +++++++++++-- .../recipe/modifier/RecipeModifierList.java | 6 ++- .../gtceu/common/data/GTRecipeModifiers.java | 8 +-- .../electric/FusionReactorMachine.java | 7 ++- .../condition/AdjacentFluidCondition.java | 7 ++- .../gtceu/data/lang/LangHandler.java | 8 +-- .../gtceu/data/lang/RecipeLogicLang.java | 31 +++++++++++ .../jade/provider/RecipeLogicProvider.java | 15 ++++++ 16 files changed, 253 insertions(+), 27 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/data/lang/RecipeLogicLang.java diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index f7adb890ff2..840f6f4d50d 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -2,7 +2,6 @@ title: "Version 7.5.0" --- - # Updating from `7.4.1` to `7.5.0` ## Machine Builder Generics We have added a second Generic argument to our (Multiblock)MachineBuilder. This effectively means that anywhere where you used to store a partially finished `MachineBuilder`, you now need to store a `MachineBuilder`. The same holds for `MultiblockMachineBuilder`. @@ -74,4 +73,48 @@ you should **NOT** use `PipeModel#dynamicModel()` and instead set the model with ## Lamp Predicates Previously, lamps were not useable with the terminal in multiblocks. There are new lamp predicates that will help solve this problem. The predicate to use all lamps is: `Predicates.anyLamp()` -The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. \ No newline at end of file +The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. + +## Machine Recipe Failure Diagnostics +Machines now provide detailed diagnostics explaining why recipes fail to start. + +Failure reasons are displayed in: +- the sidebar of simple machines +- the UI of multiblock machines +- the Jade tooltip for all machines + +You are supposed to replace `ModifierFunction.NULL` with `ModifierFunction.cancel(reason)` to tell the machine why the recipe fails to start. +```patch +- return ModifierFunction.NULL; ++ return ModifierFunction.cancel(Component.translatable("gtceu.recipe_modifier.xxx")); +``` + +Also, if you cancel a recipe in `IRecipeLogicMachine#beforeWorking()`, you are supposed to add some custom reason info like: +``` +@Override +public boolean beforeWorking(@Nullable GTRecipe recipe) { + if(xxx){ + RecipeLogic.putFailureReason(this, recipe, Component.literal("Machine spirit is displeased")); + return false + } + return true; +} +``` +## Painted Output Buses/Hatches +For some time, Spray Paint cans could be used to paint Input and Output Buses/Hatches on multiblock machines. +Version 7.0.0 added the feature that Painted Input Buses/Hatches of different colors would not share their ingredients with +each other when the machine ran recipes. This system is more fully explained at [Painted Inputs and Outputs](../../Gameplay/Logistics/Machines.md#distinct-painted-and-filtered-inputs-and-outputs). + +7.5.0 also applies this logic to Output Buses/Hatches as well. Input Buses/Hatches which have been painted are now only +allowed to send their outputs to Output Buses/Hatches that are of the same paint color, or unpainted. This may cause +existing setups to stop running, if they had painted Output Buses/hatches on them. + +## Change to GTRecipe constructor +GTRecipe has had one new field added to it and its constructors: `int groupColor`. For new recipes, this parameter +is set to `-1`; however for recipes that are being prepared and run, this field holds the Paint color of the +Painted Input Group that the recipe drew its inputs from. + +Addon mods which explicitly attempt to construct, copy, or apply their own ModifierFunctions to a GTRecipe +(not using the standard builder or kjs functions) will need to either add the additional `int` parameter to the end of +their constructor calls, or the additional `recipe.groupColor` to their copy calls. + diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index f51d500f0c5..5662e6a4f60 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -1760,6 +1760,7 @@ "config.gtceu.option.casingsPerCraft": "ʇɟɐɹƆɹǝԀsbuısɐɔ", "config.gtceu.option.cleanMultiblocks": "sʞɔoןqıʇןnWuɐǝןɔ", "config.gtceu.option.client": "ʇuǝıןɔ", + "config.gtceu.option.coloredMaterialBlockOutline": "ǝuıןʇnOʞɔoןᗺןɐıɹǝʇɐWpǝɹoןoɔ", "config.gtceu.option.coloredTieredMachineOutline": "ǝuıןʇnOǝuıɥɔɐWpǝɹǝı⟘pǝɹoןoɔ", "config.gtceu.option.coloredWireOutline": "ǝuıןʇnOǝɹıMpǝɹoןoɔ", "config.gtceu.option.compat": "ʇɐdɯoɔ", @@ -3762,8 +3763,14 @@ "gtceu.recipe_logic.insufficient_out": "sʇndʇnO ʇuǝıɔıɟɟnsuI", "gtceu.recipe_logic.no_capabilities": "sǝıʇıןıqɐdɐƆ ou sɐɥ ǝuıɥɔɐW", "gtceu.recipe_logic.no_contents": "sʇuǝʇuoƆ ou sɐɥ ǝdıɔǝᴚ", + "gtceu.recipe_logic.recipe_waiting": " :buıʇıɐM ǝdıɔǝᴚ", + "gtceu.recipe_logic.setup_fail": " :ǝdıɔǝɹ dnʇǝs oʇ ןıɐℲ", "gtceu.recipe_memory_widget.tooltip.0": "pıɹb buıʇɟɐɹɔ ǝɥʇ oʇuı ǝdıɔǝɹ sıɥʇ ʇnduı ʎןןɐɔıʇɐɯoʇnɐ oʇ ʞɔıןɔ ʇɟǝꞀㄥ§", "gtceu.recipe_memory_widget.tooltip.1": "ǝdıɔǝɹ sıɥʇ ʞɔoןun/ʞɔoן oʇ ʞɔıןɔ ʇɟıɥSㄥ§", + "gtceu.recipe_modifier.coil_temperature_too_low": "ʍoꞀ oo⟘ ǝɹnʇɐɹǝdɯǝ⟘ ןıoƆ", + "gtceu.recipe_modifier.default_fail": "ןıɐℲ ɹǝıɟıpoW ǝdıɔǝᴚ", + "gtceu.recipe_modifier.insufficient_eu_to_start_fusion": "uoıʇɔɐǝᴚ uoısnℲ ǝʇɐıʇıuI oʇ ʎbɹǝuƎ ʇuǝıɔıɟɟnsuI", + "gtceu.recipe_modifier.insufficient_voltage": "ʍoꞀ oo⟘ ɹǝı⟘ ǝbɐʇןoΛ", "gtceu.recipe_type.show_recipes": "sǝdıɔǝᴚ ʍoɥS", "gtceu.rei.group.potion_fluids": "spınןℲ uoıʇoԀ", "gtceu.research_station": "uoıʇɐʇS ɥɔɹɐǝsǝᴚ", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 3ceb805dee1..8396c85fe46 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -1760,6 +1760,7 @@ "config.gtceu.option.casingsPerCraft": "casingsPerCraft", "config.gtceu.option.cleanMultiblocks": "cleanMultiblocks", "config.gtceu.option.client": "client", + "config.gtceu.option.coloredMaterialBlockOutline": "coloredMaterialBlockOutline", "config.gtceu.option.coloredTieredMachineOutline": "coloredTieredMachineOutline", "config.gtceu.option.coloredWireOutline": "coloredWireOutline", "config.gtceu.option.compat": "compat", @@ -3762,8 +3763,14 @@ "gtceu.recipe_logic.insufficient_out": "Insufficient Outputs", "gtceu.recipe_logic.no_capabilities": "Machine has no Capabilities", "gtceu.recipe_logic.no_contents": "Recipe has no Contents", + "gtceu.recipe_logic.recipe_waiting": "Recipe Waiting: ", + "gtceu.recipe_logic.setup_fail": "Fail to setup recipe: ", "gtceu.recipe_memory_widget.tooltip.0": "§7Left click to automatically input this recipe into the crafting grid", "gtceu.recipe_memory_widget.tooltip.1": "§7Shift click to lock/unlock this recipe", + "gtceu.recipe_modifier.coil_temperature_too_low": "Coil Temperature Too Low", + "gtceu.recipe_modifier.default_fail": "Recipe Modifier Fail", + "gtceu.recipe_modifier.insufficient_eu_to_start_fusion": "Insufficient Energy to Initiate Fusion Reaction", + "gtceu.recipe_modifier.insufficient_voltage": "Voltage Tier Too Low", "gtceu.recipe_type.show_recipes": "Show Recipes", "gtceu.rei.group.potion_fluids": "Potion Fluids", "gtceu.research_station": "Research Station", diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index b0270cb6d9e..1b9abeb2afa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -372,6 +372,19 @@ public Builder addCustomProgressLine(RecipeLogic recipeLogic) { return this; } + public Builder addRecipeFailReasonLine(RecipeLogic recipeLogic) { + if (!isStructureFormed || !recipeLogic.isIdle()) + return this; + var reasons = recipeLogic.getFailureReasons(); + if (!reasons.isEmpty()) { + textList.add(Component.translatable("gtceu.recipe_logic.setup_fail").withStyle(ChatFormatting.RED)); + for (var reason : reasons) { + textList.add(Component.literal(" - ").append(reason)); + } + } + return this; + } + public Builder addBatchModeLine(boolean batchEnabled, int batchAmount) { if (batchEnabled && batchAmount > 0) { Component runs = Component.literal(FormattingUtil.formatNumbers(batchAmount)) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java index f05177efe83..1273ced2670 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java @@ -128,6 +128,7 @@ public void addDisplayText(List textList) { .addBatchModeLine(isBatchEnabled(), batchParallels) .addWorkingStatusLine() .addProgressLine(recipeLogic) + .addRecipeFailReasonLine(recipeLogic) .addOutputLines(recipeLogic.getLastRecipe()); getDefinition().getAdditionalDisplay().accept(this, textList); IDisplayUIMachine.super.addDisplayText(textList); 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 1483937c722..8c5598cb3a0 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 @@ -15,6 +15,7 @@ import com.gregtechceu.gtceu.api.recipe.ActionResult; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; +import com.gregtechceu.gtceu.api.recipe.modifier.ModifierFunction; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.sound.AutoReleasedSound; import com.gregtechceu.gtceu.common.cover.MachineControllerCover; @@ -80,10 +81,18 @@ public enum Status implements StringRepresentable { @UpdateListener(methodName = "onActiveSynced") protected boolean isActive; + @Getter @Nullable @Persisted @DescSynced private Component waitingReason = null; + + @Getter + @DescSynced + protected final List failureReasons = new ArrayList<>(); + + @Getter + protected final Map failureReasonMap = new HashMap<>(); /** * unsafe, it may not be found from {@link RecipeManager}. Do not index it. */ @@ -158,6 +167,8 @@ public void resetRecipeLogic() { duration = 0; isActive = false; lastFailedMatches = null; + waitingReason = null; + failureReasons.clear(); if (status != Status.SUSPEND) { setStatus(Status.IDLE); } @@ -225,7 +236,10 @@ public void serverTick() { // No recipes available and the machine wants to unsubscribe until notified unsubscribe = true; } - + if (isIdle()) { + failureReasons.clear(); + failureReasons.addAll(failureReasonMap.values()); + } if (unsubscribe && subscription != null) { subscription.unsubscribe(); subscription = null; @@ -249,6 +263,8 @@ public boolean checkMatchedRecipeAvailable(GTRecipe match) { var recipeMatch = checkRecipe(modified); if (recipeMatch.isSuccess()) { setupRecipe(modified); + } else { + putFailureReason(this, match, recipeMatch.reason()); } if (lastRecipe != null && getStatus() == Status.WORKING) { lastOriginRecipe = match; @@ -321,13 +337,16 @@ protected void regressRecipe() { public void findAndHandleRecipe() { lastFailedMatches = null; + // try to execute last recipe if possible if (!recipeDirty && lastRecipe != null && checkRecipe(lastRecipe).isSuccess()) { GTRecipe recipe = lastRecipe; lastRecipe = null; lastOriginRecipe = null; setupRecipe(recipe); - } else { // try to find and handle a new recipe + } else { + // try to find and handle a new recipe + failureReasonMap.clear(); lastRecipe = null; lastOriginRecipe = null; handleSearchingRecipes(searchRecipe()); @@ -383,6 +402,7 @@ public void setupRecipe(GTRecipe recipe) { if (lastRecipe != null && !recipe.equals(lastRecipe)) { chanceCaches.clear(); } + failureReasonMap.clear(); recipeDirty = false; lastRecipe = recipe; setStatus(Status.WORKING); @@ -522,9 +542,6 @@ public void onRecipeFinish() { setupRecipe(lastRecipe); } else { setStatus(Status.IDLE); - if (recipeCheck.io() != IO.IN || recipeCheck.capability() == EURecipeCapability.CAP) { - waitingReason = recipeCheck.reason(); - } consecutiveRecipes = 0; progress = 0; duration = 0; @@ -590,7 +607,7 @@ public void updateSound() { @Override public IGuiTexture getFancyTooltipIcon() { - if (waitingReason != null) { + if (showFancyTooltip()) { return GuiTextures.INSUFFICIENT_INPUT; } return IGuiTexture.EMPTY; @@ -598,15 +615,18 @@ public IGuiTexture getFancyTooltipIcon() { @Override public List getFancyTooltip() { - if (waitingReason != null) { + if (isWaiting() && waitingReason != null) { return List.of(waitingReason); } + if (isIdle() && !failureReasons.isEmpty()) { + return failureReasons; + } return Collections.emptyList(); } @Override public boolean showFancyTooltip() { - return waitingReason != null; + return waitingReason != null || !failureReasons.isEmpty(); } protected Map, Object2IntMap> makeChanceCaches() { @@ -667,4 +687,21 @@ public void loadCustomPersistedData(@NotNull CompoundTag tag) { }); tag.put("chance_cache", chanceCache); } + + public static void putFailureReason(Object machine, GTRecipe recipe, Component reason) { + if (machine instanceof IRecipeLogicMachine rlm) { + putFailureReason(rlm.getRecipeLogic(), recipe, reason); + } + } + + public static void putFailureReason(RecipeLogic logic, GTRecipe recipe, Component reason) { + var map = logic.getFailureReasonMap(); + if (map.containsKey(recipe)) { + if (reason != ModifierFunction.DEFAULT_FAILURE) { + map.put(recipe, reason); + } + } else { + map.put(recipe, reason); + } + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java index 806378f1b06..bddc7657eaf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java @@ -10,6 +10,8 @@ import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; +import net.minecraft.network.chat.Component; + import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; @@ -114,7 +116,11 @@ private void fillContentMatchList(Map, List> entrie private ActionResult handleContents() { if (recipeContents.isEmpty()) return ActionResult.SUCCESS; if (!capabilityProxies.containsKey(io)) { - return ActionResult.FAIL_NO_CAPABILITIES; + return ActionResult.fail( + Component.translatable("gtceu.recipe_logic.no_capabilities") + .append(Component.literal(": ")) + .append(Component.translatable(io.tooltip)), + null, io); } List handlers = capabilityProxies.getOrDefault(io, Collections.emptyList()); 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 67f6139a049..41a20331db0 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 @@ -9,6 +9,8 @@ import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; +import net.minecraft.network.chat.Component; + import lombok.Setter; import lombok.experimental.Accessors; import org.jetbrains.annotations.Contract; @@ -35,6 +37,7 @@ @FunctionalInterface public interface ModifierFunction { + // TODO: Add reasons for any NULL ModifierFunction (replace them with cancel) /** * Use this static to denote that the recipe should be cancelled */ @@ -44,6 +47,21 @@ public interface ModifierFunction { */ ModifierFunction IDENTITY = recipe -> recipe; + static ModifierFunction cancel(Component reason) { + return new ModifierFunction() { + + @Override + public @Nullable GTRecipe apply(@NotNull GTRecipe recipe) { + return null; + } + + @Override + public Component getFailReason() { + return reason; + } + }; + } + /** * Applies this modifier to the passed recipe * @@ -79,6 +97,12 @@ private GTRecipe applySafe(@Nullable GTRecipe recipe) { return apply(recipe); } + static final Component DEFAULT_FAILURE = Component.translatable("gtceu.recipe_modifier.default_fail"); + + default Component getFailReason() { + return DEFAULT_FAILURE; + } + /** * Creates a FunctionBuilder to easily build a ModifierFunction that modifies parts of a recipe. *

    diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java index b8a65588451..a1e903a2883 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java @@ -3,11 +3,13 @@ import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.network.chat.Component; import org.jetbrains.annotations.NotNull; @@ -57,7 +59,15 @@ public static int getMaxByInput(IRecipeCapabilityHolder holder, GTRecipe recipe, for (RecipeCapability cap : recipe.inputs.keySet()) { if (cap.doMatchInRecipe() && !capsToSkip.contains(cap)) { // Find the maximum number of recipes that can be performed from the contents of the input inventories - minimum = Math.min(minimum, cap.getMaxParallelByInput(holder, recipe, parallelLimit, false)); + var capParallel = cap.getMaxParallelByInput(holder, recipe, parallelLimit, false); + if (capParallel == 0) { + Component reason = Component.translatable("gtceu.recipe_logic.insufficient_in") + .append(": ") + .append(cap.getName()); + RecipeLogic.putFailureReason(holder, recipe, reason); + return 0; + } + minimum = Math.min(minimum, capParallel); } } @@ -65,10 +75,24 @@ public static int getMaxByInput(IRecipeCapabilityHolder holder, GTRecipe recipe, for (RecipeCapability cap : recipe.tickInputs.keySet()) { if (cap.doMatchInRecipe() && !capsToSkip.contains(cap)) { // Find the maximum number of recipes that can be performed from the contents of the input inventories - minimum = Math.min(minimum, cap.getMaxParallelByInput(holder, recipe, parallelLimit, true)); + var capParallel = cap.getMaxParallelByInput(holder, recipe, parallelLimit, true); + if (capParallel == 0) { + Component reason = Component.translatable("gtceu.recipe_logic.insufficient_in") + .append(": ") + .append(cap.getName()); + RecipeLogic.putFailureReason(holder, recipe, reason); + return 0; + } + minimum = Math.min(minimum, capParallel); } } - if (minimum == Integer.MAX_VALUE) return 0; + if (minimum == Integer.MAX_VALUE) { + Component reason = Component.translatable("gtceu.recipe_logic.no_capabilities") + .append(Component.literal(": ")) + .append(Component.translatable(IO.IN.tooltip)); + RecipeLogic.putFailureReason(holder, recipe, reason); + return 0; + } return minimum; } @@ -93,6 +117,10 @@ public static int limitByOutputMerging(IRecipeCapabilityHolder holder, GTRecipe int limit = cap.limitMaxParallelByOutput(holder, recipe, parallelLimit, false); // If we are not voiding, and cannot fit any items, return 0 if (limit == 0) { + Component reason = Component.translatable("gtceu.recipe_logic.insufficient_out") + .append(": ") + .append(cap.getName()); + RecipeLogic.putFailureReason(holder, recipe, reason); return 0; } max = Math.min(max, limit); @@ -107,6 +135,10 @@ public static int limitByOutputMerging(IRecipeCapabilityHolder holder, GTRecipe int limit = cap.limitMaxParallelByOutput(holder, recipe, parallelLimit, true); // If we are not voiding, and cannot fit any items, return 0 if (limit == 0) { + Component reason = Component.translatable("gtceu.recipe_logic.insufficient_out") + .append(": ") + .append(cap.getName()); + RecipeLogic.putFailureReason(holder, recipe, reason); return 0; } max = Math.min(max, limit); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java index 020ce9e4f10..533b131e481 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.recipe.modifier; import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import lombok.Getter; @@ -37,7 +38,10 @@ public RecipeModifierList(RecipeModifier... modifiers) { for (RecipeModifier modifier : modifiers) { var func = modifier.getModifier(machine, runningRecipe); runningRecipe = func.apply(runningRecipe); - if (runningRecipe == null) return ModifierFunction.NULL; + if (runningRecipe == null) { + RecipeLogic.putFailureReason(machine, recipe, func.getFailReason()); + return ModifierFunction.NULL; + } result = func.compose(result); } return result; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java index ba1fa7bba54..0bbf5f33ac0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java @@ -20,6 +20,7 @@ import net.minecraft.Util; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import org.jetbrains.annotations.NotNull; @@ -38,7 +39,8 @@ public class GTRecipeModifiers { .memoize(logic -> (machine, recipe) -> { if (!(machine instanceof IOverclockMachine overclockMachine)) return ModifierFunction.IDENTITY; if (RecipeHelper.getRecipeEUtTier(recipe) > overclockMachine.getMaxOverclockTier()) { - return ModifierFunction.NULL; + return ModifierFunction + .cancel(Component.translatable("gtceu.recipe_modifier.insufficient_voltage")); } return logic.getModifier(machine, recipe, overclockMachine.getOverclockVoltage()); }); @@ -174,11 +176,11 @@ public class GTRecipeModifiers { (100 * Math.max(0, coilMachine.getTier() - GTValues.MV)); int recipeTemp = recipe.data.getInt("ebf_temp"); if (!recipe.data.contains("ebf_temp") || recipeTemp > blastFurnaceTemperature) { - return ModifierFunction.NULL; + return ModifierFunction.cancel(Component.translatable("gtceu.recipe_modifier.coil_temperature_too_low")); } if (RecipeHelper.getRecipeEUtTier(recipe) > coilMachine.getTier()) { - return ModifierFunction.NULL; + return ModifierFunction.cancel(Component.translatable("gtceu.recipe_modifier.insufficient_voltage")); } var discount = ModifierFunction.builder() diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java index 3b14be3ad8b..f1409069226 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java @@ -185,7 +185,8 @@ public static ModifierFunction recipeModifier(@NotNull MetaMachine machine, @Not if (RecipeHelper.getRecipeEUtTier(recipe) > fusionReactorMachine.getTier() || !recipe.data.contains("eu_to_start") || recipe.data.getLong("eu_to_start") > fusionReactorMachine.energyContainer.getEnergyCapacity()) { - return ModifierFunction.NULL; + return ModifierFunction + .cancel(Component.translatable("gtceu.recipe_modifier.insufficient_eu_to_start_fusion")); } long heatDiff = recipe.data.getLong("eu_to_start") - fusionReactorMachine.heat; @@ -195,7 +196,9 @@ public static ModifierFunction recipeModifier(@NotNull MetaMachine machine, @Not return FUSION_OC.getModifier(machine, recipe, fusionReactorMachine.getMaxVoltage(), false); } // if the remaining energy needed is more than stored, do not run - if (fusionReactorMachine.energyContainer.getEnergyStored() < heatDiff) return ModifierFunction.NULL; + if (fusionReactorMachine.energyContainer.getEnergyStored() < heatDiff) + return ModifierFunction + .cancel(Component.translatable("gtceu.recipe_modifier.insufficient_eu_to_start_fusion")); // remove the energy needed fusionReactorMachine.energyContainer.removeEnergy(heatDiff); diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidCondition.java index 01bd029cca2..ab88dd84729 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidCondition.java @@ -93,7 +93,12 @@ public RecipeConditionType getType() { @Override public Component getTooltips() { - return Component.translatable("recipe.condition.adjacent_fluid.tooltip"); + var tooltips = Component.translatable("recipe.condition.adjacent_fluid.tooltip"); + fluids.forEach(set -> { + var id = set.get().get(0).get().getFluidType().getDescription(); + tooltips.append(" ").append(id); + }); + return tooltips; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java index e515846b6cf..3850fc67e8c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java @@ -28,6 +28,7 @@ public static void init(RegistrateLangProvider provider) { MachineLang.init(provider); ToolLang.init(provider); ConfigurationLang.init(provider); + RecipeLogicLang.init(provider); provider.add("gtceu.gui.editor.tips.citation", "Number of citations"); provider.add("gtceu.gui.editor.group.recipe_type", "cap"); @@ -1263,12 +1264,7 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.button.hide_depleted", "Hide Depleted Veins"); provider.add("gtceu.button.show_depleted", "Show Depleted Veins"); provider.add("gtceu.recipe_type.show_recipes", "Show Recipes"); - provider.add("gtceu.recipe_logic.insufficient_fuel", "Insufficient Fuel"); - provider.add("gtceu.recipe_logic.insufficient_in", "Insufficient Inputs"); - provider.add("gtceu.recipe_logic.insufficient_out", "Insufficient Outputs"); - provider.add("gtceu.recipe_logic.condition_fails", "Condition Fails"); - provider.add("gtceu.recipe_logic.no_contents", "Recipe has no Contents"); - provider.add("gtceu.recipe_logic.no_capabilities", "Machine has no Capabilities"); + provider.add("gtceu.gui.cover_setting.title", "Cover Settings"); provider.add("gtceu.gui.output_setting.title", "Output Settings"); provider.add("gtceu.gui.circuit.title", "Circuit Settings"); diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/RecipeLogicLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/RecipeLogicLang.java new file mode 100644 index 00000000000..3146df4ba7b --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/RecipeLogicLang.java @@ -0,0 +1,31 @@ +package com.gregtechceu.gtceu.data.lang; + +import com.tterrag.registrate.providers.RegistrateLangProvider; + +public class RecipeLogicLang { + + public static void init(RegistrateLangProvider provider) { + initGenericLang(provider); + initModifierLang(provider); + } + + private static void initGenericLang(RegistrateLangProvider provider) { + provider.add("gtceu.recipe_logic.setup_fail", "Fail to setup recipe: "); + provider.add("gtceu.recipe_logic.recipe_waiting", "Recipe Waiting: "); + + provider.add("gtceu.recipe_logic.insufficient_fuel", "Insufficient Fuel"); + provider.add("gtceu.recipe_logic.insufficient_in", "Insufficient Inputs"); + provider.add("gtceu.recipe_logic.insufficient_out", "Insufficient Outputs"); + provider.add("gtceu.recipe_logic.condition_fails", "Condition Fails"); + provider.add("gtceu.recipe_logic.no_contents", "Recipe has no Contents"); + provider.add("gtceu.recipe_logic.no_capabilities", "Machine has no Capabilities"); + } + + private static void initModifierLang(RegistrateLangProvider provider) { + provider.add("gtceu.recipe_modifier.default_fail", "Recipe Modifier Fail"); + provider.add("gtceu.recipe_modifier.insufficient_voltage", "Voltage Tier Too Low"); + provider.add("gtceu.recipe_modifier.insufficient_eu_to_start_fusion", + "Insufficient Energy to Initiate Fusion Reaction"); + provider.add("gtceu.recipe_modifier.coil_temperature_too_low", "Coil Temperature Too Low"); + } +} 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 f3541c0813a..021fa0bef86 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 @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.gregtechceu.gtceu.api.machine.steam.SimpleSteamMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; @@ -127,6 +128,20 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, } } } + } else { + if (blockEntity instanceof MetaMachineBlockEntity mbe && + mbe.metaMachine instanceof IRecipeLogicMachine rlm) { + var logic = rlm.getRecipeLogic(); + + if (logic.showFancyTooltip() && logic.isWorkingEnabled()) { + Component status = logic.isWaiting() ? + Component.translatable("gtceu.recipe_logic.recipe_waiting") + .withStyle(ChatFormatting.YELLOW) : + Component.translatable("gtceu.recipe_logic.setup_fail").withStyle(ChatFormatting.RED); + tooltip.add(status); + logic.getFancyTooltip().forEach(tooltip::add); + } + } } } } From 944c3f0b3aa19829793d4e59eaa83cca472f441e Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 8 Feb 2026 15:25:01 +0800 Subject: [PATCH 32/78] make all variants of `GTRecipeBuilder#adjacentBlock` and `#adjacentFluid` overloads of each other (#4526) --- docs/content/Modpacks/Changes/v7.5.0.md | 14 ++ .../data/recipe/builder/GTRecipeBuilder.java | 197 ++++++++++++++---- .../data/recipe/misc/MiscRecipeLoader.java | 24 +-- .../condition/AdjacentFluidConditionTest.java | 4 +- 4 files changed, 179 insertions(+), 60 deletions(-) diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index 840f6f4d50d..a2d4c55f107 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -75,6 +75,17 @@ Previously, lamps were not useable with the terminal in multiblocks. There are n The predicate to use all lamps is: `Predicates.anyLamp()` The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. +## `GTRecipeBuilder#adjacentFluidTag()` and `GTRecipeBuilder#adjacentBlockTag()` +_This is only relevant to **add-on mods** with custom recipe types that use the condition(s). **KubeJS recipes are not affected.**_ + +The renames of `GTRecipeBuilder#adjacentFluid(TagKey...)` -> `#adjacentFluidTag(TagKey...)` and `GTRecipeBuilder#adjacentBlock(TagKey...)` -> `#adjacentBlockTag(TagKey...)` +have been deprecated in favor of naming every variant `adjacentFluids` and `adjacentBlocks`, respectively. +Please update your addon mods' recipes to use these new methods, as the now deprecated methods will be removed come 8.0.0. + +A full list of all deprecated methods & their replacement is as follows: +Fluids: `adjacentFluid`, `adjacentFluidTag` -> `adjacentFluids` +Blocks: `adjacentBlock`, `adjacentBlockTag` -> `adjacentBlocks` + ## Machine Recipe Failure Diagnostics Machines now provide detailed diagnostics explaining why recipes fail to start. @@ -100,6 +111,7 @@ public boolean beforeWorking(@Nullable GTRecipe recipe) { return true; } ``` + ## Painted Output Buses/Hatches For some time, Spray Paint cans could be used to paint Input and Output Buses/Hatches on multiblock machines. Version 7.0.0 added the feature that Painted Input Buses/Hatches of different colors would not share their ingredients with @@ -118,3 +130,5 @@ Addon mods which explicitly attempt to construct, copy, or apply their own Modif (not using the standard builder or kjs functions) will need to either add the additional `int` parameter to the end of their constructor calls, or the additional `recipe.groupColor` to their copy calls. +## Added BiomeTagCondition +Added a new RecipeCondition called BiomeTagCondition for needing a specific biome tag. This can be used with KubeJS using `.biomeTag("biome")`. diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index e5f5368ba2d..548db26fe1f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -62,6 +62,7 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -214,7 +215,7 @@ public GTRecipeBuilder output(RecipeCapability capability, T... obj) { return this; } - public GTRecipeBuilder addCondition(RecipeCondition condition) { + public GTRecipeBuilder addCondition(RecipeCondition condition) { conditions.add(condition); recipeType.setMinRecipeConditions(conditions.size()); return this; @@ -1187,62 +1188,112 @@ public final GTRecipeBuilder adjacentFluids(Fluid... fluids) { public final GTRecipeBuilder adjacentFluids(boolean isReverse, Fluid... fluids) { if (fluids.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); + GTCEu.LOGGER.error("Adjacent fluid condition has too many fluids, not adding to recipe. id: {}", this.id); return this; } return addCondition(AdjacentFluidCondition.fromFluids(fluids).setReverse(isReverse)); } - public final GTRecipeBuilder adjacentFluid(Fluid... fluids) { - return adjacentFluid(false, fluids); + @SafeVarargs + public final GTRecipeBuilder adjacentFluids(TagKey... tags) { + return adjacentFluids(false, tags); } - public final GTRecipeBuilder adjacentFluid(boolean isReverse, Fluid... fluids) { - if (fluids.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); + @SafeVarargs + public final GTRecipeBuilder adjacentFluids(boolean isReverse, TagKey... tags) { + if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent fluid condition has too many fluids, not adding to recipe. id: {}", this.id); return this; } - return addCondition(AdjacentFluidCondition.fromFluids(fluids).setReverse(isReverse)); + return addCondition(AdjacentFluidCondition.fromTags(tags).setReverse(isReverse)); + } + + public GTRecipeBuilder adjacentFluids(Collection> fluids) { + return adjacentFluids(fluids, false); + } + + public GTRecipeBuilder adjacentFluids(Collection> fluids, boolean isReverse) { + if (fluids.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent fluid condition has too many fluids, not adding to recipe. id: {}", this.id); + return this; + } + return addCondition(new AdjacentFluidCondition(isReverse, List.copyOf(fluids))); + } + + /** + * @deprecated use {@link #adjacentFluids(Fluid...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) + public final GTRecipeBuilder adjacentFluid(Fluid... fluids) { + return adjacentFluids(fluids); + } + + /** + * @deprecated use {@link #adjacentFluids(boolean, Fluid...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) + public final GTRecipeBuilder adjacentFluid(boolean isReverse, Fluid... fluids) { + return adjacentFluids(isReverse, fluids); } + /** + * @deprecated use {@link #adjacentFluids(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluidTag(TagKey... tags) { - return adjacentFluidTag(false, tags); + return adjacentFluids(tags); } + /** + * @deprecated use {@link #adjacentFluids(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluidTag(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentFluidCondition.fromTags(tags).setReverse(isReverse)); + return adjacentFluids(isReverse, tags); } + /** + * @deprecated use {@link #adjacentFluids(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluid(TagKey... tags) { - return adjacentFluid(false, tags); + return adjacentFluids(tags); } + /** + * @deprecated use {@link #adjacentFluids(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluid(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentFluidCondition.fromTags(tags).setReverse(isReverse)); + return adjacentFluids(isReverse, tags); } + /** + * @deprecated use {@link #adjacentFluids(Collection)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentFluid(Collection> fluids) { - return adjacentFluid(fluids, false); + return adjacentFluids(fluids); } + /** + * @deprecated use {@link #adjacentFluids(Collection, boolean)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentFluid(Collection> fluids, boolean isReverse) { - if (fluids.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(new AdjacentFluidCondition(isReverse, new ArrayList<>(fluids))); + return adjacentFluids(fluids, isReverse); } public GTRecipeBuilder adjacentBlocks(Block... blocks) { @@ -1251,62 +1302,116 @@ public GTRecipeBuilder adjacentBlocks(Block... blocks) { public GTRecipeBuilder adjacentBlocks(boolean isReverse, Block... blocks) { if (blocks.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); return this; } return addCondition(AdjacentBlockCondition.fromBlocks(blocks).setReverse(isReverse)); } + @SafeVarargs + public final GTRecipeBuilder adjacentBlocks(TagKey... tags) { + return adjacentBlocks(false, tags); + } + + @SafeVarargs + public final GTRecipeBuilder adjacentBlocks(boolean isReverse, TagKey... tags) { + if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); + return this; + } + return addCondition(AdjacentBlockCondition.fromTags(tags).setReverse(isReverse)); + } + + public GTRecipeBuilder adjacentBlocks(Collection> blocks) { + return adjacentBlocks(blocks, false); + } + + public GTRecipeBuilder adjacentBlocks(Collection> blocks, boolean isReverse) { + if (blocks.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); + return this; + } + return addCondition(new AdjacentBlockCondition(isReverse, List.copyOf(blocks))); + } + + /** + * @deprecated use {@link #adjacentBlocks(Block...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(Block... blocks) { return adjacentBlock(false, blocks); } + /** + * @deprecated use {@link #adjacentBlocks(boolean, Block...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(boolean isReverse, Block... blocks) { if (blocks.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); return this; } return addCondition(AdjacentBlockCondition.fromBlocks(blocks).setReverse(isReverse)); } + /** + * @deprecated use {@link #adjacentBlocks(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlock(TagKey... tags) { - return adjacentBlock(false, tags); + return adjacentBlocks(tags); } + /** + * @deprecated use {@link #adjacentBlocks(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlock(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentBlockCondition.fromTags(tags).setReverse(isReverse)); + return adjacentBlocks(isReverse, tags); } + /** + * @deprecated use {@link #adjacentBlocks(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlockTag(TagKey... tags) { - return adjacentBlockTag(false, tags); + return adjacentBlocks(tags); } + /** + * @deprecated use {@link #adjacentBlocks(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlockTag(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentBlockCondition.fromTags(tags).setReverse(isReverse)); + return adjacentBlocks(isReverse, tags); } + /** + * @deprecated use {@link #adjacentBlocks(Collection)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(Collection> blocks) { - return adjacentBlock(blocks, false); + return adjacentBlocks(blocks); } + /** + * @deprecated use {@link #adjacentBlocks(Collection, boolean)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(Collection> blocks, boolean isReverse) { - if (blocks.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(new AdjacentBlockCondition(isReverse, new ArrayList<>(blocks))); + return adjacentBlocks(blocks, isReverse); } public GTRecipeBuilder daytime(boolean isNight) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 38914de3715..8ea508e563c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -89,7 +89,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("cobblestone") .notConsumable(Blocks.COBBLESTONE.asItem()) .outputItems(Blocks.COBBLESTONE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VA[ULV]) .save(provider); @@ -97,7 +97,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("stone") .notConsumable(Blocks.STONE.asItem()) .outputItems(Blocks.STONE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VA[ULV]) .save(provider); @@ -105,7 +105,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("andesite") .notConsumable(Blocks.ANDESITE.asItem()) .outputItems(Blocks.ANDESITE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[MV]) .save(provider); @@ -113,7 +113,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("granite") .notConsumable(Blocks.GRANITE.asItem()) .outputItems(Blocks.GRANITE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[MV]) .save(provider); @@ -121,7 +121,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("diorite") .notConsumable(Blocks.DIORITE.asItem()) .outputItems(Blocks.DIORITE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[MV]) .save(provider); @@ -129,7 +129,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("obsidian") .notConsumable(dust, Redstone) .outputItems(Blocks.OBSIDIAN.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -137,7 +137,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("basalt") .notConsumable(Blocks.BASALT.asItem()) .outputItems(Blocks.BASALT.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -145,7 +145,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("blackstone") .notConsumable(Blocks.BLACKSTONE.asItem()) .outputItems(Blocks.BLACKSTONE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -153,7 +153,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("deepslate") .notConsumable(Blocks.DEEPSLATE.asItem()) .outputItems(Blocks.DEEPSLATE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[EV]) .save(provider); @@ -161,7 +161,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("marble") .notConsumable(rock, Marble) .outputItems(rock, Marble) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -169,7 +169,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("basalt") .notConsumable(rock, Basalt) .outputItems(rock, Basalt) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -177,7 +177,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("red_granite") .notConsumable(rock, GraniteRed) .outputItems(rock, GraniteRed) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[EV]) .save(provider); diff --git a/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java b/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java index 3a1adb5ac59..4ce72c313de 100644 --- a/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java +++ b/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java @@ -39,7 +39,7 @@ public static void prepare(ServerLevel level) { .recipeBuilder(GTCEu.id("test_adjacent_fluid_conditions")) .inputItems(new ItemStack(Blocks.COBBLESTONE)) .outputItems(new ItemStack(Blocks.STONE)) - .adjacentFluidTag(FluidTags.WATER) + .adjacentFluids(FluidTags.WATER) .EUt(GTValues.VA[GTValues.HV]) .duration(8) .buildRawRecipe()); @@ -48,7 +48,7 @@ public static void prepare(ServerLevel level) { .recipeBuilder(GTCEu.id("test_adjacent_fluid_conditions_multiple_fluids")) .inputItems(new ItemStack(Blocks.OAK_WOOD)) .outputItems(new ItemStack(Items.CHARCOAL)) - .adjacentFluidTag(FluidTags.WATER, FluidTags.LAVA) + .adjacentFluids(FluidTags.WATER, FluidTags.LAVA) .EUt(GTValues.VA[GTValues.HV]) .duration(8) .buildRawRecipe()); From 4c28e67cf4eae815c48fe852ebff86e9b473073c Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Sun, 8 Feb 2026 08:40:39 +0100 Subject: [PATCH 33/78] Remove muffler hatch from distillery preview (#4577) --- .../gregtechceu/gtceu/common/data/machines/GCYMMachines.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java index 8682cc2e563..5551ff74fa0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java @@ -655,7 +655,6 @@ public static void init() {} var builder = MultiblockShapeInfo.builder() .where('S', definition, Direction.NORTH) .where('C', CASING_WATERTIGHT.getDefaultState()) - .where('M', MUFFLER_HATCH[IV], Direction.UP) .where('X', PARALLEL_HATCH[IV], Direction.NORTH) .where('H', FLUID_IMPORT_HATCH[IV], Direction.NORTH) .where('B', ITEM_EXPORT_BUS[IV], Direction.NORTH) @@ -675,7 +674,7 @@ public static void init() {} List aisle3 = new ArrayList<>(16); aisle3.add("CCCCC"); aisle3.add("C###C"); - aisle3.add("#CMC#"); + aisle3.add("#CCC#"); List aisle4 = new ArrayList<>(16); aisle4.add("CCCCC"); aisle4.add("C###C"); From 22025a4027f28444adf53f7088b1a4c269b97167 Mon Sep 17 00:00:00 2001 From: Jurre Groenendijk Date: Sun, 8 Feb 2026 17:52:42 +0100 Subject: [PATCH 34/78] Fix access protection issue in netherite tools + lamprenderer issues (#4579) --- .../com/gregtechceu/gtceu/api/item/LampBlockItem.java | 2 +- .../gtceu/client/renderer/block/LampItemRenderer.java | 9 ++++++++- .../gtceu/data/recipe/VanillaRecipeHelper.java | 5 ++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java index d07587b9b57..edb5174a25a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/LampBlockItem.java @@ -77,7 +77,7 @@ public void initializeClient(Consumer consumer) { @Override public BlockEntityWithoutLevelRenderer getCustomRenderer() { - return LampItemRenderer.INSTANCE; + return LampItemRenderer.getInstance(); } }); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java index aed2072c637..853f9a3e361 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/LampItemRenderer.java @@ -22,7 +22,14 @@ */ public class LampItemRenderer extends BlockEntityWithoutLevelRenderer { - public static final LampItemRenderer INSTANCE = new LampItemRenderer(); + private static LampItemRenderer INSTANCE = null; + + public static LampItemRenderer getInstance() { + if (INSTANCE == null) { + INSTANCE = new LampItemRenderer(); + } + return INSTANCE; + } protected final ItemRenderer itemRenderer; protected final BlockRenderDispatcher blockRenderer; diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java index f2035827169..e9d7013bf87 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java @@ -14,6 +14,7 @@ import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.data.recipe.builder.*; +import net.minecraft.advancements.critereon.InventoryChangeTrigger; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.data.recipes.SmithingTransformRecipeBuilder; @@ -33,8 +34,6 @@ import java.util.function.Consumer; -import static com.tterrag.registrate.providers.RegistrateRecipeProvider.has; - public class VanillaRecipeHelper { public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, TagKey input, @@ -631,7 +630,7 @@ public static void addSmithingTransformRecipe(Consumer provider, @NotNull RecipeCategory category) { SmithingTransformRecipeBuilder .smithing(Ingredient.of(template), Ingredient.of(baseInput), Ingredient.of(addition), category, result) - .unlocks(String.format("has_%s", baseInput), has(baseInput)) + .unlocks(String.format("has_%s", baseInput), InventoryChangeTrigger.TriggerInstance.hasItems(baseInput)) .save(provider, regName); } From 4c8ea445ab6fbc123d1c6be707191d1f0dd4c284 Mon Sep 17 00:00:00 2001 From: Tar Laboratories <159147059+TarLaboratories@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:36:16 +0300 Subject: [PATCH 35/78] Fix CR being displayed on CM when pasting text on windows (#4603) --- .../gtceu/common/item/modules/TextModuleBehaviour.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java index d6762ab6b3f..beb0f1289f3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/modules/TextModuleBehaviour.java @@ -91,7 +91,7 @@ public Widget createUIWidget(ItemStack stack, CentralMonitorMachine machine, Mon ButtonWidget saveButton = new ButtonWidget(-40, 22, 20, 20, click -> { if (!click.isRemote) return; ListTag listTag = new ListTag(); - editor.getLines().forEach(line -> listTag.add(StringTag.valueOf(line))); + editor.getLines().forEach(line -> listTag.add(StringTag.valueOf(line.replaceAll("\r", "")))); CompoundTag tag2 = stack.getOrCreateTag(); tag2.put("formatStringLines", listTag); try { @@ -146,7 +146,7 @@ public void setScale(ItemStack stack, double scale) { public void setPlaceholderText(ItemStack stack, String text) { ListTag listTag = new ListTag(); - for (String line : text.split("\n")) listTag.add(StringTag.valueOf(line)); + for (String line : text.split("\n")) listTag.add(StringTag.valueOf(line.replaceAll("\r", ""))); stack.getOrCreateTag().put("formatStringLines", listTag); } From 2b783a0c7714450eba671f7d252dfd82cbe87fe2 Mon Sep 17 00:00:00 2001 From: Dominik Sysojew-Osinski Date: Thu, 12 Feb 2026 07:40:47 +0000 Subject: [PATCH 36/78] Fix electrolyzer overlay texture. (#4604) --- .../machines/electrolyzer/overlay_front.png | Bin 314 -> 374 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/gtceu/textures/block/machines/electrolyzer/overlay_front.png b/src/main/resources/assets/gtceu/textures/block/machines/electrolyzer/overlay_front.png index eb8aef6ab7d53faee772c13d8479e9ed4e0705bd..c59c7c2c55a7a669fcef597e53bf232066d5020f 100644 GIT binary patch delta 321 zcmV-H0lxma0`>xsDM10*$t-^W000DMK}|sb0I`n?{9y$E001CkNK#Dz0D2|>0Dy!5 z0Qvv`0D$NK0Cg|`0P0`>06Lfe02gqax=}olJ{W%obV*G`2kHU~4I(ipev@nf007KM zL_t(I%gs{35yLPDlXG1H)?kgykvTF)*1&79Mi?V~$!Di-`)u_AgRK+7z^_r5nAs&F zt&y3Ch+<|J0I-*t0Dy=njewW7ZG(s)GjSXTI`V-aA{xoUL_{DWP*pHz-QA(8P*u2l z>j8DZqgOzAjI0B|zVE~AW_AqY(debr!=XtjL6R7Ud7v25s1CGErY~eoF zy*AszU}7(cu_ua%mw!Mk{b5~KnAy~v%`j^x;} z9dnJ{PLsTa5MFKDrkmNm@3yXML!P^8b+L;Egm*(|<(DiS=qgeC#np9tvo{ zx~_ANDL>D%=P_c{c>Cm#0?CtC9>#G@(E+te0lrjF=6|7@4*yYB-EgMIRI48{{Z^F=Rvw1sBu}A1}k$=4bV@#LZ0-w g!WpH4yD@tME)ySx@vL@U#{d8T07*qoM6N<$f{NFBI{*Lx From 6f5f7144109253ecb6263d330363fb7e3ca6212d Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:04:52 +0200 Subject: [PATCH 37/78] Remove double negative in DaytimeCondition (#4636) --- .../gtceu/common/recipe/condition/DaytimeCondition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DaytimeCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DaytimeCondition.java index 662d1f2607a..295cfa5b13d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DaytimeCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DaytimeCondition.java @@ -43,7 +43,7 @@ public Component getTooltips() { @Override public boolean testCondition(@NotNull GTRecipe recipe, @NotNull RecipeLogic recipeLogic) { Level level = recipeLogic.machine.self().getLevel(); - return level != null && !level.isNight(); + return level != null && level.isDay(); } @Override From 9d5a1af8551c0970d1c53dce1375b5d80cb6fbab Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:09:01 +0200 Subject: [PATCH 38/78] Remove CycleItemStackHandler and CycleFluidStackHandler (#4634) --- .../recipe/ItemRecipeCapability.java | 3 +- .../api/gui/widget/PatternPreviewWidget.java | 6 +- .../gtceu/api/gui/widget/SlotWidget.java | 33 +------- .../gtceu/api/gui/widget/TankWidget.java | 33 +------- .../gtceu/common/data/GCYMRecipeTypes.java | 4 +- .../gtceu/common/data/GTRecipeTypes.java | 4 +- .../fluid/CycleFluidEntryHandler.java | 2 +- .../fluid/CycleFluidStackHandler.java | 84 ------------------- .../handlers/item/CycleItemEntryHandler.java | 13 ++- .../handlers/item/CycleItemStackHandler.java | 71 ---------------- 10 files changed, 25 insertions(+), 228 deletions(-) delete mode 100644 src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidStackHandler.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemStackHandler.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index fb37334542b..239d8a9377b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -27,7 +27,6 @@ import com.gregtechceu.gtceu.integration.xei.entry.item.ItemStackList; import com.gregtechceu.gtceu.integration.xei.entry.item.ItemTagList; import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; -import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; import com.gregtechceu.gtceu.integration.xei.widgets.GTRecipeWidget; import com.gregtechceu.gtceu.utils.*; @@ -455,7 +454,7 @@ public void applyWidgetInfo(@NotNull Widget widget, recipeType); dataItems.add(dataStick); } - CycleItemStackHandler handler = new CycleItemStackHandler(List.of(dataItems)); + CycleItemEntryHandler handler = CycleItemEntryHandler.fromStacks(List.of(dataItems)); slot.setHandlerSlot(handler, 0); slot.setIngredientIO(IngredientIO.CATALYST); slot.setCanTakeItems(false); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java index 3855367f846..a28d389d0dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java @@ -11,7 +11,7 @@ import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; +import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; import com.lowdragmc.lowdraglib.client.scene.WorldSceneRenderer; import com.lowdragmc.lowdraglib.client.utils.RenderUtils; @@ -246,7 +246,7 @@ public void setPage(int index) { } } slotWidgets = new SlotWidget[Math.min(pattern.parts.size(), 18)]; - var itemHandler = new CycleItemStackHandler(pattern.parts); + CycleItemEntryHandler itemHandler = CycleItemEntryHandler.fromStacks(pattern.parts); int xOffset = 0; for (int i = 0; i < slotWidgets.length; i++) { int padding = 1; @@ -301,7 +301,7 @@ private void onPosSelected(BlockPos pos, Direction facing) { } } candidates = new SlotWidget[candidateStacks.size()]; - CycleItemStackHandler itemHandler = new CycleItemStackHandler(candidateStacks); + CycleItemEntryHandler itemHandler = CycleItemEntryHandler.fromStacks(candidateStacks); int maxCol = (160 - (((slotWidgets.length - 1) / 9 + 1) * 18) - 35) % 18; for (int i = 0; i < candidateStacks.size(); i++) { int finalI = i; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java index 4cbd0ce1b0e..ef7f6b23990 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java @@ -5,7 +5,6 @@ import com.gregtechceu.gtceu.integration.xei.entry.item.ItemStackList; import com.gregtechceu.gtceu.integration.xei.entry.item.ItemTagList; import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; -import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; import com.lowdragmc.lowdraglib.gui.editor.annotation.LDLRegister; import com.lowdragmc.lowdraglib.gui.editor.configurator.ConfiguratorGroup; @@ -202,9 +201,7 @@ public Object getXEIIngredientOverMouse(double mouseX, double mouseY) { if (handler == null) return null; ItemStack realStack = getRealStack(handler.getItem()); if (handler instanceof WidgetSlotItemHandler slotHandler) { - if (slotHandler.itemHandler instanceof CycleItemStackHandler stackHandler) { - return getXEIIngredientsClickable(stackHandler, slotHandler.index); - } else if (slotHandler.itemHandler instanceof CycleItemEntryHandler entryHandler) { + if (slotHandler.itemHandler instanceof CycleItemEntryHandler entryHandler) { return getXEIIngredientsClickable(entryHandler, slotHandler.index); } } @@ -228,9 +225,7 @@ public List getXEIIngredients() { if (handler == null) return Collections.emptyList(); ItemStack realStack = getRealStack(handler.getItem()); if (handler instanceof WidgetSlotItemHandler slotHandler) { - if (slotHandler.itemHandler instanceof CycleItemStackHandler stackHandler) { - return getXEIIngredientsClickable(stackHandler, slotHandler.index); - } else if (slotHandler.itemHandler instanceof CycleItemEntryHandler entryHandler) { + if (slotHandler.itemHandler instanceof CycleItemEntryHandler entryHandler) { return getXEIIngredientsClickable(entryHandler, slotHandler.index); } } @@ -245,30 +240,6 @@ public List getXEIIngredients() { return List.of(realStack); } - private List getXEIIngredients(CycleItemStackHandler handler, int index) { - var stackList = handler.getStackList(index); - if (GTCEu.Mods.isJEILoaded()) { - return JEICallWrapper.getJEIIngredients(stackList, this::getRealStack); - } else if (GTCEu.Mods.isREILoaded()) { - return REICallWrapper.getREIIngredients(stackList, this::getRealStack); - } else if (GTCEu.Mods.isEMILoaded()) { - return EMICallWrapper.getEMIIngredients(stackList, getXEIChance(), this::getRealStack); - } - return Collections.emptyList(); - } - - private List getXEIIngredientsClickable(CycleItemStackHandler handler, int index) { - var stackList = handler.getStackList(index); - if (GTCEu.Mods.isJEILoaded()) { - return JEICallWrapper.getJEIIngredientsClickable(stackList, getPosition(), getSize(), this::getRealStack); - } else if (GTCEu.Mods.isREILoaded()) { - return REICallWrapper.getREIIngredients(stackList, this::getRealStack); - } else if (GTCEu.Mods.isEMILoaded()) { - return EMICallWrapper.getEMIIngredients(stackList, getXEIChance(), this::getRealStack); - } - return Collections.emptyList(); - } - private List getXEIIngredients(CycleItemEntryHandler handler, int index) { ItemEntryList entryList = handler.getEntry(index); if (GTCEu.Mods.isJEILoaded()) { 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 7ee62113b23..5230f99742d 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 @@ -8,7 +8,6 @@ import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidStackList; import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidTagList; import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidEntryHandler; -import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidStackHandler; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; @@ -220,9 +219,7 @@ public Object getXEIIngredientOverMouse(double mouseX, double mouseY) { if (self().isMouseOverElement(mouseX, mouseY)) { if (lastFluidInTank == null || lastFluidInTank.isEmpty()) return null; - if (fluidTank instanceof CycleFluidStackHandler stackHandler) { - return getXEIIngredientsClickable(stackHandler, tank).get(0); - } else if (fluidTank instanceof CycleFluidEntryHandler entryHandler) { + if (fluidTank instanceof CycleFluidEntryHandler entryHandler) { return getXEIIngredientsClickable(entryHandler, tank).get(0); } @@ -241,9 +238,7 @@ public Object getXEIIngredientOverMouse(double mouseX, double mouseY) { public List getXEIIngredients() { if (lastFluidInTank == null || lastFluidInTank.isEmpty()) return Collections.emptyList(); - if (fluidTank instanceof CycleFluidStackHandler stackHandler) { - return getXEIIngredientsClickable(stackHandler, tank); - } else if (fluidTank instanceof CycleFluidEntryHandler entryHandler) { + if (fluidTank instanceof CycleFluidEntryHandler entryHandler) { return getXEIIngredientsClickable(entryHandler, tank); } @@ -257,30 +252,6 @@ public List getXEIIngredients() { return List.of(lastFluidInTank); } - private List getXEIIngredients(CycleFluidStackHandler handler, int index) { - FluidStackList stackList = handler.getStackList(index); - if (GTCEu.Mods.isJEILoaded()) { - return JEICallWrapper.getJEIIngredients(stackList); - } else if (GTCEu.Mods.isREILoaded()) { - return REICallWrapper.getREIIngredients(stackList); - } else if (GTCEu.Mods.isEMILoaded()) { - return EMICallWrapper.getEMIIngredients(stackList, getXEIChance()); - } - return Collections.emptyList(); - } - - private List getXEIIngredientsClickable(CycleFluidStackHandler handler, int index) { - FluidStackList stackList = handler.getStackList(index); - if (GTCEu.Mods.isJEILoaded()) { - return JEICallWrapper.getJEIIngredientsClickable(stackList, getPosition(), getSize()); - } else if (GTCEu.Mods.isREILoaded()) { - return REICallWrapper.getREIIngredients(stackList); - } else if (GTCEu.Mods.isEMILoaded()) { - return EMICallWrapper.getEMIIngredients(stackList, getXEIChance()); - } - return Collections.emptyList(); - } - private List getXEIIngredients(CycleFluidEntryHandler handler, int index) { FluidEntryList entryList = handler.getEntry(index); if (GTCEu.Mods.isJEILoaded()) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java index 34a3c1c3257..36189576669 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java @@ -6,7 +6,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; -import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; +import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; @@ -56,7 +56,7 @@ public class GCYMRecipeTypes { items.add(GTCEuAPI.HEATING_COILS.entrySet().stream() .filter(coil -> coil.getKey().getCoilTemperature() >= temp) .map(coil -> new ItemStack(coil.getValue().get())).toList()); - widgetGroup.addWidget(new SlotWidget(new CycleItemStackHandler(items), 0, + widgetGroup.addWidget(new SlotWidget(CycleItemEntryHandler.fromStacks(items), 0, widgetGroup.getSize().width - 25, widgetGroup.getSize().height - 40, false, false)); }) .setSound(GTSoundEntries.ARC); 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 ff9a74be382..35e97e539dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -23,7 +23,7 @@ import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidEntryList; import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidHolderSetList; import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidEntryHandler; -import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; +import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.ResearchManager; @@ -525,7 +525,7 @@ public class GTRecipeTypes { items.add(GTCEuAPI.HEATING_COILS.entrySet().stream() .filter(coil -> coil.getKey().getCoilTemperature() >= temp) .map(coil -> new ItemStack(coil.getValue().get())).toList()); - widgetGroup.addWidget(new SlotWidget(new CycleItemStackHandler(items), 0, + widgetGroup.addWidget(new SlotWidget(CycleItemEntryHandler.fromStacks(items), 0, widgetGroup.getSize().width - 25, widgetGroup.getSize().height - 32, false, false)); }) .setSound(GTSoundEntries.FURNACE); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidEntryHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidEntryHandler.java index 059f60ddc58..5da77a94151 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidEntryHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidEntryHandler.java @@ -70,7 +70,7 @@ public int getTankCapacity(int tank) { @Override public boolean isFluidValid(int tank, @NotNull FluidStack stack) { - return true; + return false; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidStackHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidStackHandler.java deleted file mode 100644 index bb12e23cc97..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/fluid/CycleFluidStackHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.gregtechceu.gtceu.integration.xei.handlers.fluid; - -import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; -import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidStackList; - -import net.minecraftforge.fluids.FluidStack; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class CycleFluidStackHandler implements IFluidHandlerModifiable { - - private final List stacks; - - public CycleFluidStackHandler(List> stacks) { - this.stacks = new ArrayList<>(); - for (var list : stacks) { - this.stacks.add(FluidStackList.of(list)); - } - } - - @Override - public int getTanks() { - return this.stacks.size(); - } - - @NotNull - @Override - public FluidStack getFluidInTank(int tank) { - List stackList = stacks.get(tank).getStacks(); - return stackList != null && !stackList.isEmpty() ? - stackList.get(Math.abs((int) (System.currentTimeMillis() / 1000L) % stackList.size())) : - FluidStack.EMPTY; - } - - @Override - public void setFluidInTank(int tank, @NotNull FluidStack fluidStack) { - if (tank >= 0 && tank < this.stacks.size()) { - this.stacks.set(tank, FluidStackList.of(fluidStack)); - } - } - - @Override - public int getTankCapacity(int tank) { - return this.getFluidInTank(tank).getAmount(); - } - - @Override - public boolean isFluidValid(int tank, @NotNull FluidStack stack) { - return false; - } - - @Override - public int fill(FluidStack resource, FluidAction action) { - return 0; - } - - @Override - public boolean supportsFill(int tank) { - return false; - } - - @NotNull - @Override - public FluidStack drain(FluidStack resource, FluidAction action) { - return FluidStack.EMPTY; - } - - @Override - public @NotNull FluidStack drain(int maxDrain, FluidAction action) { - return FluidStack.EMPTY; - } - - @Override - public boolean supportsDrain(int tank) { - return false; - } - - public FluidStackList getStackList(int i) { - return this.stacks.get(i); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemEntryHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemEntryHandler.java index 5dac3e5391a..c2229967630 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemEntryHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemEntryHandler.java @@ -23,6 +23,17 @@ public CycleItemEntryHandler(List entries) { this.entries = new ArrayList<>(entries); } + public static CycleItemEntryHandler fromStacks(List> stacks) { + List entries = new ArrayList<>(); + for (var list : stacks) { + entries.add(ItemStackList.of(list)); + } + CycleItemEntryHandler handler = new CycleItemEntryHandler(entries); + handler.unwrapped = new ArrayList<>(stacks); + + return handler; + } + public List> getUnwrapped() { if (unwrapped == null) { unwrapped = entries.stream() @@ -81,6 +92,6 @@ public int getSlotLimit(int slot) { @Override public boolean isItemValid(int slot, @NotNull ItemStack stack) { - return true; + return false; } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemStackHandler.java deleted file mode 100644 index 755bbaa65f4..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/handlers/item/CycleItemStackHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.gregtechceu.gtceu.integration.xei.handlers.item; - -import com.gregtechceu.gtceu.integration.xei.entry.item.ItemStackList; - -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.items.IItemHandlerModifiable; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nonnull; - -public class CycleItemStackHandler implements IItemHandlerModifiable { - - private final List stacks; - - public CycleItemStackHandler(List> stacks) { - this.stacks = new ArrayList<>(); - for (var list : stacks) { - this.stacks.add(ItemStackList.of(list)); - } - } - - @Override - public int getSlots() { - return stacks.size(); - } - - @Nonnull - @Override - public ItemStack getStackInSlot(int i) { - List stackList = stacks.get(i).getStacks(); - return stackList == null || stackList.isEmpty() ? ItemStack.EMPTY : - stackList.get(Math.abs((int) (System.currentTimeMillis() / 1000) % stackList.size())); - } - - @Override - public void setStackInSlot(int index, @NotNull ItemStack stack) { - if (index >= 0 && index < stacks.size()) { - stacks.set(index, ItemStackList.of(stack)); - } - } - - public ItemStackList getStackList(int i) { - return stacks.get(i); - } - - @NotNull - @Override - public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { - return stack; - } - - @NotNull - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate) { - return ItemStack.EMPTY; - } - - @Override - public int getSlotLimit(int i) { - return 64; - } - - @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { - return true; - } -} From a616fb80e07147982cfacbde2e654d1ab5c0ece9 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:13:36 +0200 Subject: [PATCH 39/78] Remove a ton of unused pipe restrictor textures (#4638) --- .../data/model/builder/PipeModelBuilder.java | 38 ------------------ .../block/pipe/blocked/pipe_blocked_dl.png | Bin 283 -> 0 bytes .../block/pipe/blocked/pipe_blocked_down.png | Bin 220 -> 0 bytes .../block/pipe/blocked/pipe_blocked_dr.png | Bin 268 -> 0 bytes .../block/pipe/blocked/pipe_blocked_left.png | Bin 224 -> 0 bytes .../block/pipe/blocked/pipe_blocked_lr.png | Bin 281 -> 0 bytes .../block/pipe/blocked/pipe_blocked_nd.png | Bin 331 -> 0 bytes .../block/pipe/blocked/pipe_blocked_nl.png | Bin 319 -> 0 bytes .../block/pipe/blocked/pipe_blocked_nr.png | Bin 322 -> 0 bytes .../block/pipe/blocked/pipe_blocked_nu.png | Bin 334 -> 0 bytes .../block/pipe/blocked/pipe_blocked_rd.png | Bin 268 -> 0 bytes .../block/pipe/blocked/pipe_blocked_right.png | Bin 220 -> 0 bytes .../block/pipe/blocked/pipe_blocked_ud.png | Bin 278 -> 0 bytes .../block/pipe/blocked/pipe_blocked_ul.png | Bin 270 -> 0 bytes .../block/pipe/blocked/pipe_blocked_up.png | Bin 222 -> 0 bytes .../block/pipe/blocked/pipe_blocked_ur.png | Bin 279 -> 0 bytes 16 files changed, 38 deletions(-) delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_dl.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_down.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_dr.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_left.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_lr.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nd.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nl.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nr.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nu.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_rd.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_right.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ud.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ul.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_up.png delete mode 100644 src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ur.png diff --git a/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java index 57ffd1f470c..e9a72cf2c3a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/model/builder/PipeModelBuilder.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonObject; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.Getter; import lombok.experimental.Accessors; import org.jetbrains.annotations.ApiStatus; @@ -324,43 +323,6 @@ public JsonObject toJson(JsonObject json) { } private static final ResourceLocation PIPE_BLOCKED_OVERLAY = GTCEu.id("block/pipe/blocked/pipe_blocked"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UP = GTCEu.id("block/pipe/blocked/pipe_blocked_up"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_DOWN = GTCEu.id("block/pipe/blocked/pipe_blocked_down"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_LEFT = GTCEu.id("block/pipe/blocked/pipe_blocked_left"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_RIGHT = GTCEu - .id("block/pipe/blocked/pipe_blocked_right"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_NU = GTCEu.id("block/pipe/blocked/pipe_blocked_nu"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_ND = GTCEu.id("block/pipe/blocked/pipe_blocked_nd"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_NL = GTCEu.id("block/pipe/blocked/pipe_blocked_nl"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_NR = GTCEu.id("block/pipe/blocked/pipe_blocked_nr"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UD = GTCEu.id("block/pipe/blocked/pipe_blocked_ud"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UL = GTCEu.id("block/pipe/blocked/pipe_blocked_ul"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_UR = GTCEu.id("block/pipe/blocked/pipe_blocked_ur"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_DL = GTCEu.id("block/pipe/blocked/pipe_blocked_dl"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_DR = GTCEu.id("block/pipe/blocked/pipe_blocked_dr"); - private static final ResourceLocation PIPE_BLOCKED_OVERLAY_LR = GTCEu.id("block/pipe/blocked/pipe_blocked_lr"); - - private static final Int2ObjectMap RESTRICTOR_MAP = Util.make(() -> { - Int2ObjectMap map = new Int2ObjectOpenHashMap<>(); - - addRestrictor(map, PIPE_BLOCKED_OVERLAY_UP, Border.TOP); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_DOWN, Border.BOTTOM); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_UD, Border.TOP, Border.BOTTOM); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_LEFT, Border.LEFT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_UL, Border.TOP, Border.LEFT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_DL, Border.BOTTOM, Border.LEFT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_NR, Border.TOP, Border.BOTTOM, Border.LEFT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_RIGHT, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_UR, Border.TOP, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_DR, Border.BOTTOM, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_NL, Border.TOP, Border.BOTTOM, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_LR, Border.LEFT, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_ND, Border.TOP, Border.LEFT, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY_NU, Border.BOTTOM, Border.LEFT, Border.RIGHT); - addRestrictor(map, PIPE_BLOCKED_OVERLAY, Border.TOP, Border.BOTTOM, Border.LEFT, Border.RIGHT); - - return map; - }); private static BlockModelBuilder[] getOrCreateRestrictorModels(BlockModelProvider provider, float thickness) { return RESTRICTOR_MODEL_CACHE.apply(provider, thickness); diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_dl.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_dl.png deleted file mode 100644 index e07a3ff04d74e6b5a2cb83af6c277fcad0d63c3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!Yyx~jT!AzzE31^0l$@NLo}QkC zg@vuHt)HJ?OiWC1adBN;U44ChV`JmgsZ(dpoH={;?3F85u3EKf-MV#Kwru(H_ZrAx z#*!evUVmd3!_heTTC`85UYU zM2(lv+%x0B+ZFZKcWXaWZ8A8mek|X-o=V^1Iiw2HQ(|Ob0rQ!PC{xWt~$(69A1{ZNLBk diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_down.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_down.png deleted file mode 100644 index 5b77df828cbe0754ade62096d75a765f31f034cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!j01c^TqoGav$C>ENlD4c$?56o zSy))u+SuwQALtEn9ZH3s?Zu&R7!U7tG-B z>_!@p6YlBa7!q;#?d9Eq2Mjov17=#ZY25$2-1i}45qs*FDozas7cdB#HFG*wk4;_d z1uL;4=hr7+X8%w)e0=7eL(M8DU!S~ZApPm*&4824a$9XS-2e65Uw>W}Q!?A!DP2G- O7(8A5T-G@yGywqGuu{|j diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_dr.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_dr.png deleted file mode 100644 index 0bbdcfd783605d4a0ef4376850d13c980c4ed751..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 268 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!j01c^T)#g#!ph1jB_$;%C#R>U zXJKJsYik=56H{DVTvu0DUtizY*f?|M%-OSNuUxru)v8rnwro*;v{n_Uov|dyFPOpM z*^M+Hr`^-VF(l&f+bNbphaEUr7}tuKI352V|N21L8!fd>zRxdLi}ZM0Hu1guhr#Vx zX{n!ql1KC6oB-p^sf%(9_H@n_nG^o@>&%(a4A0NjDowwB@@cA!xnzopr0EF6Y`v3p{ diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_left.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_left.png deleted file mode 100644 index 5221719ca2f21070108fa48cdb68e8a8a9d9fdc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!%mREuTzCEd&&tXwB_*Y&r)Obd zVQXva=jRs_6H{DVTwh<`*w{FA>eQJtXU?8Id*#ZNt5&UAw{G2*EnA*WYY73Gz*rLG z7tG-B>_!@p6XEIN7!q;#?PY7R1_KV4z#e&zrp|Zun}c>RE&EvU>|4H;fTEJpuVqZ% zPG8$lColXuoBel|JLjx-@$;l2cx427TMH|9sP4V6(Kui;o8BB@8`tON!h#p&ZG0v& VIh{&WJqomg!PC{xWt~$(69BEBQo8^E diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_lr.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_lr.png deleted file mode 100644 index 2b304caed0ddfc2fe70d606a6e605ac8341bd390..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!Yyx~jT!AzzE31^0l$@NLo}QkC zg@vuHt)HJ?OiWC1adBN;U44ChV`JmgsZ(dpoH={;?3F85u3EKf-MV#Kwru(H_ZrAx z#*!evUO`J<^f>*3!0886DN{Q6nzaMmY$zpSa~iDR6Pw%?h`q#7?D5_%!{&HciYA7z8& z{HE?>nbYnz>4CWVnv>rgud>&wOl5g0@b{@!(zQ2^uk-zvdTwUF>>Rp$<%17jf##>2 ZVw)zw8vJyBha%8222WQ%mvv4FO#r8iZ;b!| diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nd.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nd.png deleted file mode 100644 index 4a9c81ee52d311ebe5dbf9b3ec58e03e41430b90..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 331 zcmV-R0kr;!P)>%tP1IYRjB?+}(lJMy7PjEiZ0kK>X^(DlMnGlzH@5UjL z=rjI701#buo|WIi35%_d4B2_u`Y$uQGlbTY#h){4N*mMO{XehWK66YMG4@+g~n{@OQ dMNyP55{h+IE6uAj=zs@BJC z9{ICXS%j0{|2r2mW4x Rek%X~002ovPDHLkV1hughK&FK diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nr.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nr.png deleted file mode 100644 index 49ba54b4e664a6576c54d925697ab14f366dfc50..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 322 zcmV-I0lof-P)bu_|Z7fG*=uXo@`imRq2N=Rs0ETe+^8{UEcOZ5@T8>b=Y``hC=ck}Rqn_~r z0Bh|%_Ic>Pq-=h#mCWzxoF6-#|C_3+rTt&!;$v|VAm%`vt>yE_oExHuxmS{Kbn+{< zvCTtIuFBbr8ZGU2Y|OwbeRSyRRsgqh5LpcXk*kA1$?2lg5V U`lo^QsQ>@~07*qoM6N<$g1SPDnE(I) diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nu.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_nu.png deleted file mode 100644 index ff0957cd863680b97adc1b3b6aedd51d98492130..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 334 zcmV-U0kQsxP)*qTaRC6R_Vj2np_C0>0RNRIO2;Nkc;8Cc48?fY@>lq&t-gw&fhy zi&jlb3x=*f@muhU8C4n|=C1?z!e*t``0QIcv9hvCNlD4c$?56o zSy))u+SuwQALtEn9p##Lob=GnNGT1v5B2 zyO9Ruw0pWZhD02GJH=AyumcAR<61Ejr{n+QUmqxYqouaV_xa^&ksgoBCcc;dFt|M{ zE%h@{@@QV16JWeKby1GNp3b=Go)78&qol`;+09I>kp8x;= diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_right.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_right.png deleted file mode 100644 index 09307337abe5429a3555be76b8f394b0f8ce7137..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!j01c^Tql%VVP$2Nl9G~>lhf1F zv#_wRwY80ji775FuB)r7udi=xY@9iB=Iq(CSFT*SYSpSOTed`$HTM9uGnNGT1v5B2 zyO9RugnPO;hDb=hJ$O*CL4k+mfbybFLFK>U+VWBg^2c|^3J41RZB$tPrfW*pGLJy> zqqCF_m+hFH)cGStJgme2V?yh;hbG@&cm(wKwG_FyyY00ulIrN_*!Pn4NiI|J)}vQb QfL1Vgy85}Sb4q9e05;4}Qvd(} diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ud.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ud.png deleted file mode 100644 index d261c7db23d831732d46889f1339730965e26c0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 278 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!Yyx~jT!AzzE31^0l$@NLo}QkC zg@vuHt)HJ?OiWC1adBN;U44ChV`JmgsZ(dpoH={;?3F85u3EKf-MV#Kwru(H_ZrAx z#*!evUYXy6^8-I`}mt?m3+G8K^V6Xkx`K|i775FuCK3eY;2r5b?VHSGiT49y>jKsRjXF5Teoh@mMuL$m_>jlFqQ=Q z1v5B2yO9Ruw0XKXhD02GJH=3_Re{Gv@UI$o;Fo{XMct~?H(f3N)D`eH+rw<>gWgQF z&-S8v{040k(|OA8<)1hmC;B4Uc>cmITbPbl+)X*KBL7c=!eQJtXU?8Id*#ZNt5&UAw{G2*EnC*xaUKDhz*rLG z7tG-B>_!@p6XxmS7!q;#?PYJi1_c3@z$5%y`WAiPzeb2Z!DzGbSFsJRZV3b(nx4q> z?s-&FwPw(Z-yRR|{^qW<+NNcDJa6BjTbGpP{w+H_sde5*_Qs^LkMkLUhW@y7{V0=D TuH+|0Acw)z)z4*}Q$iB}v_V&P diff --git a/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ur.png b/src/main/resources/assets/gtceu/textures/block/pipe/blocked/pipe_blocked_ur.png deleted file mode 100644 index a72b0c98dcd1b5ceb2652a862a9ea519869bb487..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!Yyx~jTyu*9Sy@@7q@?8Jgww2>l+&zr%s(ZbLPz1vuCedxpLL2RqNKR+p=X#om=ez zpgD{sL4Lsu4$p3+0XdzXE{-7)hu=;;$k(F4+k2W7`&2>S6Gqeex~?C zQj6~IjYUn1yrfp`U%lCcEh(NuuSAh`_xd%_?lWtD?X%e7{^V2TqfaYya;`@C6brC8 behBc3_{bW(%HX>h&`}JYu6{1-oD!M<1}1Q7 From d2be6bd7435ff57ce4136998c013f269559b0f21 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:14:41 +0200 Subject: [PATCH 40/78] Fix the bone meal -> white dye recipe being deleted unconditionally (#4637) --- .../gtceu/data/recipe/configurable/RecipeRemoval.java | 7 +++---- .../gtceu/data/recipe/misc/VanillaStandardRecipes.java | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java index 73403a9aabd..667cb5e47ce 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java @@ -75,9 +75,6 @@ private static void generalRemovals(Consumer registry) { registry.accept(new ResourceLocation("minecraft:soul_torch")); registry.accept(new ResourceLocation("minecraft:soul_lantern")); registry.accept(new ResourceLocation("minecraft:leather_horse_armor")); - - // remove vanilla dye recipes to gregify - registry.accept(new ResourceLocation("minecraft:white_dye")); } /** @@ -291,7 +288,9 @@ private static void hardDyeRecipes(Consumer registry) { registry.accept(new ResourceLocation(String.format("minecraft:dye_%s_wool", colorMaterial.getName()))); registry.accept(new ResourceLocation(String.format("minecraft:dye_%s_carpet", colorMaterial.getName()))); registry.accept(new ResourceLocation(String.format("minecraft:dye_%s_bed", colorMaterial.getName()))); - registry.accept(new ResourceLocation("minecraft:black_dye")); + + registry.accept(new ResourceLocation("white_dye")); + registry.accept(new ResourceLocation("black_dye")); registry.accept(new ResourceLocation("black_dye_from_wither_rose")); registry.accept(new ResourceLocation("blue_dye")); registry.accept(new ResourceLocation("white_dye_from_lily_of_the_valley")); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index 7d996a54f0b..d9b8c06d767 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -1372,11 +1372,13 @@ private static void dyeRecipes(Consumer provider) { .inputItems(new ItemStack(Items.BONE_MEAL)) .outputItems(new ItemStack(Items.WHITE_DYE, 1)) .save(provider); - EXTRACTOR_RECIPES.recipeBuilder("lapis_dye") + + EXTRACTOR_RECIPES.recipeBuilder("blue_dye") .inputItems(new ItemStack(Items.LAPIS_LAZULI)) .outputItems(new ItemStack(Items.BLUE_DYE)) .save(provider); - EXTRACTOR_RECIPES.recipeBuilder("ink_dye") + + EXTRACTOR_RECIPES.recipeBuilder("black_dye") .inputItems(new ItemStack(Items.INK_SAC)) .outputItems(new ItemStack(Items.BLACK_DYE)) .save(provider); From 0a764a448943045640263bb164c9b4d65fe5df52 Mon Sep 17 00:00:00 2001 From: Gustavo <77560533+gustovafing@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:21:24 +0800 Subject: [PATCH 41/78] add simple cooking recipe builder (#4643) --- docs/content/Modpacks/Changes/v8.0.0.md | 146 ++++++++++++++++ .../data/recipe/VanillaRecipeHelper.java | 20 ++- .../recipe/builder/BlastingRecipeBuilder.java | 145 ---------------- .../recipe/builder/CampfireRecipeBuilder.java | 145 ---------------- .../builder/SimpleCookingRecipeBuilder.java | 161 ++++++++++++++++++ .../recipe/builder/SmeltingRecipeBuilder.java | 145 ---------------- .../recipe/builder/SmokingRecipeBuilder.java | 145 ---------------- .../data/recipe/builder/package-info.java | 4 + 8 files changed, 322 insertions(+), 589 deletions(-) create mode 100644 docs/content/Modpacks/Changes/v8.0.0.md delete mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java diff --git a/docs/content/Modpacks/Changes/v8.0.0.md b/docs/content/Modpacks/Changes/v8.0.0.md new file mode 100644 index 00000000000..9e9aae3f31a --- /dev/null +++ b/docs/content/Modpacks/Changes/v8.0.0.md @@ -0,0 +1,146 @@ +--- +title: "Version 8.0.0" +--- + + +# Updating from `7.4.0` to `8.0.0` + +## New Data Save/Sync System + +A new system for saving and syncing object fields has been added. See [this page](../../Development/Data-Sync-System/Migrating-From-LDLib-SyncData.md) for migration instructions. + +## Machine Refactor + +Many aspects of the machine classes have been refactored and changed in order to streamline the machine system and remove legacy and unnecessary abstraction. + +### `MetaMachine` and `MetaMachineBlockEntity` merge + +- The `MetaMachineBlockEntity`(MMBE) class has been removed, and `MetaMachine`(MM) is now a BlockEntity. +- Most methods and properties of MMBE have been moved onto MM. +- The `IMachineBlockEntity` interface has been removed. Use `MetaMachineBlock` directly instead. +- Many methods common to all block entities have been moved to the `IGregtechBlockEntity` interface. +- Machine instance creation functions have signature `(BlockEntityCreationInfo) -> MetaMachine` instead of `(IMachineBlockEntity) -> MetaMachine` + +References to MMBE can generally be replaced with references to MM: +```java +/////// OLD +if (level.getBlockEntity(getPos()) instanceof MetaMachineBlockEntity mmbe) { + MetaMachine machine = mmbe.getMetaMachine(); + ... +} + +////// NEW +if (level.getBlockEntity(getPos()) instanceof MetaMachine machine) { + ... +} +``` + +The `IMachineBlockEntity holder` argument in machine constructors has been replaced with `BlockEntityCreationInfo info`: +```java +////// OLD +public MetaMachine(IMachineBlockEntity holder); +////// NEW +public MetaMachine(BlockEntityCreationInfo info); +``` +A number of methods have been renamed across a number of different interfaces and classes to ensure consistency with default BlockEntity methods: + +- `BlockPos getPipePos()` -> `BlockPos getBlockPos()` +- `Level getPipeLevel()` -> `Level getLevel()` +- `BlockPos getPos()` -> `BlockPos getBlockPos()` +- `BlockState getState()` -> `BlockState getBlockState()` +- `boolean isInvalid()` -> `boolean isRemoved()` +- `void markAsDirty()` -> `void markAsChanged()` + +### Machine constructor and trait initialisation changes + +The constructors for a large number of machines have changed in order to simply machine instance creation. Additionally, methods for trait creation have also been removed and now form part of the machine constructor. + +#### **All Machines** +- Replace the first constructor argument `IMachineBlockEntity holder` with `BlockEntityCreationInfo info` +#### `TieredEnergyMachine` +- Removed `createEnergyContainer` method +- Constructor now has an optional `Supplier` argument +#### `WorkableTieredMachine` +- Removed `createRecipeLogic`, `createImportItemHandler`, `createExportItemHandler`, `createImportFluidHandler`, `createExportFluidHandler` methods +- Added a new constructor: + - `BlockEntityCreationInfo info` + - `int tier` + - `Supplier recipeLogicSupplier` Recipe logic supplier, defaults to the standard `RecipeLogic` class. + - `int importSlots` Item import slots, defaults to the amount of slots in the machine's default recipe type. + - `int exportSlots` Same as above, but for item export slots. + - `int fluidImportSlots` As above, but for fluid import slots. + - `int fluidExportSlots` As above, but for fluid export slots. + - `Int2IntFunction tankScalingFunction` Fluid tank capacity scaling function. +#### `WorkableMultiblockMachine`, `WorkableElectricMultiblockMachine` and `SteamWorkableMachine` +- Removed `createRecipeLogic` method +- Constructor now has an optional `Supplier` argument, defaults to the standard `RecipeLogic` class + +## Machine Trait Refactor + +A new system for attaching traits and custom behaviour to machines has been added, and many machine interfaces and traits now use this new system. + +### New System Example + +Example of the new `AutoOutputTrait` + +```java +public class CustomDrumMachine extends MetaMachine { + + protected final NotifiableFluidTank tank; + public final AutoOutputTrait autoOutput; + + public DrumMachine(BlockEntityCreationInfo info, int capacity) { + super(info); + + // Traits must be attached in the constructor. + + this.tank = new NotifiableFluidTank(this, 1, capacity, IO.BOTH); + + // Registers an auto output trait that provides fluid output behaviour for the given fluid tank. + this.autoOutput = AutoOutputTrait.ofFluids(this, tank); + + autoOutput.setFluidOutputDirection(Direction.DOWN); + autoOutput.setFluidOutputDirectionValidator(d -> d == Direction.DOWN); + } + + // Any code can query traits from a machine + public static void queryTraits(MetaMachine machine) { + + // Returns a trait with the given type, or null. + AutoOutputTrait autoOutputTrait = machine.getTraitHolder().getTrait(AutoOutputTrait.TYPE); + + Optional recipeLogicOptional = machine.getTraitHolder().getTrait(RecipeLogic.TYPE); + + // Gets all traits with the specified type. + List allItemStackHandlers = machine.getTraitHolder().getTraits(NotifiableItemStackHandler.TYPE); + + } +} +``` + +### Removed interfaces + +A large number of machine feature interfaces have been removed, and have had their functionality merged into the standard MetaMachine class, or now use the new machine trait system: + +- `ITurbineMachine` Use the `LargeTurbineMachine` class directly. +- `IRotorHolderMachine` Use the `RotorHolderMachine` class directly. +- `IMultiController` Use the `MultiblockControllerMachine` class directly. +- `IMufflerMachine` Use the `MufflerMachine` class directly. +- `IMachineLife` Override the `MetaMachine::onMachinePlaced` and `MetaMachine::onMachineDestroyed`. +- `IMachineModifyDrops` Override `MetaMachine::modifyDrops`. +- `IInteractedMachine` Override `MetaMachine::onUse` and `MetaMachine::onLeftClick`. +- `ICleanroomReceiver` & `ICleanroomProvider` - Use `CleanroomReceiverTrait` and `CleanroomProviderTrait`. +- `IAutoOutputBoth`, `IAutoOutputFluid`, `IAutoOutputItem` - Use `AutoOutputTrait`. +- `IExplosionMachine` - Use `EnvironmentalExplosionTrait`, `GTUtil::doExplosion`, and `GTUtil::setOnFire` +- `IEnvironmentalHazardCleaner` Use `EnvironmentalHazardCleanerTrait` +- `ILocalizedHazardEmitter` - Use `LocalizedHazardEmitterTrait` +- `IExhaustVentMachine` - Use `ExhaustVentMachineTrait` +- `IHPCAComponentHatch` - Use `HPCAComponentTrait` +- `IHPCAComputationProvider` - Use `HPCAComputationProviderTrait` +- `IHPCACoolantProvider` - Use `HPCACoolantProviderTrait` + + +## Other Changes + +- `BlastingRecipeBuilder`, `CampfireRecipeBuilder`, `SmeltingRecipeBuilder` and `SmokingRecipeBuilder` have been merged into `SimpleCookingRecipeBuilder` + - Example usage: `SimpleCookingRecipeBuilder.campfireCooking("cooking_chicken").input(new ItemStack(Items.CHICKEN)).output(new ItemStacks(Items.COOKED_CHICKEN)).cookingTime(100).experience(100).save(provider);` \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java index e9d7013bf87..2421207276a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java @@ -64,13 +64,13 @@ public static void addSmeltingRecipe(Consumer provider, @NotNull public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, Ingredient input, ItemStack output, float experience) { - new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) + SimpleCookingRecipeBuilder.smelting(regName).input(input).output(output).cookingTime(200).experience(experience) .save(provider); } public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) + SimpleCookingRecipeBuilder.smelting(regName).input(input).output(output).cookingTime(200).experience(experience) .save(provider); } @@ -97,7 +97,7 @@ public static void addSmeltingRecipe(Consumer provider, @NotNull public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) + SimpleCookingRecipeBuilder.smelting(regName).input(input).output(output).cookingTime(200).experience(experience) .save(provider); } @@ -133,13 +133,13 @@ public static void addBlastingRecipe(Consumer provider, @NotNull public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, Ingredient input, ItemStack output, float experience) { - new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + SimpleCookingRecipeBuilder.blasting(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + SimpleCookingRecipeBuilder.blasting(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } @@ -171,13 +171,13 @@ public static void addSmokingRecipe(Consumer provider, @NotNull public static void addSmokingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new SmokingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + SimpleCookingRecipeBuilder.smoking(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } public static void addSmokingRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - new SmokingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + SimpleCookingRecipeBuilder.smoking(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } @@ -199,7 +199,8 @@ public static void addCampfireRecipe(Consumer provider, @NotNull public static void addCampfireRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - new CampfireRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + SimpleCookingRecipeBuilder.campfireCooking(regName).input(input).output(output).cookingTime(100) + .experience(experience) .save(provider); } @@ -215,7 +216,8 @@ public static void addCampfireRecipe(Consumer provider, @NotNull public static void addCampfireRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new CampfireRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + SimpleCookingRecipeBuilder.campfireCooking(regName).input(input).output(output).cookingTime(100) + .experience(experience) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java deleted file mode 100644 index 1b5718716f7..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.gregtechceu.gtceu.data.recipe.builder; - -import com.gregtechceu.gtceu.GTCEu; - -import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.StrictNBTIngredient; - -import com.google.gson.JsonObject; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Consumer; - -@Accessors(chain = true, fluent = true) -public class BlastingRecipeBuilder { - - private Ingredient input; - @Setter - protected String group; - - private ItemStack output = ItemStack.EMPTY; - @Setter - private float experience; - @Setter - private int cookingTime; - @Setter - protected ResourceLocation id; - - public BlastingRecipeBuilder(@Nullable ResourceLocation id) { - this.id = id; - } - - public BlastingRecipeBuilder input(TagKey itemStack) { - return input(Ingredient.of(itemStack)); - } - - public BlastingRecipeBuilder input(ItemStack itemStack) { - input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); - return this; - } - - public BlastingRecipeBuilder input(ItemLike itemLike) { - return input(Ingredient.of(itemLike)); - } - - public BlastingRecipeBuilder input(Ingredient ingredient) { - input = ingredient; - return this; - } - - public BlastingRecipeBuilder output(ItemStack itemStack) { - this.output = itemStack.copy(); - return this; - } - - public BlastingRecipeBuilder output(ItemStack itemStack, int count) { - this.output = itemStack.copy(); - this.output.setCount(count); - return this; - } - - public BlastingRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { - this.output = itemStack.copy(); - this.output.setCount(count); - this.output.setTag(nbt); - return this; - } - - protected ResourceLocation defaultId() { - return BuiltInRegistries.ITEM.getKey(output.getItem()); - } - - public void toJson(JsonObject json) { - if (group != null) { - json.addProperty("group", group); - } - - if (!input.isEmpty()) { - json.add("ingredient", input.toJson()); - } - - if (output.isEmpty()) { - GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); - throw new IllegalArgumentException(id + ": output items is empty"); - } else { - JsonObject result = new JsonObject(); - result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); - if (output.getCount() > 1) { - result.addProperty("count", output.getCount()); - } - if (output.hasTag() && output.getTag() != null) { - result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); - } - json.add("result", result); - } - - json.addProperty("experience", experience); - json.addProperty("cookingtime", cookingTime); - } - - public void save(Consumer consumer) { - consumer.accept(new FinishedRecipe() { - - @Override - public void serializeRecipeData(JsonObject pJson) { - toJson(pJson); - } - - @Override - public ResourceLocation getId() { - var ID = id == null ? defaultId() : id; - return new ResourceLocation(ID.getNamespace(), "blasting" + "/" + ID.getPath()); - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.BLASTING_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } - }); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java deleted file mode 100644 index b95064c1fad..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.gregtechceu.gtceu.data.recipe.builder; - -import com.gregtechceu.gtceu.GTCEu; - -import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.StrictNBTIngredient; - -import com.google.gson.JsonObject; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Consumer; - -@Accessors(chain = true, fluent = true) -public class CampfireRecipeBuilder { - - private Ingredient input; - @Setter - protected String group; - - private ItemStack output = ItemStack.EMPTY; - @Setter - private float experience; - @Setter - private int cookingTime; - @Setter - protected ResourceLocation id; - - public CampfireRecipeBuilder(@Nullable ResourceLocation id) { - this.id = id; - } - - public CampfireRecipeBuilder input(TagKey itemStack) { - return input(Ingredient.of(itemStack)); - } - - public CampfireRecipeBuilder input(ItemStack itemStack) { - input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); - return this; - } - - public CampfireRecipeBuilder input(ItemLike itemLike) { - return input(Ingredient.of(itemLike)); - } - - public CampfireRecipeBuilder input(Ingredient ingredient) { - input = ingredient; - return this; - } - - public CampfireRecipeBuilder output(ItemStack itemStack) { - this.output = itemStack.copy(); - return this; - } - - public CampfireRecipeBuilder output(ItemStack itemStack, int count) { - this.output = itemStack.copy(); - this.output.setCount(count); - return this; - } - - public CampfireRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { - this.output = itemStack.copy(); - this.output.setCount(count); - this.output.setTag(nbt); - return this; - } - - protected ResourceLocation defaultId() { - return BuiltInRegistries.ITEM.getKey(output.getItem()); - } - - public void toJson(JsonObject json) { - if (group != null) { - json.addProperty("group", group); - } - - if (!input.isEmpty()) { - json.add("ingredient", input.toJson()); - } - - if (output.isEmpty()) { - GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); - throw new IllegalArgumentException(id + ": output items is empty"); - } else { - JsonObject result = new JsonObject(); - result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); - if (output.getCount() > 1) { - result.addProperty("count", output.getCount()); - } - if (output.hasTag() && output.getTag() != null) { - result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); - } - json.add("result", result); - } - - json.addProperty("experience", experience); - json.addProperty("cookingtime", cookingTime); - } - - public void save(Consumer consumer) { - consumer.accept(new FinishedRecipe() { - - @Override - public void serializeRecipeData(JsonObject pJson) { - toJson(pJson); - } - - @Override - public ResourceLocation getId() { - var ID = id == null ? defaultId() : id; - return new ResourceLocation(ID.getNamespace(), "campfire" + "/" + ID.getPath()); - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.CAMPFIRE_COOKING_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } - }); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java new file mode 100644 index 00000000000..cd8d604e533 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java @@ -0,0 +1,161 @@ +package com.gregtechceu.gtceu.data.recipe.builder; + +import com.gregtechceu.gtceu.GTCEu; + +import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.*; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; + +@Accessors(chain = true, fluent = true) +@SuppressWarnings("deprecation") +public class SimpleCookingRecipeBuilder { + + protected final String folder; + protected final RecipeSerializer serializer; + protected @Nullable Ingredient input; + @Setter + protected @Nullable String group; + @Setter + protected CookingBookCategory category = CookingBookCategory.MISC; + + protected ItemStack output = ItemStack.EMPTY; + @Setter + protected float experience; + @Setter + protected int cookingTime; + @Setter + protected @Nullable ResourceLocation id; + + protected SimpleCookingRecipeBuilder(@Nullable ResourceLocation id, String folder, RecipeSerializer serializer) { + this.id = id; + this.folder = folder; + this.serializer = serializer; + } + + public static SimpleCookingRecipeBuilder campfireCooking(@Nullable ResourceLocation id) { + return new SimpleCookingRecipeBuilder<>(id, "campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING_RECIPE); + } + + public static SimpleCookingRecipeBuilder smelting(@Nullable ResourceLocation id) { + return new SimpleCookingRecipeBuilder<>(id, "smelting", RecipeSerializer.SMELTING_RECIPE); + } + + public static SimpleCookingRecipeBuilder blasting(@Nullable ResourceLocation id) { + return new SimpleCookingRecipeBuilder<>(id, "blasting", RecipeSerializer.BLASTING_RECIPE); + } + + public static SimpleCookingRecipeBuilder smoking(@Nullable ResourceLocation id) { + return new SimpleCookingRecipeBuilder<>(id, "smoking", RecipeSerializer.SMOKING_RECIPE); + } + + public SimpleCookingRecipeBuilder input(TagKey tag) { + return input(Ingredient.of(tag)); + } + + public SimpleCookingRecipeBuilder input(ItemStack itemStack) { + input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); + return this; + } + + public SimpleCookingRecipeBuilder input(ItemLike itemLike) { + return input(Ingredient.of(itemLike)); + } + + public SimpleCookingRecipeBuilder input(Ingredient ingredient) { + input = ingredient; + return this; + } + + public SimpleCookingRecipeBuilder output(ItemStack itemStack) { + this.output = itemStack.copy(); + return this; + } + + public SimpleCookingRecipeBuilder output(ItemStack itemStack, int count) { + this.output = itemStack.copyWithCount(count); + return this; + } + + protected ResourceLocation defaultId() { + return BuiltInRegistries.ITEM.getKey(output.getItem()); + } + + public void toJson(JsonObject json) { + if (group != null) { + json.addProperty("group", group); + } + + if (input == null || input.isEmpty()) { + GTCEu.LOGGER.error("{} recipe {} input is empty", folder, id); + throw new IllegalArgumentException(id + ": input item is empty"); + } + if (output.isEmpty()) { + GTCEu.LOGGER.error("{} recipe {} output is empty", folder, id); + throw new IllegalArgumentException(id + ": output item is empty"); + } + + json.add("ingredient", input.toJson()); + + JsonObject result = new JsonObject(); + result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); + if (output.getCount() > 1) { + result.addProperty("count", output.getCount()); + } + if (output.hasTag() && output.getTag() != null) { + result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); + } + json.add("result", result); + + json.addProperty("experience", experience); + json.addProperty("cookingtime", cookingTime); + } + + public void save(Consumer consumer) { + ResourceLocation recipeId = (id == null ? defaultId() : id).withPrefix(folder + "/"); + + consumer.accept(new FinishedRecipe() { + + @Override + public void serializeRecipeData(JsonObject pJson) { + toJson(pJson); + } + + @Override + public ResourceLocation getId() { + return recipeId; + } + + @Override + public RecipeSerializer getType() { + return serializer; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return null; + } + }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java deleted file mode 100644 index 696aee1a594..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.gregtechceu.gtceu.data.recipe.builder; - -import com.gregtechceu.gtceu.GTCEu; - -import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.StrictNBTIngredient; - -import com.google.gson.JsonObject; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Consumer; - -@Accessors(chain = true, fluent = true) -public class SmeltingRecipeBuilder { - - private Ingredient input; - @Setter - protected String group; - - private ItemStack output = ItemStack.EMPTY; - @Setter - private float experience; - @Setter - private int cookingTime; - @Setter - protected ResourceLocation id; - - public SmeltingRecipeBuilder(@Nullable ResourceLocation id) { - this.id = id; - } - - public SmeltingRecipeBuilder input(TagKey itemStack) { - return input(Ingredient.of(itemStack)); - } - - public SmeltingRecipeBuilder input(ItemStack itemStack) { - input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); - return this; - } - - public SmeltingRecipeBuilder input(ItemLike itemLike) { - return input(Ingredient.of(itemLike)); - } - - public SmeltingRecipeBuilder input(Ingredient ingredient) { - input = ingredient; - return this; - } - - public SmeltingRecipeBuilder output(ItemStack itemStack) { - this.output = itemStack.copy(); - return this; - } - - public SmeltingRecipeBuilder output(ItemStack itemStack, int count) { - this.output = itemStack.copy(); - this.output.setCount(count); - return this; - } - - public SmeltingRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { - this.output = itemStack.copy(); - this.output.setCount(count); - this.output.setTag(nbt); - return this; - } - - protected ResourceLocation defaultId() { - return BuiltInRegistries.ITEM.getKey(output.getItem()); - } - - public void toJson(JsonObject json) { - if (group != null) { - json.addProperty("group", group); - } - - if (!input.isEmpty()) { - json.add("ingredient", input.toJson()); - } - - if (output.isEmpty()) { - GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); - throw new IllegalArgumentException(id + ": output items is empty"); - } else { - JsonObject result = new JsonObject(); - result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); - if (output.getCount() > 1) { - result.addProperty("count", output.getCount()); - } - if (output.hasTag() && output.getTag() != null) { - result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); - } - json.add("result", result); - } - - json.addProperty("experience", experience); - json.addProperty("cookingtime", cookingTime); - } - - public void save(Consumer consumer) { - consumer.accept(new FinishedRecipe() { - - @Override - public void serializeRecipeData(JsonObject pJson) { - toJson(pJson); - } - - @Override - public ResourceLocation getId() { - var ID = id == null ? defaultId() : id; - return new ResourceLocation(ID.getNamespace(), "smelting" + "/" + ID.getPath()); - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.SMELTING_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } - }); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java deleted file mode 100644 index 17ac75350a3..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.gregtechceu.gtceu.data.recipe.builder; - -import com.gregtechceu.gtceu.GTCEu; - -import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.StrictNBTIngredient; - -import com.google.gson.JsonObject; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Consumer; - -@Accessors(chain = true, fluent = true) -public class SmokingRecipeBuilder { - - private Ingredient input; - @Setter - protected String group; - - private ItemStack output = ItemStack.EMPTY; - @Setter - private float experience; - @Setter - private int cookingTime; - @Setter - protected ResourceLocation id; - - public SmokingRecipeBuilder(@Nullable ResourceLocation id) { - this.id = id; - } - - public SmokingRecipeBuilder input(TagKey itemStack) { - return input(Ingredient.of(itemStack)); - } - - public SmokingRecipeBuilder input(ItemStack itemStack) { - input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); - return this; - } - - public SmokingRecipeBuilder input(ItemLike itemLike) { - return input(Ingredient.of(itemLike)); - } - - public SmokingRecipeBuilder input(Ingredient ingredient) { - input = ingredient; - return this; - } - - public SmokingRecipeBuilder output(ItemStack itemStack) { - this.output = itemStack.copy(); - return this; - } - - public SmokingRecipeBuilder output(ItemStack itemStack, int count) { - this.output = itemStack.copy(); - this.output.setCount(count); - return this; - } - - public SmokingRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { - this.output = itemStack.copy(); - this.output.setCount(count); - this.output.setTag(nbt); - return this; - } - - protected ResourceLocation defaultId() { - return BuiltInRegistries.ITEM.getKey(output.getItem()); - } - - public void toJson(JsonObject json) { - if (group != null) { - json.addProperty("group", group); - } - - if (!input.isEmpty()) { - json.add("ingredient", input.toJson()); - } - - if (output.isEmpty()) { - GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); - throw new IllegalArgumentException(id + ": output items is empty"); - } else { - JsonObject result = new JsonObject(); - result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); - if (output.getCount() > 1) { - result.addProperty("count", output.getCount()); - } - if (output.hasTag() && output.getTag() != null) { - result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); - } - json.add("result", result); - } - - json.addProperty("experience", experience); - json.addProperty("cookingtime", cookingTime); - } - - public void save(Consumer consumer) { - consumer.accept(new FinishedRecipe() { - - @Override - public void serializeRecipeData(JsonObject pJson) { - toJson(pJson); - } - - @Override - public ResourceLocation getId() { - var ID = id == null ? defaultId() : id; - return new ResourceLocation(ID.getNamespace(), "smoking" + "/" + ID.getPath()); - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.SMOKING_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } - }); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java new file mode 100644 index 00000000000..db8f1b93e0b --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.data.recipe.builder; + +import org.jetbrains.annotations.NotNullByDefault; From 0e9eec1b87217182b7548d5e05a54b42a99f3e56 Mon Sep 17 00:00:00 2001 From: Bernd <133775547+bernd-sbr@users.noreply.github.com> Date: Fri, 20 Feb 2026 20:12:05 +0100 Subject: [PATCH 42/78] PipeBlock neighbor change logic fix (#4664) --- src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java index a77fbb5cc62..0005f59c0c1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java @@ -270,6 +270,7 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b pipeTile.setConnection(facing, false, false); updateActiveNodeStatus(level, pos, pipeTile); } + pipeTile.getCoverContainer().onNeighborChanged(block, fromPos, isMoving); } } From 7847b769b62563145d137c2147bd760215d3a466 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Sat, 4 Apr 2026 22:11:16 +0800 Subject: [PATCH 43/78] Fix up output item bus filter (#4686) --- .../common/machine/multiblock/part/ItemBusPartMachine.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java index 0038b49e98e..f000c5cd05f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java @@ -35,6 +35,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; @@ -332,7 +333,10 @@ public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 18 * rowSize + 16, 18 * colSize + 16); var container = new WidgetGroup(4, 4, 18 * rowSize + 8, 18 * colSize + 8); int index = 0; - group.addWidget(filterHandler.createFilterSlotUI(-115 + (18 * rowSize) / 2, 35 + 11 * rowSize)); + if (this.io == IO.OUT) { + group.addWidget(filterHandler.createFilterSlotUI(71 + (18 * rowSize) / 2, 35 + 9 * rowSize) + .setHoverTooltips(Component.translatable("cover.item_filter.title"))); + } for (int y = 0; y < colSize; y++) { for (int x = 0; x < rowSize; x++) { container.addWidget( From 838584cc07b53e03dab94ea331239cf267879fdf Mon Sep 17 00:00:00 2001 From: Mqrius Date: Mon, 23 Feb 2026 08:41:31 +0100 Subject: [PATCH 44/78] Clear categoryMap on reload to reload EMI correctly (#4683) --- .../java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java | 6 ++++++ .../gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java | 2 +- .../gtceu/integration/kjs/GregTechKubeJSPlugin.java | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java index f07bfe7fa34..5999abb2a2a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java @@ -332,6 +332,12 @@ public Set getRecipesInCategory(GTRecipeCategory category) { return db; } + @ApiStatus.Internal + public void beginStagingRecipes() { + categoryMap.clear(); + additionHandler.beginStaging(); + } + public interface ICustomRecipeLogic { /** diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java index 4e7f22021a1..13c17314a74 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java @@ -40,7 +40,7 @@ public abstract class RecipeManagerMixin { if (!(recipeType instanceof GTRecipeType gtRecipeType)) { continue; } - gtRecipeType.getAdditionHandler().beginStaging(); + gtRecipeType.beginStagingRecipes(); gtRecipeType.getProxyRecipes().forEach((type, list) -> { var recipesByID = recipes.get(type); if (recipesByID == null) { 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 282112a3928..d829715d5de 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java @@ -515,7 +515,7 @@ public void injectRuntimeRecipes(RecipesEventJS event, RecipeManager manager, if (!(recipeType instanceof GTRecipeType gtRecipeType)) { continue; } - gtRecipeType.getAdditionHandler().beginStaging(); + gtRecipeType.beginStagingRecipes(); gtRecipeType.getProxyRecipes().forEach((type, list) -> { RecipeManagerHandler.addProxyRecipesToLookup(recipesByName, gtRecipeType, type, list); }); From 04ab60af76bba5c3dc9b12b24b79c0209dcd9825 Mon Sep 17 00:00:00 2001 From: Bumperdo09 <45916709+Bumperdo09@users.noreply.github.com> Date: Tue, 24 Feb 2026 08:24:12 -0500 Subject: [PATCH 45/78] fluid regulators now check that the correct amount of fluid was moved (#4693) --- .../com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java index 7ceb44db136..f9d17083340 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java @@ -112,7 +112,7 @@ private int transferExact(IFluidHandler source, IFluidHandler destination, int p continue; int insertableAmount = destination.fill(drained.copy(), FluidAction.SIMULATE); - if (insertableAmount <= 0) + if (insertableAmount != supplyAmount) continue; drained.setAmount(insertableAmount); From 8b4f4dbb0303e131cf9dbb77f0af28fb87c83e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A5=93?= Date: Thu, 26 Feb 2026 15:53:22 +0800 Subject: [PATCH 46/78] Add #dragon_immune tag to endstone-based ores (#4689) --- src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java b/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java index 75ace433779..26da2a0bc53 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java +++ b/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java @@ -177,6 +177,11 @@ public static void generateGTDynamicTags(Map new ArrayList<>()).addAll(entries); + } + if (entry.tagPrefix() == TagPrefix.frameGt) { tagMap.computeIfAbsent(CustomTags.SLOW_WALKABLE_BLOCKS.location(), path -> new ArrayList<>()) .addAll(entries); From b9d05017abd3bea85274ebeb2376aa6797d9699a Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Sat, 4 Apr 2026 22:15:25 +0800 Subject: [PATCH 47/78] Fix #4706 (#4708) --- .../common/item/tool/behavior/MachineConfigCopyBehaviour.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java index 819d93e8102..0c546a59d9a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java @@ -70,7 +70,7 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { var blockEntity = context.getLevel().getBlockEntity(context.getClickedPos()); var player = context.getPlayer(); - if (player == null || player instanceof LocalPlayer) return InteractionResult.PASS; + if (!(player instanceof ServerPlayer)) return InteractionResult.PASS; if (blockEntity instanceof IMachineBlockEntity machineBlockEntity && !MachineOwner.canOpenOwnerMachine(context.getPlayer(), machineBlockEntity.getMetaMachine())) return InteractionResult.FAIL; From 2173a07e9a8ade20975e1b310f18acf016215a36 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Sat, 4 Apr 2026 22:18:17 +0800 Subject: [PATCH 48/78] Update zh_cn.json 1.20.1 (#4716) --- .../resources/assets/gtceu/lang/zh_cn.json | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/resources/assets/gtceu/lang/zh_cn.json b/src/main/resources/assets/gtceu/lang/zh_cn.json index 057f5ffa80c..337c09ab64e 100644 --- a/src/main/resources/assets/gtceu/lang/zh_cn.json +++ b/src/main/resources/assets/gtceu/lang/zh_cn.json @@ -33,10 +33,11 @@ "behavior.portable_scanner.machine_progress": "处理进度/总计:%s / %s", "behavior.portable_scanner.machine_upwards_facing": "控制器正面朝向:%s", "behavior.portable_scanner.mode.caption": "显示模式:%s", - "behavior.portable_scanner.mode.show_all_info": "显示所有信息", + "behavior.portable_scanner.mode.show_all_info": "显示所有信息(不含内部信息)", "behavior.portable_scanner.mode.show_block_info": "显示方块信息", "behavior.portable_scanner.mode.show_electrical_info": "显示电器信息", "behavior.portable_scanner.mode.show_environmental_info": "显示环境信息", + "behavior.portable_scanner.mode.show_internal_info": "显示内部调试信息", "behavior.portable_scanner.mode.show_machine_info": "显示机器信息", "behavior.portable_scanner.mode.show_recipe_info": "显示配方信息", "behavior.portable_scanner.muffled": "已静音。", @@ -66,6 +67,7 @@ "behaviour.lighter.uses": "剩余次数:%d", "behaviour.memory_card.client_msg.cleared": "已清除存储的配置", "behaviour.memory_card.client_msg.copied": "已复制机器配置", + "behaviour.memory_card.client_msg.missing_items": "缺少粘贴配置所需要的物品", "behaviour.memory_card.client_msg.pasted": "已应用机器配置", "behaviour.memory_card.copy_target": "复制源:%s", "behaviour.memory_card.disabled": "§c已禁用§r", @@ -1745,6 +1747,7 @@ "config.gtceu.option.addLoot": "添加战利品", "config.gtceu.option.ae2": "ae2", "config.gtceu.option.allowDrumsInputFluidsFromOutputSide": "允许桶从输出面输入流体", + "config.gtceu.option.allowedImageDomains": "图片域名白名单", "config.gtceu.option.animationTime": "动画时间", "config.gtceu.option.arcRecyclingYield": "电弧炉回收率", "config.gtceu.option.armorHud": "盔甲HUD", @@ -1758,6 +1761,7 @@ "config.gtceu.option.casingsPerCraft": "每次合成机械方块数量", "config.gtceu.option.cleanMultiblocks": "多方块结构是否洁净", "config.gtceu.option.client": "客户端", + "config.gtceu.option.coloredMaterialBlockOutline": "材料块的彩色描边", "config.gtceu.option.coloredTieredMachineOutline": "彩色电力机器轮廓", "config.gtceu.option.coloredWireOutline": "彩色线缆轮廓", "config.gtceu.option.compat": "兼容", @@ -1892,7 +1896,7 @@ "config.gtceu.option.steelSteamMultiblocks": "用钢的蒸汽多方块结构", "config.gtceu.option.surfaceRockProspectRange": "地表岩石探测半径", "config.gtceu.option.tankItemFluidPreview": "储罐流体预览", - "config.gtceu.option.temperaturesInKelvin": "开尔文温度", + "config.gtceu.option.temperaturesInCelsius": "使用摄氏度", "config.gtceu.option.titaniumBoilerHeatSpeed": "钛锅炉-加热速度", "config.gtceu.option.titaniumBoilerMaxTemperature": "钛锅炉-最高温度", "config.gtceu.option.toggle": "切换", @@ -2130,7 +2134,7 @@ "curios.identifier.gtceu_magnet": "GTCEu磁铁", "death.attack.gtceu.axe": "%s被%s用斧子砍死了", "death.attack.gtceu.butchery_knife": "%s死在了%s的屠刀之下", - "death.attack.gtceu.buzzsaw": "%2$手中圆锯的嗞嗞声成为了%1$s生命中最后听到的声音", + "death.attack.gtceu.buzzsaw": "%2$s手中圆锯的嗞嗞声成为了%1$s生命中最后听到的声音", "death.attack.gtceu.chainsaw_lv": "%2$s的链锯切碎了%1$s", "death.attack.gtceu.chemical": "%s历经了一场化学事故", "death.attack.gtceu.crowbar": "%s被%s用撬棍撬走了半条命", @@ -3664,7 +3668,7 @@ "gtceu.placeholder_info.maxProgress.1": "例: '进度: {calc {calc {progress} / {maxProgress}} * 100}%'", "gtceu.placeholder_info.maxProgress.2": "用法:", "gtceu.placeholder_info.maxProgress.3": " {maxProgress} -> 当前正在运行的配方的最大进度", - "gtceu.placeholder_info.nbt.0": "指定的插槽内物品的NBT数据", + "gtceu.placeholder_info.nbt.0": "返回指定的插槽内物品的NBT数据", "gtceu.placeholder_info.nbt.1": "用法:", "gtceu.placeholder_info.nbt.2": " {nbt <槽位> [键1] [键2] [键3] …} -> 物品NBT [键1] [键2] [键3] […]", "gtceu.placeholder_info.obf.0": "返回混淆处理过的文本(第一个参数)。", @@ -3760,8 +3764,14 @@ "gtceu.recipe_logic.insufficient_out": "输出堵塞", "gtceu.recipe_logic.no_capabilities": "机器无功能", "gtceu.recipe_logic.no_contents": "配方无内容", + "gtceu.recipe_logic.recipe_waiting": "配方等待中:", + "gtceu.recipe_logic.setup_fail": "配方启动失败:", "gtceu.recipe_memory_widget.tooltip.0": "§7左键点击可自动将该配方输入至合成格", "gtceu.recipe_memory_widget.tooltip.1": "§7按住Shift并点击以锁定或解锁该配方", + "gtceu.recipe_modifier.coil_temperature_too_low": "线圈温度不足", + "gtceu.recipe_modifier.default_fail": "配方修改失败", + "gtceu.recipe_modifier.insufficient_eu_to_start_fusion": "能量不足以启动聚变反应", + "gtceu.recipe_modifier.insufficient_voltage": "电压等级不足", "gtceu.recipe_type.show_recipes": "查看配方", "gtceu.rei.group.potion_fluids": "药水流体", "gtceu.research_station": "研究站", @@ -4317,7 +4327,7 @@ "item.gtceu.item_filter.tooltip.0": "§7作§f覆盖板§7时过滤§f物品§7的输入/输出。", "item.gtceu.item_filter.tooltip.1": "亦可为§f传送带§7和§f机械臂§7提供此功能。", "item.gtceu.item_smart_filter": "智能物品过滤卡", - "item.gtceu.item_smart_filter.tooltip.0": "作§f覆盖板§7时以§f机器的配方§7过滤§f物品§7的输入/输出。", + "item.gtceu.item_smart_filter.tooltip.0": "§7作§f覆盖板§7时以§f机器的配方§7过滤§f物品§7的输入/输出。", "item.gtceu.item_smart_filter.tooltip.1": "亦可为§f传送带§7和§f机械臂§7提供此功能。", "item.gtceu.item_tag_filter": "物品标签过滤卡", "item.gtceu.item_tag_filter.tooltip.0": "§7作§f覆盖板§7时以§f物品标签§7过滤§f物品§7的输入/输出。", @@ -4542,7 +4552,7 @@ "item.gtceu.pink_dye_spray_can": "喷漆罐(粉红色)", "item.gtceu.pink_glass_lens": "玻璃透镜(粉红色)", "item.gtceu.pipe.huge_casting_mold.tooltip": "§7用来制作巨型管道的模具", - "item.gtceu.pipe.huge_extruder_mold.tooltip": "§7用来制作占据整个方块的管道的模头", + "item.gtceu.pipe.huge_extruder_mold.tooltip": "§7用来制作巨型管道的模头", "item.gtceu.pipe.large_casting_mold.tooltip": "§7用来制作大型管道的模具", "item.gtceu.pipe.large_extruder_mold.tooltip": "§7用来制作大型管道的模头", "item.gtceu.pipe.normal_casting_mold.tooltip": "§7用来制作管道的模具", @@ -4734,7 +4744,7 @@ "item.gtceu.talc_dust": "滑石", "item.gtceu.tantalum_capacitor": "钽电容", "item.gtceu.terminal": "终端", - "item.gtceu.terminal.tooltip": "潜行右击多方块控制器以自动搭建此多方块结构", + "item.gtceu.terminal.tooltip": "潜行右击多方块控制器,以用你物品栏中的物品自动搭建此结构", "item.gtceu.text_module": "文本模块", "item.gtceu.tiny_ash_dust": "小撮灰烬", "item.gtceu.tiny_basaltic_mineral_sand_dust": "小撮玄武岩矿砂", @@ -5699,8 +5709,6 @@ "metaarmor.message.nightvision.disabled": "§b夜视:§c关闭", "metaarmor.message.nightvision.enabled": "§b夜视:§a开启", "metaarmor.message.nightvision.error": "§c能量不足!", - "metaarmor.message.step_assist.disabled": "步行辅助:§c关", - "metaarmor.message.step_assist.enabled": "步行辅助:§a开", "metaarmor.nms.nightvision.disabled": "纳米肌体™套装:夜视已禁用", "metaarmor.nms.nightvision.enabled": "纳米肌体™套装:夜视已启用", "metaarmor.nms.nightvision.error": "纳米肌体™套装:§c能量不足!", From 4f9c4d2cbb49b79d8637643fd21f138527cd8aa6 Mon Sep 17 00:00:00 2001 From: Mqrius Date: Wed, 11 Mar 2026 10:09:49 +0100 Subject: [PATCH 49/78] Improve getBlockState performance (#4727) --- .../gtceu/core/mixins/LevelMixin.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java index d095baa8fa6..637226a30e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java @@ -14,11 +14,9 @@ import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.LevelChunk; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -38,19 +36,16 @@ public abstract class LevelMixin implements LevelAccessor { @Final private Thread thread; - @Unique - private @Nullable ChunkAccess gtceu$maybeGetChunkAsync(int chunkX, int chunkZ) { - if (this.isClientSide) return null; - if (Thread.currentThread() == this.thread) return null; - if (!MultiblockWorldSavedData.isThreadService() && !AsyncThreadData.isThreadService()) return null; - if (!this.getChunkSource().hasChunk(chunkX, chunkZ)) return null; - - return this.getChunkSource().getChunkNow(chunkX, chunkZ); - } - @Inject(method = "getBlockEntity", at = @At(value = "HEAD"), cancellable = true) private void gtceu$getBlockEntityOffThread(BlockPos pos, CallbackInfoReturnable cir) { - ChunkAccess chunk = gtceu$maybeGetChunkAsync(pos.getX() >> 4, pos.getZ() >> 4); + if (Thread.currentThread() == this.thread) return; + if (this.isClientSide) return; + if (!MultiblockWorldSavedData.isThreadService() && !AsyncThreadData.isThreadService()) return; + + int chunkX = pos.getX() >> 4, chunkZ = pos.getZ() >> 4; + if (!this.getChunkSource().hasChunk(chunkX, chunkZ)) return; + + ChunkAccess chunk = this.getChunkSource().getChunkNow(chunkX, chunkZ); if (chunk instanceof LevelChunk levelChunk) { cir.setReturnValue(levelChunk.getBlockEntities().get(pos)); } @@ -58,7 +53,14 @@ public abstract class LevelMixin implements LevelAccessor { @Inject(method = "getBlockState", at = @At(value = "HEAD"), cancellable = true) private void gtceu$getBlockStateOffThread(BlockPos pos, CallbackInfoReturnable cir) { - ChunkAccess chunk = gtceu$maybeGetChunkAsync(pos.getX() >> 4, pos.getZ() >> 4); + if (Thread.currentThread() == this.thread) return; + if (this.isClientSide) return; + if (!MultiblockWorldSavedData.isThreadService() && !AsyncThreadData.isThreadService()) return; + + int chunkX = pos.getX() >> 4, chunkZ = pos.getZ() >> 4; + if (!this.getChunkSource().hasChunk(chunkX, chunkZ)) return; + + ChunkAccess chunk = this.getChunkSource().getChunkNow(chunkX, chunkZ); if (chunk != null) { cir.setReturnValue(chunk.getBlockState(pos)); } From b7104f12b01ebcbd25c2ae9668a81bcc932152f1 Mon Sep 17 00:00:00 2001 From: Mqrius Date: Sat, 14 Mar 2026 01:27:38 +0100 Subject: [PATCH 50/78] EMI synthetic recipe warning fix (#4732) --- .../integration/emi/circuit/GTProgrammedCircuitCategory.java | 2 +- .../integration/emi/multipage/MultiblockInfoEmiRecipe.java | 2 +- .../gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/circuit/GTProgrammedCircuitCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/circuit/GTProgrammedCircuitCategory.java index 8a56d47c0fe..493e66a619b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/circuit/GTProgrammedCircuitCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/circuit/GTProgrammedCircuitCategory.java @@ -53,7 +53,7 @@ public int getDisplayWidth() { @Override public @Nullable ResourceLocation getId() { - return GTCEu.id("programmed_circuit"); + return GTCEu.id("/programmed_circuit"); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java index a3957423362..fe705dea7f4 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java @@ -44,7 +44,7 @@ public EmiRecipeCategory getCategory() { @Override public @Nullable ResourceLocation getId() { - return definition.getId(); + return definition.getId().withPrefix("/"); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java index ff3eac37e13..debdbe15819 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java @@ -26,7 +26,7 @@ public EmiRecipeCategory getCategory() { @Override public @Nullable ResourceLocation getId() { - return material.getResourceLocation(); + return material.getResourceLocation().withPrefix("/"); } @Override From ea0f966ef859334c74a0f3d81d64ac20b7db9a41 Mon Sep 17 00:00:00 2001 From: fdjgnbjfdsnkfv <121055316+kdcjxbsdnbgfdg@users.noreply.github.com> Date: Mon, 23 Mar 2026 11:53:26 +0000 Subject: [PATCH 51/78] fix null pointer exception (#4739) --- .../com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java | 3 +++ 1 file changed, 3 insertions(+) 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 471e8ca1f77..bf1ed9d96b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -252,6 +252,9 @@ public int getVisualConnections() { public void setConnection(Direction side, boolean connected, boolean fromNeighbor) { // fix desync between two connections. // Can happen if a pipe side is blocked, and a new pipe is placed next to it. + if (getLevel() == null) { + return; + } if (!getLevel().isClientSide) { if (isConnected(side) == connected) { return; From c8def308446a3e0742c334a52d91fd69af707d81 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Thu, 12 Feb 2026 20:13:21 +0800 Subject: [PATCH 52/78] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8DeutModifier?= =?UTF-8?q?=E4=B8=BA=E6=B2=A1=E6=9C=89EU=E7=9A=84=E9=85=8D=E6=96=B9?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0EU=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/api/recipe/modifier/ModifierFunction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 41a20331db0..bc70c24bd6a 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 @@ -196,7 +196,9 @@ public ModifierFunction build() { if (eutModifier != ContentModifier.IDENTITY) { var preEUt = RecipeHelper.getRealEUtWithIO(recipe); EnergyStack eut = EURecipeCapability.CAP.copyWithModifier(preEUt.stack(), eutModifier); - EURecipeCapability.putEUContent(preEUt.isInput() ? copied.tickInputs : copied.tickOutputs, eut); + if (!eut.isEmpty()) { + EURecipeCapability.putEUContent(preEUt.isInput() ? copied.tickInputs : copied.tickOutputs, eut); + } } return copied; }; From 48f43cd09dca6f776da8af1701eca0863fc9be0c Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Wed, 4 Mar 2026 00:02:50 +0800 Subject: [PATCH 53/78] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A6=82?= =?UTF-8?q?=E7=8E=87=E4=BA=A7=E7=89=A9=E7=9A=84=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/data/recipe/builder/GTRecipeBuilder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 548db26fe1f..76ccac9f8dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -717,7 +717,7 @@ public GTRecipeBuilder circuitMeta(int configuration) { return notConsumable(IntCircuitIngredient.of(configuration)); } - public GTRecipeBuilder chancedInput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(SizedIngredient stack, int chance, int tierChanceBoost) { if (checkChanceAndPrintError(chance)) { return this; } @@ -745,7 +745,7 @@ public GTRecipeBuilder chancedInput(FluidIngredient stack, int chance, int tierC return this; } - public GTRecipeBuilder chancedOutput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(SizedIngredient stack, int chance, int tierChanceBoost) { if (checkChanceAndPrintError(chance)) { return this; } @@ -774,7 +774,7 @@ public GTRecipeBuilder chancedOutput(FluidIngredient stack, int chance, int tier } public GTRecipeBuilder chancedInput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedInput(Ingredient.of(stack), chance, tierChanceBoost); + return chancedInput(SizedIngredient.create(stack), chance, tierChanceBoost); } public GTRecipeBuilder chancedInput(FluidStack stack, int chance, int tierChanceBoost) { @@ -782,7 +782,7 @@ public GTRecipeBuilder chancedInput(FluidStack stack, int chance, int tierChance } public GTRecipeBuilder chancedOutput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedOutput(Ingredient.of(stack), chance, tierChanceBoost); + return chancedOutput(SizedIngredient.create(stack), chance, tierChanceBoost); } public GTRecipeBuilder chancedOutput(FluidStack stack, int chance, int tierChanceBoost) { From bde677a9f10283b79e42b32ed25d677142e8e2f4 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Wed, 11 Mar 2026 15:58:32 +0800 Subject: [PATCH 54/78] =?UTF-8?q?fix:=20=E5=9C=B0=E6=AF=AF=E5=8E=9F?= =?UTF-8?q?=E7=89=88=E9=85=8D=E6=96=B9=E6=B2=A1=E5=9C=A8=20hardMiscRecipes?= =?UTF-8?q?=20=E6=83=85=E5=86=B5=E4=B8=8B=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/data/recipe/configurable/RecipeRemoval.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java index 667cb5e47ce..2218752de8d 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java @@ -236,6 +236,7 @@ private static void hardMiscRecipes(Consumer registry) { registry.accept(new ResourceLocation("minecraft:hopper_minecart")); for (DyeColor color : DyeColor.values()) { registry.accept(new ResourceLocation(color.getName() + "_bed")); + registry.accept(new ResourceLocation(color.getName() + "_carpet")); } registry.accept(new ResourceLocation("minecraft:fermented_spider_eye")); registry.accept(new ResourceLocation("minecraft:fire_charge")); From fd7175782baa64eb96f51f1580004dc099c52667 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Thu, 19 Mar 2026 20:44:23 +0800 Subject: [PATCH 55/78] =?UTF-8?q?fix:=20slotWidget=E4=B8=8D=E7=BB=A7?= =?UTF-8?q?=E6=89=BFitemHandler=E7=9A=84onChanged?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/api/capability/recipe/ItemRecipeCapability.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index 239d8a9377b..b281ce08c54 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -33,6 +33,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.jei.IngredientIO; +import com.lowdragmc.lowdraglib.syncdata.IContentChangeAware; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.util.valueproviders.IntProvider; @@ -438,6 +439,9 @@ public void applyWidgetInfo(@NotNull Widget widget, slot.setIngredientIO(io == IO.IN ? IngredientIO.INPUT : IngredientIO.OUTPUT); slot.setCanTakeItems(!isXEI); slot.setCanPutItems(!isXEI && io.support(IO.IN)); + if(items instanceof IContentChangeAware item1) { + slot.setChangeListener(item1.getOnContentsChanged()); + } } // 1 over container size. // If in a recipe viewer and a research slot can be added, add it. From c219f62d2463758143660e1b31e25cfedfbf5442 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Sat, 21 Mar 2026 17:24:33 +0800 Subject: [PATCH 56/78] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20EMI=20?= =?UTF-8?q?=E5=90=88=E6=88=90=E6=A0=91=E9=87=8C=E7=89=A9=E5=93=81=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E6=9C=89=E6=A6=82=E7=8E=87=E8=A2=AB=E7=89=A9=E5=93=81?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E9=81=AE=E6=8C=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../emi/recipe/GTRecipeEMICategory.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 f2b9ab4a9ec..be34941e47c 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 @@ -9,6 +9,8 @@ import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.lowdragmc.lowdraglib.emi.IGui2Renderable; +import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; +import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import net.minecraft.Util; import net.minecraft.network.chat.Component; @@ -16,6 +18,8 @@ import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories; +import dev.emi.emi.api.render.EmiRenderable; +import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; import java.util.ArrayList; @@ -30,10 +34,27 @@ public class GTRecipeEMICategory extends EmiRecipeCategory { private final GTRecipeCategory category; private GTRecipeEMICategory(GTRecipeCategory category) { - super(category.registryKey, IGui2Renderable.toDrawable(category.getIcon(), 16, 16)); + super(category.registryKey, toEmiRenderable(category.getIcon()), toSimplifiedRenderable(category.getIcon())); this.category = category; } + private static EmiRenderable toEmiRenderable(IGuiTexture texture) { + if (texture instanceof ItemStackTexture ist && ist.items != null && ist.items.length > 0 && + ist.items[0] != null && !ist.items[0].isEmpty()) { + return EmiStack.of(ist.items[0]); + } + return IGui2Renderable.toDrawable(texture, 16, 16); + } + + private static EmiRenderable toSimplifiedRenderable(IGuiTexture texture) { + if (texture instanceof ItemStackTexture ist && ist.items != null && ist.items.length > 0 && + ist.items[0] != null && !ist.items[0].isEmpty()) { + EmiStack stack = EmiStack.of(ist.items[0]); + return (draw, x, y, delta) -> stack.render(draw, x, y, delta, EmiIngredient.RENDER_ICON); + } + return IGui2Renderable.toDrawable(texture, 16, 16); + } + public static void registerDisplays(EmiRegistry registry) { List subCategories = new ArrayList<>(); // run main categories first From 95198675ae9d78633ff1cd0d82b8f43df44c9a9c Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Thu, 26 Mar 2026 20:55:59 +0800 Subject: [PATCH 57/78] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=86=85?= =?UTF-8?q?=E7=87=83=E5=BC=95=E6=93=8E=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E6=B6=88=E8=80=97=E9=87=8F=E4=B8=8D=E5=87=86=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiblock/generator/LargeCombustionEngineMachine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java index 88a93bb3c37..0a403a92907 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java @@ -223,7 +223,7 @@ public String getRecipeFluidInputInfo() { } FluidStack requiredFluidInput = RecipeHelper.getInputFluids(recipe).get(0); - long ocAmount = getMaxVoltage() / recipe.getOutputEUt().getTotalEU(); + long ocAmount = getOverclockVoltage() / recipe.getOutputEUt().getTotalEU(); int neededAmount = GTMath.saturatedCast(ocAmount * requiredFluidInput.getAmount()); return ChatFormatting.RED + FormattingUtil.formatNumbers(neededAmount) + "mB"; } From 758d1ee9007ed8efd1ea84205ae3bb5d6584dc91 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Thu, 5 Mar 2026 13:17:56 +0800 Subject: [PATCH 58/78] =?UTF-8?q?refactor:=20=E6=8A=8A=20GTM=20=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20modules=20=E4=B8=AD=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/000-bug-report.yml | 114 ----------- .../ISSUE_TEMPLATE/001-feature-request.yml | 30 --- .github/ISSUE_TEMPLATE/config.yml | 5 - .github/actions/build_setup/action.yml | 32 ---- .../actions/ctnh_prepare_workspace/action.yml | 174 +++++++++++++++++ .github/json/config-1.21.json | 45 ----- .github/json/config-latest-1.21.json | 35 ---- .github/json/config-latest.json | 35 ---- .github/json/config.json | 45 ----- .github/labeler.yml | 5 - .github/pull_request_template.md | 21 --- .github/release.yml | 27 --- .github/workflows/auto-build.yml | 72 ------- .github/workflows/build-on-push.yml | 52 ----- .github/workflows/build.yml | 87 +++++++++ .github/workflows/clean.yml | 18 -- .github/workflows/deploy-pages.yml | 38 ---- .github/workflows/format-java.yml | 39 ---- .github/workflows/labeler.yml | 9 - .github/workflows/manage-issue-labels.yml | 23 --- .github/workflows/manage-pr-labels.yml | 43 ----- .github/workflows/publish-on-release.yml | 58 ------ .github/workflows/publish.yml | 178 ------------------ .github/workflows/spotless.yml | 47 +++++ .github/workflows/sync.yml | 25 --- .github/workflows/test-on-push.yml | 60 ------ .github/workflows/update-gradle-cache.yml | 26 --- build.gradle | 18 +- gradle.properties | 2 +- gradle/libs.versions.toml | 6 +- gradle/scripts/jars.gradle | 24 +-- gradle/scripts/moddevgradle.gradle | 2 +- gradle/scripts/publishing.gradle | 2 +- gradle/scripts/spotless.gradle | 6 +- 34 files changed, 336 insertions(+), 1067 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/000-bug-report.yml delete mode 100644 .github/ISSUE_TEMPLATE/001-feature-request.yml delete mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/actions/build_setup/action.yml create mode 100644 .github/actions/ctnh_prepare_workspace/action.yml delete mode 100644 .github/json/config-1.21.json delete mode 100644 .github/json/config-latest-1.21.json delete mode 100644 .github/json/config-latest.json delete mode 100644 .github/json/config.json delete mode 100644 .github/labeler.yml delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/release.yml delete mode 100644 .github/workflows/auto-build.yml delete mode 100644 .github/workflows/build-on-push.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/clean.yml delete mode 100644 .github/workflows/deploy-pages.yml delete mode 100644 .github/workflows/format-java.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/manage-issue-labels.yml delete mode 100644 .github/workflows/manage-pr-labels.yml delete mode 100644 .github/workflows/publish-on-release.yml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/spotless.yml delete mode 100644 .github/workflows/sync.yml delete mode 100644 .github/workflows/test-on-push.yml delete mode 100644 .github/workflows/update-gradle-cache.yml diff --git a/.github/ISSUE_TEMPLATE/000-bug-report.yml b/.github/ISSUE_TEMPLATE/000-bug-report.yml deleted file mode 100644 index 67e88aac192..00000000000 --- a/.github/ISSUE_TEMPLATE/000-bug-report.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Bug Report -description: Report a bug where something is not working as expected. -labels: [ "type: bug" ] -body: - - type: checkboxes - id: existing-issue - attributes: - label: Checked for existing issues - description: You have checked for existing reports of this issue, open or closed. - options: - - label: "I have checked for existing issues, and have found none." - required: true - - type: checkboxes - id: tried-latest - attributes: - label: Tested latest version - description: You have checked that this issue occurs on the latest version of GTCEu. - options: - - label: "I have checked that this occurs on the latest version." - required: true - - type: input - id: gtceu-version - attributes: - label: GregTech CEu Version - description: The version of GregTech CEu you were using when this bug was encountered. If you do not know where to find this, look for the mod jar file in the mods folder, or in the mods viewer in-game. - placeholder: "Example: v2.3.4" - validations: - required: true - - type: dropdown - id: mc-version - attributes: - label: Minecraft Version - description: The version of Minecraft you were using when this bug was encountered. If you do not know where to find this, it is in the bottom left of the main menu. Any version not listed is not supported. - options: - - "1.20.1 Forge" - - "1.21.1 NeoForge" - validations: - required: true - - type: dropdown - id: recipe-viewer - attributes: - label: Recipe Viewer Installed - description: The recipe viewer installed. - options: - - "JEI" - - "REI" - - "EMI" - validations: - required: false - - type: dropdown - id: environment - attributes: - label: Environment - description: How you were playing on the world. Hybrid servers are unsupported. - options: - - "Singleplayer" - - "Multiplayer - Open to LAN" - - "Multiplayer - Dedicated Server" - validations: - required: true - - type: dropdown - id: cross-mod - attributes: - label: Cross-Mod Interaction - description: Does this bug occur because of another mod installed alongside GregTech CEu? - options: - - "Yes" - - "No" - - "Unsure" - validations: - required: true - - type: textarea - id: other-mods - attributes: - label: Other Installed Mods - description: Enter the name of the modpack you're playing, or list all mods you have installed here. - placeholder: "Example: Cosmic Frontiers, Monifactory, Embeddium, NuclearCraft Neoteric, AE2,..." - validations: - required: true - - type: textarea - id: expected - attributes: - label: Expected Behavior - description: What you expected to happen. Attach screenshots here as necessary. - placeholder: "Example: Expected to produce X by consuming Y." - validations: - required: true - - type: textarea - id: result - attributes: - label: Actual Behavior - description: What happened despite your expectations. Attach screenshots here as necessary. - placeholder: "Example: Produced one X but Y was not consumed." - validations: - required: true - - type: textarea - id: reproduction - attributes: - label: Steps to Reproduce - description: How to reproduce the bug. - placeholder: "Example: 1) I did X..." - validations: - required: true - - type: textarea - id: additional-info - attributes: - label: Additional Information - description: Any additional information you wish to provide. Please add anything which did not fit into the other sections here. - placeholder: "Example: This is likely caused by X because..." - validations: - required: false - - type: markdown - attributes: - value: Thank you for taking the time to fill out this bug report. diff --git a/.github/ISSUE_TEMPLATE/001-feature-request.yml b/.github/ISSUE_TEMPLATE/001-feature-request.yml deleted file mode 100644 index 0c251a0822e..00000000000 --- a/.github/ISSUE_TEMPLATE/001-feature-request.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Feature Request -description: Request a new feature. -labels: [ "type: feature" ] -body: - - type: input - id: cross-mod - attributes: - label: Cross-mod Integration - description: "Does this feature involve integration with another mod? If so specify the mod(s). Otherwise, leave this blank." - placeholder: "Example: Create Mod" - - type: dropdown - id: mc-version - attributes: - label: Minecraft Version - description: The version of Minecraft you wish this feature was added for. - options: - - "Both" - - "1.20.1 Forge" - - "1.21.1 NeoForge" - - type: textarea - id: description - attributes: - label: Feature Description - description: "What feature would you like to have? Please describe it here." - placeholder: "Example: I want to be able to do..." - validations: - required: true - - type: markdown - attributes: - value: Thank you for taking the time to fill out this feature request. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 9842c5c9025..00000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: GregTech CEu Discord - url: https://discord.gg/bWSWuYvURP - about: Join us on Discord to discuss questions, bugs, and more. diff --git a/.github/actions/build_setup/action.yml b/.github/actions/build_setup/action.yml deleted file mode 100644 index dcdbe4a170e..00000000000 --- a/.github/actions/build_setup/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build Setup -description: Setup for standard Java builds - -inputs: - update-cache: - description: If cache should be updated - required: false - default: 'false' - ref: - description: 'Ref to checkout' - required: false - -runs: - using: 'composite' - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref || github.ref }} - - name: Set up JDK - uses: actions/setup-java@v4 - env: - REF: ${{ inputs.ref || github.ref }} - with: - distribution: temurin - java-version: ${{ contains(env.REF, '1.20.1') && '17' || '21' }} - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - with: - cache-write-only: ${{ inputs.update-cache }} - cache-read-only: ${{ github.ref != 'refs/heads/1.20.1' && github.ref != 'refs/heads/1.21' }} - add-job-summary: 'on-failure' diff --git a/.github/actions/ctnh_prepare_workspace/action.yml b/.github/actions/ctnh_prepare_workspace/action.yml new file mode 100644 index 00000000000..63324774bf9 --- /dev/null +++ b/.github/actions/ctnh_prepare_workspace/action.yml @@ -0,0 +1,174 @@ +name: Prepare CTNH Workspace +description: Checkout CTNH-Modules and required module repos, then setup Java/Gradle. + +inputs: + token: + description: Token used for all checkouts. + required: true + module_name: + description: Module directory name under CTNH-Modules/modules (e.g. CTNH-Core). + required: true + + ctnh_modules_repository: + description: CTNH-Modules repository. + required: false + default: CTNH-Team/CTNH-Modules + ctnh_modules_ref: + description: CTNH-Modules ref (branch/tag/SHA). + required: false + default: master + + ctnh_core_repository: + description: CTNH-Core repository. + required: false + default: CTNH-Team/CTNH-Core + ctnh_core_ref: + description: CTNH-Core ref. + required: false + default: dev + + ctnh_bio_repository: + description: CTNH-Bio repository. + required: false + default: CTNH-Team/CTNH-Bio + ctnh_bio_ref: + description: CTNH-Bio ref. + required: false + default: dev + + ctnh_energy_repository: + description: CTNH-Energy repository. + required: false + default: CTNH-Team/CTNH-Energy + ctnh_energy_ref: + description: CTNH-Energy ref. + required: false + default: dev + + ctnh_lib_repository: + description: CTNH-Lib repository. + required: false + default: CTNH-Team/CTNH-Lib + ctnh_lib_ref: + description: CTNH-Lib ref. + required: false + default: dev + + ctnh_mana_repository: + description: CTNH-Mana repository. + required: false + default: CTNH-Team/CTNH-Mana + ctnh_mana_ref: + description: CTNH-Mana ref. + required: false + default: dev + + ctpp_repository: + description: CTPP repository. + required: false + default: CTNH-Team/CTPP + ctpp_ref: + description: CTPP ref. + required: false + default: dev + + gtm_repository: + description: GTM repository. + required: false + default: CTNH-Team/GregTech-Modern + gtm_ref: + description: GTM ref. + required: false + default: dev + +runs: + using: composite + steps: + - name: Checkout CTNH-Modules + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_modules_repository }} + ref: ${{ inputs.ctnh_modules_ref }} + path: CTNH-Modules + + - name: Checkout Current Module + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + fetch-depth: 0 + path: CTNH-Modules/modules/${{ inputs.module_name }} + + - name: Checkout CTNH-Core + if: ${{ inputs.module_name != 'CTNH-Core' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_core_repository }} + ref: ${{ inputs.ctnh_core_ref }} + path: CTNH-Modules/modules/CTNH-Core + + - name: Checkout CTNH-Bio + if: ${{ inputs.module_name != 'CTNH-Bio' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_bio_repository }} + ref: ${{ inputs.ctnh_bio_ref }} + path: CTNH-Modules/modules/CTNH-Bio + + - name: Checkout CTNH-Energy + if: ${{ inputs.module_name != 'CTNH-Energy' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_energy_repository }} + ref: ${{ inputs.ctnh_energy_ref }} + path: CTNH-Modules/modules/CTNH-Energy + + - name: Checkout CTNH-Lib + if: ${{ inputs.module_name != 'CTNH-Lib' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_lib_repository }} + ref: ${{ inputs.ctnh_lib_ref }} + path: CTNH-Modules/modules/CTNH-Lib + + - name: Checkout CTNH-Mana + if: ${{ inputs.module_name != 'CTNH-Mana' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_mana_repository }} + ref: ${{ inputs.ctnh_mana_ref }} + path: CTNH-Modules/modules/CTNH-Mana + + - name: Checkout CTPP + if: ${{ inputs.module_name != 'CTPP' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctpp_repository }} + ref: ${{ inputs.ctpp_ref }} + path: CTNH-Modules/modules/CTPP + + - name: Checkout GTM + if: ${{ inputs.module_name != 'GregTech-Modern' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.gtm_repository }} + ref: ${{ inputs.gtm_ref }} + path: CTNH-Modules/modules/GregTech-Modern + + - name: Setup Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-read-only: ${{ github.event_name == 'pull_request' }} diff --git a/.github/json/config-1.21.json b/.github/json/config-1.21.json deleted file mode 100644 index a726d5da9a5..00000000000 --- a/.github/json/config-1.21.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "categories": [ - { - "title": "### Added", - "labels": ["type: feature"] - }, - { - "title": "### Fixed", - "labels": ["type: bugfix"] - }, - { - "title": "### Changed", - "labels": ["type: refactor", "type: translation"] - } - ], - "sort": "ASC", - "template": "## Version [v#{{VERSION}}](#{{RELEASE_DIFF}})\n#{{CHANGELOG}} ", - "pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})", - "custom_placeholders": [ - { - "name": "VERSION", - "source": "TO_TAG", - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } - } - ], - "empty_template": "", - "ignore_labels": ["ignore changelog"], - "tag_resolver": { - "method": "semver", - "filter": { - "pattern": "^(?!v?[0-9\\.]+(-1\\.21)$).+$", - "flags": "gu" - }, - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } - }, - "max_pull_requests": 1000, - "max_back_track_time_days": 365, - "base_branches": ["1.21"] -} diff --git a/.github/json/config-latest-1.21.json b/.github/json/config-latest-1.21.json deleted file mode 100644 index 3ebbf9f0313..00000000000 --- a/.github/json/config-latest-1.21.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "categories": [ - { - "title": "### Added", - "labels": ["type: feature"] - }, - { - "title": "### Fixed", - "labels": ["type: bugfix"] - }, - { - "title": "### Changed", - "labels": ["type: refactor", "type: translation"] - } - ], - "sort": "ASC", - "template": "## What's Changed since #{{FROM_TAG}}\n#{{CHANGELOG}}\n#{{UNCATEGORIZED}}\n#{{CHANGES}} lines changed - see the [full diff here](#{{RELEASE_DIFF}})", - "pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})", - "empty_template": "", - "ignore_labels": ["ignore changelog"], - "tag_resolver": { - "method": "semver", - "filter": { - "pattern": "^(?!v?[0-9\\.]+(-1\\.21)$).+$", - "flags": "gu" - }, - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } - }, - "max_pull_requests": 1000, - "max_back_track_time_days": 365, - "base_branches": ["1.21"] -} diff --git a/.github/json/config-latest.json b/.github/json/config-latest.json deleted file mode 100644 index 50d7b05aa59..00000000000 --- a/.github/json/config-latest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "categories": [ - { - "title": "### Added", - "labels": ["type: feature"] - }, - { - "title": "### Fixed", - "labels": ["type: bugfix"] - }, - { - "title": "### Changed", - "labels": ["type: refactor", "type: translation"] - } - ], - "sort": "ASC", - "template": "## What's Changed since #{{FROM_TAG}}\n#{{CHANGELOG}}\n#{{UNCATEGORIZED}}\n#{{CHANGES}} lines changed - see the [full diff here](#{{RELEASE_DIFF}})", - "pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})", - "empty_template": "", - "ignore_labels": ["ignore changelog"], - "tag_resolver": { - "method": "semver", - "filter": { - "pattern": "^(?!v?[0-9\\.]+(-1\\.20\\.1)?$).+$", - "flags": "gu" - }, - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } - }, - "max_pull_requests": 1000, - "max_back_track_time_days": 365, - "base_branches": ["1.20.1"] -} diff --git a/.github/json/config.json b/.github/json/config.json deleted file mode 100644 index 96eb4907cfd..00000000000 --- a/.github/json/config.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "categories": [ - { - "title": "### Added", - "labels": ["type: feature"] - }, - { - "title": "### Fixed", - "labels": ["type: bugfix"] - }, - { - "title": "### Changed", - "labels": ["type: refactor", "type: translation"] - } - ], - "sort": "ASC", - "template": "## Version [v#{{VERSION}}](#{{RELEASE_DIFF}})\n#{{CHANGELOG}} ", - "pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in [##{{NUMBER}}](#{{URL}})", - "custom_placeholders": [ - { - "name": "VERSION", - "source": "TO_TAG", - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } - } - ], - "empty_template": "", - "ignore_labels": ["ignore changelog"], - "tag_resolver": { - "method": "semver", - "filter": { - "pattern": "^(?!v?[0-9\\.]+(-1\\.20\\.1)?$).+$", - "flags": "gu" - }, - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } - }, - "max_pull_requests": 1000, - "max_back_track_time_days": 365, - "base_branches": ["1.20.1"] -} diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 35e4f04262c..00000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,5 +0,0 @@ -# https://github.com/github/issue-labeler#usage -1.20.1: - - '/^1\.20\.1 Forge$/m' -1.21: - - '/^1\.21\.1 NeoForge$/m' \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 4132c1a42cb..00000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -## What -_This section describes what this PR is about. It should be a clear and concise description concerning what this PR is for, why this PR is needed, and why it should be accepted._ -_Linking an issue can be used alternatively to writing a description._ - -## Implementation Details -_Any implementations in this PR that should be carefully looked over, or that could/should have alternate solutions proposed._ - -## Outcome -_A short description of what this PR added/fixed/changed/removed._ -_For correct linking of issues please use any of the Closes/Fixes/Resolves keywords. Example: When a PR is fixing a bug use "Fixes: #number-of-bug"_ - -## How Was This Tested -_This section is for screenshots, code snippets or descriptions of how the PR was tested in code or in game to ensure correctness._ - -## Additional Information -_This section is for screenshots to demonstrate any GUI or rendering changes, or any other additional information that reviewers should be aware of._ - -## Potential Compatibility Issues -_This section is for defining possible compatibility issues. It must be used when there are API changes, item/block/material/machine changes, or recipe changes._ - -**Please fill in as much useful information as possible. Also, please remove all unused sections, including this and the other explanations.** \ No newline at end of file diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index ab345e4eb21..00000000000 --- a/.github/release.yml +++ /dev/null @@ -1,27 +0,0 @@ -changelog: - - exclude: - labels: - - "1.21" - - "ignore changelog" - - categories: - - title: New Features - labels: - - "type: feature" - - - title: Bug Fixes - labels: - - "type: bug" - - - title: Internal Changes - labels: - - "type: refactor" - - - title: Translation Changes - labels: - - "type: translation" - - - title: Other Changes - labels: - - "*" diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml deleted file mode 100644 index 0d0d415b26c..00000000000 --- a/.github/workflows/auto-build.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Latest Build - -on: - push: - branches: ['1.20.1', '1.21'] - paths: ['src/**', '**/*.gradle', 'gradle.properties'] - -concurrency: - group: auto-build-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ github.token }} - PUBLISH: ${{ !contains(github.event.commits[0].message, '[no-snapshot]') }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - MAVEN_USER: ${{ secrets.MAVEN_USER }} - SNAPSHOT: true - CI: true - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # do a full checkout instead of a shallow clone of HEAD so spotless's ratchetFrom works - - name: Setup Build - uses: ./.github/actions/build_setup - - name: Get Mod Version - id: ver - run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT - - name: Version Suffix - id: suffix - run: echo "VERSION_SUFFIX=$(echo "${{ github.sha }}" | cut -c 1-7)" >> $GITHUB_ENV - - name: Build - run: ./gradlew build - - name: Publish to Maven - if: ${{ github.repository_owner == 'GregTechCEu' && env.PUBLISH == 'true' }} - run: ./gradlew publish - - name: Rename Jars - if: ${{ env.PUBLISH == 'true' }} - run: for file in build/libs/*; do mv "$file" "${file/SHOT/SHOT+$(date --utc '+%Y%m%d-%H%M%S')-${{ env.VERSION_SUFFIX }}}"; done; - - name: Upload Artifacts - if: ${{ env.PUBLISH == 'true' }} - uses: actions/upload-artifact@v4 - with: - name: build-artifacts - path: build/libs/* - if-no-files-found: error - retention-days: 90 - - name: Changelog - id: changelog - if: ${{ env.PUBLISH == 'true' }} - uses: mikepenz/release-changelog-builder-action@v5 - with: - configuration: "./.github/json/config-latest${{ contains(github.ref_name, '1.21') && '-1.21' || '' }}.json" - toTag: ${{ github.ref }} - fetchViaCommits: true - failOnError: false - - name: Release Latest - if: ${{ env.PUBLISH == 'true' }} - uses: andelf/nightly-release@46e2d5f80828ecc5c2c3c819eb31186a7cf2156c - with: - tag_name: latest-${{ github.ref_name }} - name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT ${{ env.VERSION_SUFFIX }}' - prerelease: true - body: | - The latest build of GTM for Minecraft ${{ github.ref_name }}. - Please report any [issues](https://github.com/GregTechCEu/GregTech-Modern/issues). - ${{ steps.changelog.outputs.changelog }} - files: build/libs/*.jar diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml deleted file mode 100644 index 0a4dce7b0aa..00000000000 --- a/.github/workflows/build-on-push.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build pull request on push - -on: - pull_request: - paths: ['**'] - -# Cancel previous jobs if PR gets another push -concurrency: - group: PR-build-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - env: - VERSION_SUFFIX: "PR-${{ github.event.number }}" - steps: - - uses: actions/checkout@v4 - - name: Check Path Filter - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - code: - - 'src/**' - - '*.gradle' - - 'gradle.properties' - - 'gradlew*' - - 'gradle/**' - - name: Setup Build - if: steps.filter.outputs.code == 'true' - uses: ./.github/actions/build_setup - - name: Build - if: steps.filter.outputs.code == 'true' - run: ./gradlew assemble - - name: Rename Jars - if: steps.filter.outputs.code == 'true' - run: for file in build/libs/*; do mv "$file" "${file/.jar/-${{ env.VERSION_SUFFIX }}.jar}"; done; - - name: Upload All Artifacts - if: steps.filter.outputs.code == 'true' - uses: actions/upload-artifact@v4.0.0 - with: - name: Full Package - path: build/libs/* - retention-days: 15 - - name: Upload Main Jar - if: steps.filter.outputs.code == 'true' - uses: actions/upload-artifact@v4.0.0 - with: - name: Main Jar - path: build/libs/*[0-9]-PR-*.jar - retention-days: 15 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..444bd8e05f1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,87 @@ +name: Build + +on: + push: + pull_request: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + env: + MODULE_NAME: GregTech-Modern + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check Path Filter + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + code: + - 'src/**' + - 'spotless/**' + - 'gradle/**' + - '**/*.gradle' + - 'settings.gradle' + - 'gradle.properties' + - 'dependencies.gradle' + - 'gradlew' + - 'gradlew.bat' + - '.github/**' + + - name: Prepare Workspace + if: steps.filter.outputs.code == 'true' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' + uses: ./.github/actions/ctnh_prepare_workspace + with: + token: ${{ github.token }} + module_name: ${{ env.MODULE_NAME }} + + - name: Build + if: steps.filter.outputs.code == 'true' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' + working-directory: CTNH-Modules + run: ./gradlew :modules:${{ env.MODULE_NAME }}:build + + - name: Version Suffix + if: github.event_name != 'release' && (steps.filter.outputs.code == 'true' || github.event_name == 'workflow_dispatch') + shell: bash + run: | + set -euo pipefail + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + echo "VERSION_SUFFIX=PR-${{ github.event.number }}" >> "$GITHUB_ENV" + else + echo "VERSION_SUFFIX=$(echo "${GITHUB_SHA}" | cut -c 1-7)" >> "$GITHUB_ENV" + fi + + - name: Rename Jars + if: github.event_name != 'release' && (steps.filter.outputs.code == 'true' || github.event_name == 'workflow_dispatch') + shell: bash + run: | + set -euo pipefail + libs_dir="CTNH-Modules/modules/${MODULE_NAME}/build/libs" + for file in "$libs_dir"/*.jar; do + [[ -e "$file" ]] || continue + mv "$file" "${file/.jar/-${VERSION_SUFFIX}.jar}" + done + + - name: Upload Artifacts + if: steps.filter.outputs.code == 'true' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: ${{ env.MODULE_NAME }}-jars + path: CTNH-Modules/modules/${{ env.MODULE_NAME }}/build/libs/*.jar + if-no-files-found: error + retention-days: 15 + + - name: Upload to Release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: CTNH-Modules/modules/${{ env.MODULE_NAME }}/build/libs/*.jar diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml deleted file mode 100644 index e537d4d3292..00000000000 --- a/.github/workflows/clean.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Clean Gradle - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - name: Setup Build - uses: ./.github/actions/build_setup - with: - update-cache: true - - name: Clean - run: ./gradlew clean diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml deleted file mode 100644 index 28641f84243..00000000000 --- a/.github/workflows/deploy-pages.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish docs via GitHub Pages -on: - workflow_dispatch: - push: - branches: ["1.20.1", "1.21"] - paths: ['docs/**'] - -permissions: - contents: write - -concurrency: - group: 'pages' - cancel-in-progress: false - -jobs: - build: - name: build docs - runs-on: ubuntu-latest - defaults: - run: - working-directory: './docs' - steps: - - uses: actions/checkout@v4 - with: - ref: '${{ github.ref_name }}' - fetch-depth: 0 - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: 'pip' - - name: Install packages - run: pip install -r ./requirements.txt - - name: Set git username and password - run: git config user.name 'github-actions[bot]'; git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - - name: Deploy pages to gh-pages branch - run: mike deploy "${{ github.ref_name }}" --push - - name: Ensure 1.20.1 is the default version - run: mike set-default 1.20.1 --push \ No newline at end of file diff --git a/.github/workflows/format-java.yml b/.github/workflows/format-java.yml deleted file mode 100644 index 870202a8490..00000000000 --- a/.github/workflows/format-java.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Runs formatting requirements -name: Java Formatting - -on: - push: - branches: ['1.20.1', '1.21'] - paths: ['src/main/java/**', 'src/test/**'] - pull_request: - paths: ['**'] - -concurrency: - group: formatting-${{ github.ref }} - cancel-in-progress: true - -jobs: - formatting: - name: Formatting - runs-on: ubuntu-latest - permissions: - pull-requests: read - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # do a full checkout instead of a shallow clone of HEAD so spotless's ratchetFrom works - - name: Check Path Filter - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - code: - - 'src/main/java/**' - - 'src/test/**' - - name: Setup Build - if: steps.filter.outputs.code == 'true' - uses: ./.github/actions/build_setup - - name: Run Spotless Formatting Check with Gradle - if: steps.filter.outputs.code == 'true' - run: ./gradlew spotlessCheck --warning-mode all diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 66432dc2e3e..00000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Label PRs - -on: - - pull_request_target - -jobs: - labeler: - uses: GregTechCEu/GithubActions/.github/workflows/labeler.yml@main - secrets: inherit diff --git a/.github/workflows/manage-issue-labels.yml b/.github/workflows/manage-issue-labels.yml deleted file mode 100644 index 6b6edfedfc8..00000000000 --- a/.github/workflows/manage-issue-labels.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Manages labels on new issues -name: Issue Labels - -on: - issues: - types: [opened] - -permissions: - issues: write - contents: read - -jobs: - labels: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: '1.20.1' - sparse-checkout: '.github/labeler.yml' - - uses: github/issue-labeler@v3.3 - with: - configuration-path: .github/labeler.yml - enable-versioned-regex: 0 diff --git a/.github/workflows/manage-pr-labels.yml b/.github/workflows/manage-pr-labels.yml deleted file mode 100644 index 80c2e0c3f0f..00000000000 --- a/.github/workflows/manage-pr-labels.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Manages labels on PRs before allowing merging -name: Pull Request Labels - -# Checks for label once PR has been reviewed or label is applied -on: - pull_request: - types: [opened, labeled, unlabeled] - -concurrency: - group: pr-labels-${{ github.head_ref }} - cancel-in-progress: true - -jobs: - labels: - name: Label Check - runs-on: ubuntu-latest - permissions: - pull-requests: read # needed to utilize required-labels - steps: - - name: Check for Merge-Blocking Labels # blocks merge if present - uses: mheap/github-action-required-labels@v5 - with: - mode: exactly - count: 0 - labels: 'do not merge, admin merge' - exit_type: failure - - - name: Check for Required Type Labels # require at least one of these labels - uses: mheap/github-action-required-labels@v5 - with: - mode: minimum - count: 1 - labels: 'type: feature, type: bugfix, type: refactor, type: translation, type: tests, ignore changelog' - exit_type: failure - - - name: Check for Required Release Label # require exactly one of these labels - uses: mheap/github-action-required-labels@v5 - with: - mode: exactly - count: 1 - labels: 'release: api - X.0.0, release: major - 0.X.0, release: Patch - 0.0.X, release: stale' - exit_type: failure - diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml deleted file mode 100644 index 71ee87efa4c..00000000000 --- a/.github/workflows/publish-on-release.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish on Release - -on: - release: - types: [released] - -jobs: - meta: - name: Metadata - runs-on: ubuntu-latest - outputs: - CHANGELOG: ${{ steps.changelog.outputs.changelog }} - permissions: - contents: write - pull-requests: read - steps: - - name: Get Config - uses: actions/checkout@v4 - with: - ref: '1.20.1' - sparse-checkout: '.github/json' - - name: Generate changelog - id: changelog - env: - GITHUB_TOKEN: ${{ github.token }} - CONFIG: ${{ contains(github.ref_name, '1.21') && '-1.21' || '' }} - uses: mikepenz/release-changelog-builder-action@v5 - with: - configuration: './.github/json/config${{ env.CONFIG }}.json' - ignorePreReleases: true - fetchViaCommits: true - failOnError: true - - publish-20: - name: 1.20.1 - needs: [ meta ] - if: ${{ contains(github.ref_name, '1.20.1') || !contains(github.ref_name, '1.21') }} - secrets: inherit - uses: ./.github/workflows/publish.yml - with: - simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'GregTechCEu' }} - branch: '1.20.1' - tag-name: ${{ github.ref_name }} - release-body: ${{ github.event.release.body }} - changelog-body: ${{ needs.meta.outputs.CHANGELOG }} - - publish-21: - name: 1.21.1 - needs: [ meta ] - if: ${{ contains(github.ref_name, '1.21') || !contains(github.ref_name, '1.20.1') }} - secrets: inherit - uses: ./.github/workflows/publish.yml - with: - simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'GregTechCEu' }} - branch: '1.21' - tag-name: ${{ github.ref_name }} - release-body: ${{ github.event.release.body }} - changelog-body: ${{ needs.meta.outputs.CHANGELOG }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index e55dce631d0..00000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: Publish Version - -on: - workflow_call: - inputs: - simulate: - required: false - type: boolean - branch: - description: 'Branch to checkout; 1.20.1 or 1.21' - required: true - type: string - tag-name: - description: 'Tag to upload to' - required: true - type: string - release-body: - description: 'Body for published release notes' - required: false - type: string - changelog-body: - description: 'Body of change notes to insert into CHANGELOG.md' - required: false - type: string - -jobs: - build: - name: Build and Publish to Maven - runs-on: ubuntu-latest - permissions: - contents: write - env: - CI: 'true' - outputs: - ver: ${{ steps.ver.outputs.version }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - name: Setup Build - uses: ./.github/actions/build_setup - with: - ref: ${{ inputs.branch }} - - name: Get Version - id: ver - run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT - - name: Build - run: ./gradlew assemble - - name: Upload Build Artifacts - uses: actions/upload-artifact@v4 - with: - name: build-artifacts-${{ inputs.branch }} - path: build/libs/* - if-no-files-found: error - retention-days: 3 - - name: Publish - if: ${{ !inputs.simulate }} - env: - MAVEN_USER: ${{ secrets.MAVEN_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - run: ./gradlew publish - - upload-release-artifacts: - name: Upload Artifacts - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: build-artifacts-${{ inputs.branch }} - - name: Upload artifacts to release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ inputs.tag-name }} - files: ./*.jar - fail_on_unmatched_files: true - - publish-modrinth: - name: Publish to Modrinth - needs: build - if: ${{ !inputs.simulate }} - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: build-artifacts-${{ inputs.branch }} - - name: Publish Mod - env: - MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }} - LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }} - JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }} - VERSION_TYPE: ${{ inputs.branch == '1.21' && 'beta' || 'beta' }} - uses: Kir-Antipov/mc-publish@v3.3.0 - with: - modrinth-id: 7tG215v7 - modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - files: | - ./gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar - ./!(gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar) - name: 'GregTech CEu ${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - version: 'mc${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - version-type: ${{ env.VERSION_TYPE }} - changelog: ${{ inputs.release-body }} - loaders: ${{ env.LOADER }} - java: ${{ env.JAVA }} - fail-mode: fail - - publish-cf: - name: Publish to CF - needs: build - if: ${{ !inputs.simulate }} - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: build-artifacts-${{ inputs.branch }} - - name: Publish Mod - env: - MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }} - LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }} - JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }} - VERSION_TYPE: ${{ inputs.branch == '1.21' && 'alpha' || 'beta' }} - uses: Kir-Antipov/mc-publish@v3.3.0 - with: - curseforge-id: 890405 - curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - files: | - ./gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar - ./!(gtceu-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar) - name: 'GregTech CEu ${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - version: 'mc${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - version-type: ${{ env.VERSION_TYPE }} - changelog: ${{ inputs.release-body }} - loaders: ${{ env.LOADER }} - java: ${{ env.JAVA }} - fail-mode: fail - - # After successful release, PR version bump and changelog - bump-version-and-changelog: - name: Bump Version and Build Changelog - needs: [ build, upload-release-artifacts ] - if: ${{ always() && !failure() && !cancelled() }} - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - name: Bump Version - run: | - git config user.name 'github-actions[bot]' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git switch -C gh/release-${{ inputs.branch }} - BUMPED=$(echo ${{ needs.build.outputs.ver }} | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.) - sed -i "s/= ${{ needs.build.outputs.ver }}/= ${BUMPED}/" gradle.properties - git commit -am "Bump version to ${BUMPED}" - - name: Prepend to CHANGELOG - if: inputs.changelog-body - run: | - { head -n 2 CHANGELOG.md; echo -e "${{ inputs.changelog-body }}"; tail -n +3 CHANGELOG.md; } > temp.md && mv temp.md CHANGELOG.md - git commit -am "Updated CHANGELOG" - - name: Push and PR - env: - GH_TOKEN: ${{ github.token }} - run: | - git push --force --set-upstream origin gh/release-${{ inputs.branch }} - gh pr create -B ${{ inputs.branch }} -H gh/release-${{ inputs.branch }} --title "RELEASE for ${{ inputs.branch }} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog" diff --git a/.github/workflows/spotless.yml b/.github/workflows/spotless.yml new file mode 100644 index 00000000000..4e8582f745f --- /dev/null +++ b/.github/workflows/spotless.yml @@ -0,0 +1,47 @@ +name: Spotless + +on: + push: + pull_request: + +jobs: + spotless: + runs-on: ubuntu-latest + + env: + MODULE_NAME: CTNH-Core + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check Path Filter + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + code: + - 'src/**' + - 'spotless/**' + - 'gradle/**' + - '**/*.gradle' + - 'settings.gradle' + - 'gradle.properties' + - 'dependencies.gradle' + - 'gradlew' + - 'gradlew.bat' + - '.github/**' + + - name: Prepare Workspace + if: steps.filter.outputs.code == 'true' + uses: ./.github/actions/ctnh_prepare_workspace + with: + token: ${{ github.token }} + module_name: ${{ env.MODULE_NAME }} + + - name: Spotless Check + if: steps.filter.outputs.code == 'true' + working-directory: CTNH-Modules + run: ./gradlew :modules:${{ env.MODULE_NAME }}:spotlessCheck --warning-mode all diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml deleted file mode 100644 index b68eade10e2..00000000000 --- a/.github/workflows/sync.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Sync Github Folder - -on: - push: - branches: ['1.20.1'] - paths: ['.github/**'] - -jobs: - sync: - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ github.token }} - steps: - - uses: actions/checkout@v4 - with: - ref: '1.21' - - run: | - git config user.name 'github-actions[bot]' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git switch -C gh/workflow-sync - git fetch origin - git checkout origin/1.20.1 -- .github - git commit -am "Sync Workflows" - git push --force --set-upstream origin gh/workflow-sync - gh pr create -B 1.21 -H gh/workflow-sync --title "Sync Workflows with 1.20.1 [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog" diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml deleted file mode 100644 index 043be9c7127..00000000000 --- a/.github/workflows/test-on-push.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Test pull request on push - -on: - pull_request: - paths: ['**'] - -# Cancel previous jobs if PR gets another push -concurrency: - group: PR-test-${{ github.ref }} - cancel-in-progress: true - -jobs: - test: - runs-on: ubuntu-latest - env: - VERSION_SUFFIX: "PR-${{ github.event.number }}" - steps: - - uses: actions/checkout@v4 - - name: Check Path Filter - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - code: - - 'src/**' - - '*.gradle' - - 'gradle.properties' - - 'gradlew*' - - 'gradle/**' - - name: Setup Build - if: steps.filter.outputs.code == 'true' - uses: ./.github/actions/build_setup - - name: Run GameTests - if: steps.filter.outputs.code == 'true' - id: gametest - continue-on-error: true - run: ./gradlew runGameTestServer - - name: Update “Tests Passed” / “Tests Failed” labels - if: steps.filter.outputs.code == 'true' && github.event.pull_request.head.repo.full_name == github.repository - uses: actions/github-script@v7 - with: - script: | - const [add, remove] = { - success: ['Tests: Passed','Tests: Failed'], - failure: ['Tests: Failed','Tests: Passed'] - }['${{ steps.gametest.outcome }}']; - - const { owner, repo } = context.repo; - const issue_number = context.payload.pull_request.number; - - await github.rest.issues - .addLabels({ owner, repo, issue_number, labels: [add] }) - .catch(() => {}); - - await github.rest.issues - .removeLabel({ owner, repo, issue_number, name: remove }) - .catch(() => {}); - - name: Fail on GameTest failures - if: steps.filter.outputs.code == 'true' && steps.gametest.outcome == 'failure' - run: exit 1 \ No newline at end of file diff --git a/.github/workflows/update-gradle-cache.yml b/.github/workflows/update-gradle-cache.yml deleted file mode 100644 index ac02fc0a504..00000000000 --- a/.github/workflows/update-gradle-cache.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Updates the Gradle Cache when necessary -name: Update Gradle Cache - -on: - push: - branches: ['1.20.1', '1.21'] - paths: ['gradle/**', '**/*.gradle', 'gradle.properties', 'gradlew*', 'src/main/resources/accesstransformer.cfg'] - workflow_dispatch: - -concurrency: - group: gradle-cache-${{ github.ref }} - cancel-in-progress: true - -jobs: - update-cache: - name: Update Grade Cache - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - name: Setup Build - uses: ./.github/actions/build_setup - with: - update-cache: true - - name: Build Project with Gradle - run: ./gradlew assemble --warning-mode all diff --git a/build.gradle b/build.gradle index a6210f1c529..e7a95904e89 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java-library' - id 'org.jetbrains.kotlin.jvm' + id 'org.jetbrains.kotlin.jvm' version '2.0.21' id 'eclipse' id 'idea' id 'maven-publish' @@ -80,14 +80,14 @@ obfuscation { createRemappingConfiguration(configurations.clientExtraLocalRuntime) } -apply from: "$rootDir/gradle/scripts/jars.gradle" -apply from: "$rootDir/gradle/scripts/moddevgradle.gradle" -apply from: "$rootDir/gradle/scripts/repositories.gradle" -apply from: "$rootDir/dependencies.gradle" -apply from: "$rootDir/gradle/scripts/resources.gradle" -apply from: "$rootDir/gradle/scripts/publishing.gradle" -apply from: "$rootDir/gradle/scripts/spotless.gradle" -apply from: "$rootDir/gradle/scripts/docs.gradle" +apply from: "$projectDir/gradle/scripts/jars.gradle" +apply from: "$projectDir/gradle/scripts/moddevgradle.gradle" +apply from: "$projectDir/gradle/scripts/repositories.gradle" +apply from: "$projectDir/dependencies.gradle" +apply from: "$projectDir/gradle/scripts/resources.gradle" +apply from: "$projectDir/gradle/scripts/publishing.gradle" +apply from: "$projectDir/gradle/scripts/spotless.gradle" +apply from: "$projectDir/gradle/scripts/docs.gradle" tasks.withType(JavaCompile).configureEach { diff --git a/gradle.properties b/gradle.properties index 9b9873e5704..cc3a99d953c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.caching = true # Mod Info mod_id = gtceu mod_name = GregTech -mod_version = 7.5.0 +mod_version = 7.5.0-ctnh mod_description = GregTech CE Unofficial, ported from 1.12.2 mod_license = LGPL-3.0 license mod_url = https://github.com/GregTechCEu/GregTech-Modern/ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 96029a58b06..fb0dce9c777 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,11 +1,11 @@ [versions] minecraft = "1.20.1" -forge = "47.3.0" -minecraftForge = "1.20.1-47.3.0" +forge = "47.4.1" +minecraftForge = "1.20.1-47.4.1" parchment = "2023.09.03" # https://parchmentmc.org/docs/getting-started shadow = "8.3.5" spotless = "8.1.0" -modDevGradle = "2.0.86" +modDevGradle = "2.0.91" lombok = "8.14" jetbrains-annotations = "26.0.1" renderNurse = "0.0.12" diff --git a/gradle/scripts/jars.gradle b/gradle/scripts/jars.gradle index 5f2c4979701..5dda74e2c63 100644 --- a/gradle/scripts/jars.gradle +++ b/gradle/scripts/jars.gradle @@ -1,31 +1,27 @@ -tasks.register('slimJar', Jar) { - dependsOn("classes") - archiveClassifier = "dev-slim" - from sourceSets.main.output -} - -obfuscation { - reobfuscate(tasks.named('slimJar'), sourceSets.main) { - archiveClassifier = "slim" - } +tasks.jar { + archiveClassifier = "dev" + destinationDirectory = file("$buildDir/devlibs") + exclude("META-INF/jarjar/**") + from("LICENSE") } // Add sources jar to components.java java { - artifacts.archives(reobfSlimJar) withSourcesJar() } -jar.archiveClassifier = "dev" - base { archivesName = "${project.name}-${libs.versions.minecraft.get()}" } afterEvaluate { + tasks.named("sourcesJar", Jar).configure { + enabled = false + } + reobfJar.archiveClassifier = "" + reobfJar.destinationDirectory = file('build/libs/') tasks.withType(org.gradle.jvm.tasks.Jar).configureEach { - destinationDirectory = file('build/libs/') manifest.attributes([ 'MixinConfigs': 'gtceu.mixins.json', 'Specification-Title': project.name, diff --git a/gradle/scripts/moddevgradle.gradle b/gradle/scripts/moddevgradle.gradle index 3f857566965..cce16a5db05 100644 --- a/gradle/scripts/moddevgradle.gradle +++ b/gradle/scripts/moddevgradle.gradle @@ -4,7 +4,7 @@ ext.isJetbrainsRuntime = System.getProperty('java.vm.vendor').contains('JetBrain mixin { var refmap = add sourceSets.main, "gtceu.refmap.json" - slimJar.from refmap + jar.from refmap config 'gtceu.mixins.json' } diff --git a/gradle/scripts/publishing.gradle b/gradle/scripts/publishing.gradle index 96bff81ae7d..3eb643cde9a 100644 --- a/gradle/scripts/publishing.gradle +++ b/gradle/scripts/publishing.gradle @@ -2,7 +2,7 @@ publishing { publications { mavenJava(MavenPublication) { artifactId = base.archivesName.get() - artifact(reobfSlimJar) + artifact(reobfJar) from components.java } } diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle index 7c9c44f9e72..fb24ac6bebb 100644 --- a/gradle/scripts/spotless.gradle +++ b/gradle/scripts/spotless.gradle @@ -15,8 +15,8 @@ spotless { java { target 'src/main/java/**/*.java', 'src/test/java/**/*.java' - def orderFile = file("$rootDir/spotless/spotless.importorder") - def formatFile = file("$rootDir/spotless/spotless.eclipseformat.xml") + def orderFile = file("$projectDir/spotless/spotless.importorder") + def formatFile = file("$projectDir/spotless/spotless.eclipseformat.xml") toggleOffOn() importOrderFile(orderFile) @@ -26,7 +26,7 @@ spotless { } kotlin { target 'src/test/java/**/*.kt' - ktlint('1.4.1').setEditorConfigPath("$rootDir/spotless/spotless.ktlint") + ktlint('1.4.1').setEditorConfigPath("$projectDir/spotless/spotless.ktlint") toggleOffOn() endWithNewline() From 86c5db6aa2cb5aabe0ab00475e622004d1e7a106 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Sun, 5 Apr 2026 23:14:16 +0800 Subject: [PATCH 59/78] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0ae2=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dependencies.gradle | 1 + gradle/forge.versions.toml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 4334e330e3c..f1faa594f6e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -74,6 +74,7 @@ dependencies { // Standard runtime mods // modLocalRuntime(forge.jade) modLocalRuntime(forge.ae2) + modLocalRuntime(forge.guideme) modLocalRuntime(forge.spark) modLocalRuntime(forge.modernfix) diff --git a/gradle/forge.versions.toml b/gradle/forge.versions.toml index eac33484595..8151cf965e1 100644 --- a/gradle/forge.versions.toml +++ b/gradle/forge.versions.toml @@ -7,7 +7,7 @@ mixinExtras = "0.5.0-rc.3" jei = "15.20.0.115" rei = "12.1.785" emi = "1.1.13+1.20.1" -ae2 = "15.0.18" +ae2 = "15.4.10" kubejs = "2001.6.5-build.16" rhino = "2001.2.3-build.10" architectury = "9.2.14" @@ -51,6 +51,7 @@ ftblibrary-cm = "5567591" ftbteams-cm = "5267190" ftbquests-cm = "6167056" ftbchunks-cm = "5956390" +guideme = "6679102" [libraries] @@ -110,6 +111,8 @@ spark = { module = "curse.maven:spark-361579", version.ref = "spar observable = { module = "curse.maven:observable-509575", version.ref = "observable" } gamestages = { module = "net.darkhax.gamestages:GameStages-Forge-1.20.1", version.ref = "gamestages" } bookshelf = { module = "net.darkhax.bookshelf:Bookshelf-Forge-1.20.1", version.ref = "bookshelf" } +guideme = { module = "curse.maven:guideme-1173950", version.ref = "guideme" } + ## cursemaven as a backup ## ftblibrary-cm = { module = "curse.maven:ftb-library-forge-404465", version.ref = "ftblibrary-cm" } ftbteams-cm = { module = "curse.maven:ftb-teams-forge-404468", version.ref = "ftbteams-cm" } From 31174eedc02a982ec4a9e1a193dc2eb00111ec6f Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Thu, 9 Apr 2026 22:52:04 +0800 Subject: [PATCH 60/78] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=A7?= =?UTF-8?q?=E5=9E=8B=E8=92=B8=E9=A6=8F=E5=A1=94=E7=9A=84=E8=92=B8=E9=A6=8F?= =?UTF-8?q?=E5=AE=A4=E6=A8=A1=E5=BC=8F=E5=A4=84=E7=90=86=E6=97=A0=E6=B5=81?= =?UTF-8?q?=E4=BD=93=E8=BE=93=E5=87=BA=E9=85=8D=E6=96=B9=E6=97=B6=E5=B4=A9?= =?UTF-8?q?=E6=BA=83=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/api/capability/recipe/ItemRecipeCapability.java | 4 ++-- .../common/item/tool/behavior/MachineConfigCopyBehaviour.java | 1 - .../machine/multiblock/electric/DistillationTowerMachine.java | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index b281ce08c54..14eae9ed371 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -32,8 +32,8 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.jei.IngredientIO; - import com.lowdragmc.lowdraglib.syncdata.IContentChangeAware; + import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.util.valueproviders.IntProvider; @@ -439,7 +439,7 @@ public void applyWidgetInfo(@NotNull Widget widget, slot.setIngredientIO(io == IO.IN ? IngredientIO.INPUT : IngredientIO.OUTPUT); slot.setCanTakeItems(!isXEI); slot.setCanPutItems(!isXEI && io.support(IO.IN)); - if(items instanceof IContentChangeAware item1) { + if (items instanceof IContentChangeAware item1) { slot.setChangeListener(item1.getOnContentsChanged()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java index 0c546a59d9a..4696808fbba 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/MachineConfigCopyBehaviour.java @@ -13,7 +13,6 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; 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 84c490f2cda..8812565a263 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 @@ -280,6 +280,9 @@ private boolean applyFluidOutputs(GTRecipe recipe, FluidAction action, VoidingMo // Distillery recipes should output to the first non-void handler if (recipe.recipeType == GTRecipeTypes.DISTILLERY_RECIPES) { + if (fluids.isEmpty()) { + return true; + } var fluid = fluids.get(0).getStacks()[0]; var handler = getMachine().getFirstValid(); if (handler == null) return false; From 67d88ac10a5f77c081bfc5ed57b6a530b9afffcb Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Tue, 14 Apr 2026 00:09:31 +0800 Subject: [PATCH 61/78] =?UTF-8?q?feat:=20=E5=A4=9A=E6=96=B9=E5=9D=97?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/assets/gtceu/lang/en_ud.json | 17 + .../resources/assets/gtceu/lang/en_us.json | 17 + .../gtceu/models/block/rubber_leaves.json | 2 + .../api/gui/widget/CandidateSlotWidget.java | 84 ++++ .../api/gui/widget/PatternPreviewWidget.java | 466 +++++++++++++++--- .../gtceu/api/gui/widget/SlotWidget.java | 4 +- .../gtceu/config/ConfigHolder.java | 9 + .../multipage/MultiblockInfoEmiRecipe.java | 8 +- .../emi/recipe/Ae2PatternTerminalHandler.java | 2 +- .../resources/assets/gtceu/lang/zh_cn.json | 6 +- 10 files changed, 533 insertions(+), 82 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/api/gui/widget/CandidateSlotWidget.java diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 5662e6a4f60..8f47874ddb7 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -1915,6 +1915,7 @@ "config.gtceu.option.voltageTierNanoSuit": "ʇınSouɐNɹǝı⟘ǝbɐʇןoʌ", "config.gtceu.option.voltageTierNightVision": "uoısıΛʇɥbıNɹǝı⟘ǝbɐʇןoʌ", "config.gtceu.option.voltageTierQuarkTech": "ɥɔǝ⟘ʞɹɐnὉɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.widgetScale": "ǝןɐɔSʇǝbpıʍ", "config.gtceu.option.worldAcceleratorBlacklist": "ʇsıןʞɔɐןᗺɹoʇɐɹǝןǝɔɔⱯpןɹoʍ", "config.gtceu.option.worldgen": "uǝbpןɹoʍ", "config.gtceu.option.xOffset": "ʇǝsɟɟOx", @@ -3654,6 +3655,9 @@ "gtceu.placeholder_info.if.0": "˙0 oʇ ןɐnbǝ ʇou sı puɐ buıɹʇs ʎʇdɯǝ uɐ ʇou sı ʇı ɟı ǝnɹʇ pǝɹǝpısuoɔ sı uoıʇıpuoɔ ǝɥ⟘ ˙uoıʇıpuoɔ ǝɥʇ uo buıpuǝdǝp sʇuǝɯnbɹɐ ǝɥʇ ɟo ǝuo suɹnʇǝᴚ", "gtceu.placeholder_info.if.1": ":ǝbɐs∩", "gtceu.placeholder_info.if.2": "}]ǝsןɐɟ‾ɟı‾pǝuɹnʇǝɹ[ >ǝnɹʇ‾ɟı‾pǝuɹnʇǝɹ< >uoıʇıpuoɔ< ɟı{ ", + "gtceu.placeholder_info.item.0": "ʇoןs pǝıɟıɔǝds ɐ uı ɯǝʇı ǝɥʇ ɟo pı puɐ ʇunoɯɐ ǝɥʇ suɹnʇǝᴚ", + "gtceu.placeholder_info.item.1": ":ǝbɐs∩", + "gtceu.placeholder_info.item.2": ")ǝןdɯɐxǝ ɹoɟ( \"puoɯɐıp:ʇɟɐɹɔǝuıɯ ƖƐ\" >- }>ʇoןs< ɯǝʇı{ ", "gtceu.placeholder_info.itemCount.0": "˙)pǝɹǝʇןıɟ ǝq uɐɔ( sɯǝʇı ɟo ʇunoɯɐ ǝɥʇ suɹnʇǝᴚ", "gtceu.placeholder_info.itemCount.1": ":ǝbɐs∩", "gtceu.placeholder_info.itemCount.2": "ʇunoɯɐ ɯǝʇı ןɐʇoʇ >- }ʇunoƆɯǝʇı{ ", @@ -3667,6 +3671,9 @@ "gtceu.placeholder_info.maxProgress.1": ",%}00Ɩ * }}ssǝɹboɹԀxɐɯ{ / }ssǝɹboɹd{ ɔןɐɔ{ ɔןɐɔ{ :ssǝɹboɹԀ, :ǝןdɯɐxƎ", "gtceu.placeholder_info.maxProgress.2": ":ǝbɐs∩", "gtceu.placeholder_info.maxProgress.3": "ǝdıɔǝɹ buıuunɹ ʎןʇuǝɹɹnɔ ǝɥʇ ɟo ssǝɹboɹd xɐɯ ǝɥʇ >- }ssǝɹboɹԀxɐɯ{ ", + "gtceu.placeholder_info.module.0": ")ɹǝʌoɔ ɐ uı ʞɹoʍ ʇou sǝop( ɹoʇıuoɯ ןɐɹʇuǝɔ ǝɥʇ oʇuo ʇoןs pǝıɟıɔǝds ǝɥʇ uı ǝןnpoɯ ǝɥʇ sɹǝpuǝᴚ", + "gtceu.placeholder_info.module.1": ":ǝbɐs∩", + "gtceu.placeholder_info.module.2": "buıɹʇs ʎʇdɯǝ >- }>ʎ< >x< >ʇoןs< ǝןnpoɯ{ ", "gtceu.placeholder_info.nbt.0": "ʇoןs pǝıɟıɔǝds ǝɥʇ uı ɯǝʇı ǝɥʇ ɟo ɐʇɐp ʇqu ǝɥʇ suɹnʇǝᴚ", "gtceu.placeholder_info.nbt.1": ":ǝbɐs∩", "gtceu.placeholder_info.nbt.2": "]˙˙˙[]Ɛʎǝʞ[]ᄅʎǝʞ[]Ɩʎǝʞ[ʇqu‾ɯǝʇı >- }˙˙˙ ]Ɛʎǝʞ[ ]ᄅʎǝʞ[ ]Ɩʎǝʞ[ >ʇoןs< ʇqu{ ", @@ -3680,9 +3687,16 @@ "gtceu.placeholder_info.progress.1": "}ssǝɹboɹԀxɐɯ{ puɐ 0 uǝǝʍʇǝq ɹǝbǝʇuı uɐ sı ssǝɹboɹd ʇɐɥʇ ǝʇoN", "gtceu.placeholder_info.progress.2": ":ǝbɐs∩", "gtceu.placeholder_info.progress.3": "ǝdıɔǝɹ buıuunɹ ʎןʇuǝɹɹnɔ ǝɥʇ ɟo ssǝɹboɹd ǝɥʇ >- }ssǝɹboɹd{ ", + "gtceu.placeholder_info.quad.0": ")sǝɔıʇɹǝʌ ㄣ ןןɐ ɹoɟ sɹǝʇǝɯɐɹɐd ʎɟıɔǝds ʇsnɯ( pɐnb ɐ sʍɐɹᗡ", + "gtceu.placeholder_info.quad.1": ":ǝbɐs∩", + "gtceu.placeholder_info.quad.2": "buıɹʇs ʎʇdɯǝ >- }>ㄣɹoןoɔ< >Ɛɹoןoɔ< >ᄅɹoןoɔ< >Ɩɹoןoɔ< >ㄣʎ< >ㄣx< >Ɛʎ< >Ɛx< >ᄅʎ< >ᄅx< >Ɩʎ< >Ɩx< pɐnb{ ", "gtceu.placeholder_info.random.0": "˙)ǝʌısnןɔuı( ןɐʌɹǝʇuı pǝıɟıɔǝds ǝɥʇ uı ɹǝqɯnu ɯopuɐɹ ɐ suɹnʇǝᴚ", "gtceu.placeholder_info.random.1": ":ǝbɐs∩", "gtceu.placeholder_info.random.2": ")ǝʌısnןɔuı( xɐɯ puɐ uıɯ uǝǝʍʇǝq ɹǝqɯnu ɯopuɐɹ ɐ >- }>xɐɯ< >uıɯ< ɯopuɐɹ{ ", + "gtceu.placeholder_info.rect.0": "ǝzıs puɐ sǝʇɐuıpɹooɔ pǝıɟıɔǝds ǝɥʇ ɥʇıʍ uoıʇısod pǝıɟıɔǝds ǝɥʇ ʇɐ ǝןbuɐʇɔǝɹ ɐ sʍɐɹᗡ", + "gtceu.placeholder_info.rect.1": ":ǝbɐs∩", + "gtceu.placeholder_info.rect.2": "buıɹʇs ʎʇdɯǝ >- }>ᗺ⅁ᴚⱯɹoןoɔ< >ʇɥbıǝɥ< >ɥʇpıʍ< >ʎ< >x< ʇɔǝɹ{ ", + "gtceu.placeholder_info.rect.3": ")Ɩ 'ᄅ( ǝzıs ǝɥʇ ɥʇıʍ )ϛᄅ˙0 'ϛ˙0( ʇɐ ǝןbuɐʇɔǝɹ ǝʇıɥʍ ɐ sʍɐɹp >- }ℲℲℲℲℲℲℲℲx0 Ɩ ᄅ ϛᄅ˙0 ϛ˙0 ʇɔǝɹ{ ", "gtceu.placeholder_info.redstone.0": "ɥʇbuǝɹʇs ʇndʇno ǝuoʇspǝɹ ǝɥʇ sʇǝs ɹo ɥʇbuǝɹʇs ןɐubıs ǝuoʇspǝɹ ǝɥʇ suɹnʇǝᴚ", "gtceu.placeholder_info.redstone.1": ":ǝbɐs∩", "gtceu.placeholder_info.redstone.2": "ǝpıs pǝıɟıɔǝds ǝɥʇ ʇɐ )ϛƖ-0( ɥʇbuǝɹʇs ןɐubıs ǝuoʇspǝɹ >- }>ʇsǝʍ|ʇsɐǝ|ɥʇnos|ɥʇɹou|uʍop|dn< ʇǝb ǝuoʇspǝɹ{ ", @@ -3695,6 +3709,9 @@ "gtceu.placeholder_info.select.0": ")0 ɯoɹɟ buıʇɹɐʇs( xǝpuı pǝıɟıɔǝds ǝɥʇ ʇɐ ʇuǝɯnbɹɐ ǝɥʇ suɹnʇǝᴚ", "gtceu.placeholder_info.select.1": ":ǝbɐs∩", "gtceu.placeholder_info.select.2": "xǝpuı pǝıɟıɔǝds ǝɥʇ ʇɐ ʇuǝɯnbɹɐ >- ˙˙˙ ]Ɛbɹɐ[ ]ᄅbɹɐ[ ]Ɩbɹɐ[ >xǝpuı< ʇɔǝןǝs{ ", + "gtceu.placeholder_info.setImage.0": "ʇoןs pǝıɟıɔǝds ǝɥʇ uı ǝןnpoɯ ǝbɐɯı uɐ uı Ꞁᴚ∩ ǝbɐɯı ǝɥʇ sʇǝS", + "gtceu.placeholder_info.setImage.1": ":ǝbɐs∩", + "gtceu.placeholder_info.setImage.2": "buıɹʇs ʎʇdɯǝ >- }>ןɹn< >ʇoןs< ǝbɐɯIʇǝs{ ", "gtceu.placeholder_info.strike.0": "ʇno pǝssoɹɔ sɐʍ ʇı ɟı sɐ ʇı buıʎɐןdsıp 'ʇxǝʇ ʇsɹıɟ ǝɥʇ ɯoɹɟ ʇxǝʇ ǝɥʇ suɹnʇǝᴚ", "gtceu.placeholder_info.strike.1": ":ǝbɐs∩", "gtceu.placeholder_info.strike.2": "ʇxǝʇ ʇno-pǝssoɹɔ >- }>ʇxǝʇ< ǝʞıɹʇs{ ", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 8396c85fe46..54c3abdba93 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -1915,6 +1915,7 @@ "config.gtceu.option.voltageTierNanoSuit": "voltageTierNanoSuit", "config.gtceu.option.voltageTierNightVision": "voltageTierNightVision", "config.gtceu.option.voltageTierQuarkTech": "voltageTierQuarkTech", + "config.gtceu.option.widgetScale": "widgetScale", "config.gtceu.option.worldAcceleratorBlacklist": "worldAcceleratorBlacklist", "config.gtceu.option.worldgen": "worldgen", "config.gtceu.option.xOffset": "xOffset", @@ -3654,6 +3655,9 @@ "gtceu.placeholder_info.if.0": "Returns one of the arguments depending on the condition. The condition is considered true if it is not an empty string and is not equal to 0.", "gtceu.placeholder_info.if.1": "Usage:", "gtceu.placeholder_info.if.2": " {if [returned_if_false]}", + "gtceu.placeholder_info.item.0": "Returns the amount and id of the item in a specified slot", + "gtceu.placeholder_info.item.1": "Usage:", + "gtceu.placeholder_info.item.2": " {item } -> \"31 minecraft:diamond\" (for example)", "gtceu.placeholder_info.itemCount.0": "Returns the amount of items (can be filtered).", "gtceu.placeholder_info.itemCount.1": "Usage:", "gtceu.placeholder_info.itemCount.2": " {itemCount} -> total item amount", @@ -3667,6 +3671,9 @@ "gtceu.placeholder_info.maxProgress.1": "Example: 'Progress: {calc {calc {progress} / {maxProgress}} * 100}%'", "gtceu.placeholder_info.maxProgress.2": "Usage:", "gtceu.placeholder_info.maxProgress.3": " {maxProgress} -> the max progress of the currently running recipe", + "gtceu.placeholder_info.module.0": "Renders the module in the specified slot onto the central monitor (does not work in a cover)", + "gtceu.placeholder_info.module.1": "Usage:", + "gtceu.placeholder_info.module.2": " {module } -> empty string", "gtceu.placeholder_info.nbt.0": "Returns the nbt data of the item in the specified slot", "gtceu.placeholder_info.nbt.1": "Usage:", "gtceu.placeholder_info.nbt.2": " {nbt [key1] [key2] [key3] ...} -> item_nbt[key1][key2][key3][...]", @@ -3680,9 +3687,16 @@ "gtceu.placeholder_info.progress.1": "Note that progress is an integer between 0 and {maxProgress}", "gtceu.placeholder_info.progress.2": "Usage:", "gtceu.placeholder_info.progress.3": " {progress} -> the progress of the currently running recipe", + "gtceu.placeholder_info.quad.0": "Draws a quad (must specify parameters for all 4 vertices)", + "gtceu.placeholder_info.quad.1": "Usage:", + "gtceu.placeholder_info.quad.2": " {quad } -> empty string", "gtceu.placeholder_info.random.0": "Returns a random number in the specified interval (inclusive).", "gtceu.placeholder_info.random.1": "Usage:", "gtceu.placeholder_info.random.2": " {random } -> a random number between min and max (inclusive)", + "gtceu.placeholder_info.rect.0": "Draws a rectangle at the specified position with the specified coordinates and size", + "gtceu.placeholder_info.rect.1": "Usage:", + "gtceu.placeholder_info.rect.2": " {rect } -> empty string", + "gtceu.placeholder_info.rect.3": " {rect 0.5 0.25 2 1 0xFFFFFFFF} -> draws a white rectangle at (0.5, 0.25) with the size (2, 1)", "gtceu.placeholder_info.redstone.0": "Returns the redstone signal strength or sets the redstone output strength", "gtceu.placeholder_info.redstone.1": "Usage:", "gtceu.placeholder_info.redstone.2": " {redstone get } -> redstone signal strength (0-15) at the specified side", @@ -3695,6 +3709,9 @@ "gtceu.placeholder_info.select.0": "Returns the argument at the specified index (starting from 0)", "gtceu.placeholder_info.select.1": "Usage:", "gtceu.placeholder_info.select.2": " {select [arg1] [arg2] [arg3] ... -> argument at the specified index", + "gtceu.placeholder_info.setImage.0": "Sets the image URL in an image module in the specified slot", + "gtceu.placeholder_info.setImage.1": "Usage:", + "gtceu.placeholder_info.setImage.2": " {setImage } -> empty string", "gtceu.placeholder_info.strike.0": "Returns the text from the first text, displaying it as if it was crossed out", "gtceu.placeholder_info.strike.1": "Usage:", "gtceu.placeholder_info.strike.2": " {strike } -> crossed-out text", diff --git a/src/generated/resources/assets/gtceu/models/block/rubber_leaves.json b/src/generated/resources/assets/gtceu/models/block/rubber_leaves.json index a597ef2c9a9..9b40706824a 100644 --- a/src/generated/resources/assets/gtceu/models/block/rubber_leaves.json +++ b/src/generated/resources/assets/gtceu/models/block/rubber_leaves.json @@ -1,5 +1,7 @@ { "parent": "minecraft:block/leaves", + "render_type": "minecraft:cutout_mipped", + "render_type_fast": "minecraft:solid", "textures": { "all": "gtceu:block/rubber_leaves" } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CandidateSlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CandidateSlotWidget.java new file mode 100644 index 00000000000..1a815102565 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CandidateSlotWidget.java @@ -0,0 +1,84 @@ +package com.gregtechceu.gtceu.api.gui.widget; + +import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; + +import com.lowdragmc.lowdraglib.LDLib; +import com.lowdragmc.lowdraglib.gui.modular.ModularUIGuiContainer; + +import net.minecraft.client.Minecraft; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.items.IItemHandlerModifiable; + +import com.mojang.blaze3d.platform.InputConstants; +import dev.emi.emi.api.stack.EmiStackInteraction; +import dev.emi.emi.api.stack.ListEmiIngredient; +import dev.emi.emi.screen.EmiScreenManager; + +import java.util.List; + +public class CandidateSlotWidget extends SlotWidget { + + public CandidateSlotWidget(IItemHandlerModifiable itemHandler, int slotIndex, int xPosition, int yPosition, + boolean canTakeItems, boolean canPutItems) { + super(itemHandler, slotIndex, xPosition, yPosition, canTakeItems, canPutItems); + } + + public boolean showListIngredient(Object ingredient, int button) { + List ingredients = (List) ingredient; + return EmiScreenManager.stackInteraction(new EmiStackInteraction(new ListEmiIngredient(ingredients, 1)), + bind -> bind.matchesMouse(button)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (this.slotReference != null && this.isMouseOverElement(mouseX, mouseY) && this.gui != null) { + var ingredient = this.getXEICurrentIngredient(); + if (ingredient != null && LDLib.isEmiLoaded()) { + return showListIngredient(this.getXEICurrentIngredient(), button); + } else { + ModularUIGuiContainer modularUIGui = this.gui.getModularUIGui(); + boolean last = modularUIGui.getQuickCrafting(); + InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(button); + HOVER_SLOT = this.slotReference; + this.gui.getModularUIGui().superMouseClicked(mouseX, mouseY, button); + HOVER_SLOT = null; + if (last != modularUIGui.getQuickCrafting()) { + modularUIGui.dragSplittingButton = button; + if (button == 0) { + modularUIGui.dragSplittingLimit = 0; + } else if (button == 1) { + modularUIGui.dragSplittingLimit = 1; + } else if (Minecraft.getInstance().options.keyPickItem.matchesMouse(mouseKey.getValue())) { + modularUIGui.dragSplittingLimit = 2; + } + } + + return true; + } + } else { + return false; + } + } + + @Override + public Object getXEICurrentIngredient() { + if (this.slotReference != null && !this.slotReference.getItem().isEmpty()) { + Slot handler = this.getHandler(); + if (handler == null) { + return null; + } else { + ItemStack realStack = this.getRealStack(handler.getItem()); + if (handler instanceof WidgetSlotItemHandler slotHandler) { + if (slotHandler.getItemHandler() instanceof CycleItemEntryHandler entryHandler) { + return getXEIIngredientsClickable(entryHandler, slotHandler.index); + } + } + } + } + return null; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java index a28d389d0dd..f0cd12a694b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.widget; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; @@ -28,6 +29,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -45,7 +47,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.*; import dev.emi.emi.screen.RecipeScreen; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.LongSets; @@ -53,11 +55,15 @@ import me.shedaniel.rei.impl.client.gui.screen.AbstractDisplayViewingScreen; import org.jetbrains.annotations.NotNull; import org.joml.Vector3f; +import org.lwjgl.opengl.GL11; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; +import static com.gregtechceu.gtceu.common.data.GTMachines.*; +import static com.gregtechceu.gtceu.common.data.machines.GCYMMachines.PARALLEL_HATCH; + @OnlyIn(Dist.CLIENT) public class PatternPreviewWidget extends WidgetGroup { @@ -66,87 +72,30 @@ public class PatternPreviewWidget extends WidgetGroup { private static final int REGION_SIZE = 512; private static int LAST_OFFSET_INDEX = 0; private static final Map CACHE = new HashMap<>(); - private final SceneWidget sceneWidget; + private final PreviewSceneWidget sceneWidget; private final DraggableScrollableWidgetGroup scrollableWidgetGroup; public final MultiblockMachineDefinition controllerDefinition; public final MBPattern[] patterns; private final List predicates; + public boolean isHighLight; private int index; public int layer; private SlotWidget[] slotWidgets; private SlotWidget[] candidates; protected PatternPreviewWidget(MultiblockMachineDefinition controllerDefinition) { - super(0, 0, 160, 160); + super(0, 0, 160 + getSizeOffset(), 160 + getSizeOffset()); setClientSideWidget(); this.controllerDefinition = controllerDefinition; predicates = new ArrayList<>(); layer = -1; + isHighLight = false; + sceneWidget = new PreviewSceneWidget(3, 3, 150 + getSizeOffset(), 150 + getSizeOffset(), LEVEL); + sceneWidget.setOnSelected(this::onPosSelected); + sceneWidget.setRenderFacing(false); + addWidget(sceneWidget); - addWidget(sceneWidget = new SceneWidget(3, 3, 150, 150, LEVEL) { - - @Override - public void renderBlockOverLay(WorldSceneRenderer renderer) { - PoseStack poseStack = new PoseStack(); - hoverPosFace = null; - hoverItem = null; - if (isMouseOverElement(currentMouseX, currentMouseY)) { - BlockHitResult hit = renderer.getLastTraceResult(); - if (hit != null) { - if (core.contains(hit.getBlockPos())) { - hoverPosFace = new BlockPosFace(hit.getBlockPos(), hit.getDirection()); - } else if (!useOrtho) { - Vector3f hitPos = hit.getLocation().toVector3f(); - Level world = renderer.world; - Vec3 eyePos = new Vec3(renderer.getEyePos()); - hitPos.mul(2); // Double view range to ensure pos can be seen. - Vec3 endPos = new Vec3((hitPos.x - eyePos.x), (hitPos.y - eyePos.y), (hitPos.z - eyePos.z)); - double min = Float.MAX_VALUE; - for (BlockPos pos : core) { - BlockState blockState = world.getBlockState(pos); - if (blockState.getBlock() == Blocks.AIR) { - continue; - } - hit = world.clipWithInteractionOverride(eyePos, endPos, pos, - blockState.getShape(world, pos), blockState); - if (hit != null && hit.getType() != HitResult.Type.MISS) { - double dist = eyePos.distanceToSqr(hit.getLocation()); - if (dist < min) { - min = dist; - hoverPosFace = new BlockPosFace(hit.getBlockPos(), hit.getDirection()); - } - } - } - } - } - } - if (hoverPosFace != null) { - var state = getDummyWorld().getBlockState(hoverPosFace.pos); - hoverItem = state.getBlock().getCloneItemStack(getDummyWorld(), hoverPosFace.pos, state); - } - BlockPosFace tmp = dragging ? clickPosFace : hoverPosFace; - if (selectedPosFace != null || tmp != null) { - if (selectedPosFace != null && renderFacing) { - drawFacingBorder(poseStack, selectedPosFace, 0xff00ff00); - } - if (tmp != null && !tmp.equals(selectedPosFace) && renderFacing) { - drawFacingBorder(poseStack, tmp, 0xffffffff); - } - } - if (selectedPosFace != null && renderSelect) { - RenderUtils.renderBlockOverLay(poseStack, selectedPosFace.pos, 0.6f, 0, 0, 1.03f); - } - - if (this.afterWorldRender != null) { - this.afterWorldRender.accept(this); - } - } - } - .setOnSelected(this::onPosSelected) - .setRenderFacing(false) - .setRenderFacing(false)); - - scrollableWidgetGroup = new DraggableScrollableWidgetGroup(3, 132, 154, 22) + scrollableWidgetGroup = new DraggableScrollableWidgetGroup(3, 136 + getSizeOffset(), 154 + getSizeOffset(), 22) .setXScrollBarHeight(4) .setXBarStyle(GuiTextures.SLIDER_BACKGROUND, GuiTextures.BUTTON) .setScrollable(true) @@ -163,7 +112,7 @@ public void renderBlockOverLay(WorldSceneRenderer renderer) { } } - addWidget(new ImageWidget(3, 3, 160, 10, + addWidget(new ImageWidget(3, 3, 160 + getSizeOffset(), 10, new TextTexture(controllerDefinition.getDescriptionId(), -1) .setType(TextTexture.TextType.ROLL) .setWidth(170) @@ -178,21 +127,383 @@ public void renderBlockOverLay(WorldSceneRenderer renderer) { .toArray(MBPattern[]::new); }); - addWidget(new ButtonWidget(138, 30, 18, 18, new GuiTextureGroup( + addWidget(new ButtonWidget(138 + getSizeOffset(), 30, 18, 18, new GuiTextureGroup( ColorPattern.T_GRAY.rectTexture(), new TextTexture("1").setSupplier(() -> "P:" + index)), (x) -> setPage((index + 1 >= patterns.length) ? 0 : index + 1)) - .setHoverBorderTexture(1, -1)); + .setHoverBorderTexture(1, -1) + .appendHoverTooltips(Component.translatable("gtceu.gui.switchlevel"))); - addWidget(new ButtonWidget(138, 50, 18, 18, new GuiTextureGroup( + addWidget(new ButtonWidget(138 + getSizeOffset(), 50, 18, 18, new GuiTextureGroup( ColorPattern.T_GRAY.rectTexture(), new TextTexture("1").setSupplier(() -> layer >= 0 ? "L:" + layer : "ALL")), cd -> updateLayer()) - .setHoverBorderTexture(1, -1)); - + .setHoverBorderTexture(1, -1) + .appendHoverTooltips(Component.translatable("gtceu.gui.showlayer"))); + addWidget(new ButtonWidget(138 + getSizeOffset(), 70, 18, 18, new GuiTextureGroup( + ColorPattern.T_GRAY.rectTexture(), + new TextTexture("1").setSupplier(() -> isHighLight ? "ON" : "OFF")), + cd -> updateHighLight()) + .setHoverBorderTexture(1, -1) + .appendHoverTooltips(Component.translatable("gtceu.gui.highlight"))); setPage(0); } + static int sizeOffset = -1; + + public static int getSizeOffset() { + if (sizeOffset == -1) { + if (ConfigHolder.INSTANCE != null && + ConfigHolder.INSTANCE.client.widgetScale == ConfigHolder.ClientConfigs.WidgetScale.LARGE) { + sizeOffset = 40; + } else { + sizeOffset = 0; + } + } + return sizeOffset; + } + + private final class PreviewSceneWidget extends SceneWidget { + + private static final float LINE_HALF_WIDTH = 0.1f; + + @Override + @OnlyIn(Dist.CLIENT) + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + if (!this.intractable) { + return super.mouseDragged(mouseX, mouseY, button, dragX, dragY); + } else if (this.dragging && button == 0) { + this.rotationPitch = (float) ((double) this.rotationPitch + dragX + 360.0); + this.rotationPitch %= 360.0F; + this.rotationYaw = (float) Mth.clamp((double) this.rotationYaw + dragY, -89.9, 89.9); + if (this.renderer != null) { + this.renderer.setCameraLookAt(this.center, (double) this.camZoom(), + Math.toRadians((double) this.rotationPitch), Math.toRadians((double) this.rotationYaw)); + } + return false; + } else if (this.dragging && button == 1) {// 右键情况下 + if (this.renderer == null) return false; + + Vector3f eyePos = new Vector3f(this.renderer.getEyePos()); + Vector3f lookAt = new Vector3f(this.renderer.getLookAt()); + Vector3f worldUp = new Vector3f(this.renderer.getWorldUp()); + + float speed = 1.0f; + + // 建议与 zoom 绑定(体验提升非常明显) + speed *= (float) this.camZoom(); + + // forward = lookAt - eyePos + Vector3f forward = new Vector3f(lookAt).sub(eyePos).normalize(); + + // right = forward × worldUp + Vector3f right = new Vector3f(forward).cross(worldUp).normalize(); + + // camera up = right × forward + Vector3f up = new Vector3f(right).cross(forward).normalize(); + + // 移动向量 + Vector3f move = new Vector3f(); + + move.add(new Vector3f(right).mul((float) (-dragX / getSizeWidth() * speed))); + move.add(new Vector3f(up).mul((float) (dragY / getSizeHeight() * speed))); + + eyePos.add(move); + lookAt.add(move); + + this.center.add(move); + + this.renderer.setCameraLookAt(eyePos, lookAt, worldUp); + + return false; + + } else { + return super.mouseDragged(mouseX, mouseY, button, dragX, dragY); + } + } + + private final Map colorCaches = new HashMap<>(); + + private VertexBuffer highlightVbo; + private boolean highlightDirty = true; + private int vertexCount; + + @Override + @OnlyIn(Dist.CLIENT) + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (super.mouseClicked(mouseX, mouseY, button)) { + return true; + } else if (!this.intractable) { + return false; + } else if (this.isMouseOverElement(mouseX, mouseY)) { + if (this.draggable) { + this.dragging = true; + } + this.clickPosFace = this.hoverPosFace; + return true; + } else { + this.dragging = false; + return false; + } + } + + public PreviewSceneWidget(int x, int y, int w, int h, TrackedDummyWorld world) { + super(x, y, w, h, world); + } + + public void markHighlightDirty() { + highlightDirty = true; + colorCaches.clear(); + } + + private void rebuildHighlightBuffer() { + highlightDirty = false; + + if (highlightVbo != null) { + highlightVbo.close(); + highlightVbo = null; + } + + if (!isHighLight || core.isEmpty()) return; + + Map predicateMap = patterns[index].controllerBase + .getMultiblockState() + .getMatchContext() + .get("predicates"); + + if (predicateMap == null) return; + + BufferBuilder builder = Tesselator.getInstance().getBuilder(); + + builder.begin(VertexFormat.Mode.QUADS, + DefaultVertexFormat.POSITION_COLOR); + + vertexCount = 0; + + for (BlockPos pos : core) { + + if (selectedPosFace != null && pos.equals(selectedPosFace.pos)) + continue; + + TraceabilityPredicate p = predicateMap.get(pos); + if (p == null) continue; + // if (selectedPosFace != null && pos == selectedPosFace.pos) return; + int color = 0; + if (!colorCaches.containsKey(pos)) { + if (predicateMap.containsKey(pos)) { + var predicate = predicateMap.get(pos); + List candidates = new ArrayList(); + predicate.common.forEach(y -> candidates.addAll(y.getCandidates())); + predicate.limited.forEach(y -> candidates.addAll(y.getCandidates())); + int cnt = 0; + for (var candidate : candidates) { + if (cnt > 1) break; + if (candidate.equals(ITEM_IMPORT_BUS[GTValues.LV].asStack(), false) || + candidate.equals(FLUID_IMPORT_HATCH[GTValues.LV].asStack(), false) || + candidate.equals(STEAM_IMPORT_BUS.asStack(), false)) { + cnt++; + color = 0x00ff00ff;// 绿色 + continue; + } + if (candidate.equals(ITEM_EXPORT_BUS[GTValues.LV].asStack(), false) || + candidate.equals(FLUID_EXPORT_HATCH[GTValues.LV].asStack(), false) || + candidate.equals(STEAM_EXPORT_BUS.asStack(), false)) { + cnt++; + color = 0xff8000ff;// 橙色 + continue; + } + if (candidate.equals(ENERGY_INPUT_HATCH[GTValues.LV].asStack(), false) || + candidate.equals(ENERGY_OUTPUT_HATCH[GTValues.LV].asStack(), false) || + candidate.equals(LASER_INPUT_HATCH_256[GTValues.IV].asStack(), false) || + candidate.equals(LASER_OUTPUT_HATCH_256[GTValues.IV].asStack(), false) || + candidate.equals(STEAM_HATCH.asStack())) { + cnt++; + color = 0xffff00ff;// 黄色 + continue; + } + if (candidate.equals(MAINTENANCE_HATCH.asStack(), false)) { + cnt++; + color = 0x00ffffff;// 青色 + continue; + } + if (candidate.equals(MUFFLER_HATCH[GTValues.LV].asStack(), false)) { + cnt++; + color = 0x800080ff;// 紫色 + continue; + } + if (candidate.equals(PARALLEL_HATCH[GTValues.IV].asStack(), false)) { + cnt++; + color = 0xf0ffffff;// 蔚蓝色 + } + } + + if (cnt > 1) { + color = 0x3b2525ff; + } + colorCaches.put(pos, color); + } + } else { + color = colorCaches.get(pos); + } + appendCube(builder, pos, color); + + vertexCount += 24; + } + + BufferBuilder.RenderedBuffer rendered = builder.end(); + + highlightVbo = new VertexBuffer(VertexBuffer.Usage.STATIC); + highlightVbo.bind(); + highlightVbo.upload(rendered); + VertexBuffer.unbind(); + + // rendered.release(); + } + + private void appendCube(BufferBuilder b, BlockPos pos, int rgba) { + float r = ((rgba >> 24) & 255) / 255f; + float g = ((rgba >> 16) & 255) / 255f; + float bl = ((rgba >> 8) & 255) / 255f; + float a = (rgba & 255) / 255f * 0.6f; + + float x = pos.getX(); + float y = pos.getY(); + float z = pos.getZ(); + + float x2 = x + 1; + float y2 = y + 1; + float z2 = z + 1; + + // front + addQuad(b, x, y, z, x2, y, z, x2, y2, z, x, y2, z, r, g, bl, a); + + // back + addQuad(b, x2, y, z2, x, y, z2, x, y2, z2, x2, y2, z2, r, g, bl, a); + + // left + addQuad(b, x, y, z2, x, y, z, x, y2, z, x, y2, z2, r, g, bl, a); + + // right + addQuad(b, x2, y, z, x2, y, z2, x2, y2, z2, x2, y2, z, r, g, bl, a); + + // top + addQuad(b, x, y2, z, x2, y2, z, x2, y2, z2, x, y2, z2, r, g, bl, a); + + // bottom + addQuad(b, x, y, z2, x2, y, z2, x2, y, z, x, y, z, r, g, bl, a); + } + + private void addQuad(BufferBuilder b, + float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4, + float r, float g, float bl, float a) { + b.vertex(x1, y1, z1).color(r, g, bl, a).endVertex(); + b.vertex(x2, y2, z2).color(r, g, bl, a).endVertex(); + b.vertex(x3, y3, z3).color(r, g, bl, a).endVertex(); + b.vertex(x4, y4, z4).color(r, g, bl, a).endVertex(); + } + + private void renderHighlight() { + if (!isHighLight) return; + + if (highlightDirty) { + rebuildHighlightBuffer(); + } + + if (highlightVbo == null) return; + + RenderSystem.enableBlend(); + RenderSystem.defaultBlendFunc(); + + RenderSystem.enableDepthTest(); + RenderSystem.depthFunc(GL11.GL_LEQUAL); + + RenderSystem.depthMask(false); + GL11.glDepthRange(0.0, 0.01); + + RenderSystem.setShader(GameRenderer::getPositionColorShader); + + highlightVbo.bind(); + + highlightVbo.drawWithShader( + RenderSystem.getModelViewMatrix(), + RenderSystem.getProjectionMatrix(), + RenderSystem.getShader()); + + VertexBuffer.unbind(); + + GL11.glDepthRange(0.0, 1.0); + RenderSystem.depthMask(true); + + RenderSystem.disableBlend(); + } + + @Override + public void renderBlockOverLay(WorldSceneRenderer renderer) { + PoseStack poseStack = new PoseStack(); + hoverPosFace = null; + hoverItem = null; + renderHighlight(); + if (isMouseOverElement(currentMouseX, currentMouseY)) { + BlockHitResult hit = renderer.getLastTraceResult(); + if (hit != null) { + if (core.contains(hit.getBlockPos())) { + hoverPosFace = new BlockPosFace(hit.getBlockPos(), hit.getDirection()); + } else if (!useOrtho) { + Vector3f hitPos = hit.getLocation().toVector3f(); + Level world = renderer.world; + Vec3 eyePos = new Vec3(renderer.getEyePos()); + hitPos.mul(2); // Double view range to ensure pos can be seen. + Vec3 endPos = new Vec3((hitPos.x - eyePos.x), (hitPos.y - eyePos.y), (hitPos.z - eyePos.z)); + double min = Float.MAX_VALUE; + for (BlockPos pos : core) { + BlockState blockState = world.getBlockState(pos); + if (blockState.getBlock() == Blocks.AIR) { + continue; + } + hit = world.clipWithInteractionOverride(eyePos, endPos, pos, + blockState.getShape(world, pos), blockState); + if (hit != null && hit.getType() != HitResult.Type.MISS) { + double dist = eyePos.distanceToSqr(hit.getLocation()); + if (dist < min) { + min = dist; + hoverPosFace = new BlockPosFace(hit.getBlockPos(), hit.getDirection()); + } + } + } + } + } + } + if (hoverPosFace != null) { + var state = getDummyWorld().getBlockState(hoverPosFace.pos); + hoverItem = state.getBlock().getCloneItemStack(getDummyWorld(), hoverPosFace.pos, state); + } + BlockPosFace tmp = dragging ? clickPosFace : hoverPosFace; + if (selectedPosFace != null || tmp != null) { + if (selectedPosFace != null && renderFacing) { + drawFacingBorder(poseStack, selectedPosFace, 0xff00ff00); + } + if (tmp != null && !tmp.equals(selectedPosFace) && renderFacing) { + drawFacingBorder(poseStack, tmp, 0xffffffff); + } + } + if (selectedPosFace != null && renderSelect) { + RenderUtils.renderBlockOverLay(poseStack, selectedPosFace.pos, 0.6f, 0, 0, 1.03f); + } + + if (this.afterWorldRender != null) { + this.afterWorldRender.accept(this); + } + } + } + + private void updateHighLight() { + isHighLight = !isHighLight; + sceneWidget.markHighlightDirty(); + } + private void updateLayer() { MBPattern pattern = patterns[index]; if (layer + 1 >= -1 && layer + 1 <= pattern.maxY - pattern.minY) { @@ -207,6 +518,7 @@ private void updateLayer() { } } setupScene(pattern); + sceneWidget.markHighlightDirty(); } private void setupScene(MBPattern pattern) { @@ -240,12 +552,13 @@ public void setPage(int index) { this.layer = -1; MBPattern pattern = patterns[index]; setupScene(pattern); + sceneWidget.markHighlightDirty(); if (slotWidgets != null) { for (SlotWidget slotWidget : slotWidgets) { scrollableWidgetGroup.removeWidget(slotWidget); } } - slotWidgets = new SlotWidget[Math.min(pattern.parts.size(), 18)]; + slotWidgets = new SlotWidget[pattern.parts.size()]; CycleItemEntryHandler itemHandler = CycleItemEntryHandler.fromStacks(pattern.parts); int xOffset = 0; for (int i = 0; i < slotWidgets.length; i++) { @@ -276,9 +589,11 @@ private void onFormedSwitch(boolean isFormed) { sceneWidget.setRenderedCore(pattern.blockMap.keySet(), null); controllerBase.onStructureInvalid(); } + sceneWidget.markHighlightDirty(); } private void onPosSelected(BlockPos pos, Direction facing) { + // sceneWidget.markHighlightDirty(); if (index >= patterns.length || index < 0) return; TraceabilityPredicate predicate = patterns[index].predicateMap.get(pos); if (predicate != null) { @@ -305,7 +620,8 @@ private void onPosSelected(BlockPos pos, Direction facing) { int maxCol = (160 - (((slotWidgets.length - 1) / 9 + 1) * 18) - 35) % 18; for (int i = 0; i < candidateStacks.size(); i++) { int finalI = i; - candidates[i] = new SlotWidget(itemHandler, i, 3 + (i / maxCol) * 18, 3 + (i % maxCol) * 18, false, + candidates[i] = new CandidateSlotWidget(itemHandler, i, 3 + (i / maxCol) * 18, 3 + (i % maxCol) * 18, + false, false) .setIngredientIO(IngredientIO.INPUT) .setBackgroundTexture(new ColorRectTexture(0x4fffffff)) diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java index ef7f6b23990..0a4ca7cee13 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java @@ -252,7 +252,7 @@ private List getXEIIngredients(CycleItemEntryHandler handler, int index) return Collections.emptyList(); } - private List getXEIIngredientsClickable(CycleItemEntryHandler handler, int index) { + List getXEIIngredientsClickable(CycleItemEntryHandler handler, int index) { ItemEntryList entryList = handler.getEntry(index); if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredientsClickable(entryList, getPosition(), getSize(), this::getRealStack); @@ -269,7 +269,7 @@ public class WidgetSlotItemHandler extends Slot { private static final Container emptyInventory = new SimpleContainer(0); @Getter private final IItemHandlerModifiable itemHandler; - private final int index; + final int index; public WidgetSlotItemHandler(IItemHandlerModifiable itemHandler, int index, int xPosition, int yPosition) { super(emptyInventory, index, xPosition, yPosition); diff --git a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java index 34384172da0..ebb6104c92e 100644 --- a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java @@ -747,6 +747,15 @@ public static class GameplayConfigs { public static class ClientConfigs { + public enum WidgetScale { + MEIDUM, + LARGE + } + + @Configurable + @Configurable.Comment({ "Multiblock Structure Display Size" }) + public WidgetScale widgetScale = WidgetScale.LARGE; + @Configurable @Configurable.Comment({ "Whether or not to display all temperatures in Celsius instead of Kelvin" }) public boolean temperaturesInCelsius = false; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java index fe705dea7f4..7910107e413 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java @@ -7,6 +7,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.stack.EmiStack; @@ -30,10 +31,10 @@ public MultiblockInfoEmiRecipe(MultiblockMachineDefinition definition) { public void addWidgets(WidgetHolder widgets) { super.addWidgets(widgets); // numbers gotten from the size of the widget - slotWidget = new SlotWidget(EmiStack.of(definition.getItem().asItem()), 138, 12) + slotWidget = new SlotWidget(EmiStack.of(definition.getItem().asItem()), + 138 + PatternPreviewWidget.getSizeOffset(), 12) .recipeContext(this) .drawBack(false); - widgets.add(slotWidget); } @@ -49,6 +50,7 @@ public EmiRecipeCategory getCategory() { @Override public List getOutputs() { - return List.of(EmiStack.of(definition.getItem())); + ItemStack stack = new ItemStack(definition.getItem()); + return List.of(EmiStack.of(stack.setHoverName(stack.getHoverName().copy().append("1")))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java index e1a6c87e270..c35617b9413 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java @@ -82,7 +82,7 @@ private static List intoGenericStack(EmiIngredient ingredient) { private static GenericStack fromEmiStack(EmiStack stack, long amount) { if (stack.getKey() instanceof Item item) { - return new GenericStack(AEItemKey.of(item.getDefaultInstance()), amount); + return new GenericStack(AEItemKey.of(stack.getItemStack()), amount); } else if (stack.getKey() instanceof Fluid fluid) { return new GenericStack(AEFluidKey.of(fluid), amount); } diff --git a/src/main/resources/assets/gtceu/lang/zh_cn.json b/src/main/resources/assets/gtceu/lang/zh_cn.json index 337c09ab64e..69894c0cb80 100644 --- a/src/main/resources/assets/gtceu/lang/zh_cn.json +++ b/src/main/resources/assets/gtceu/lang/zh_cn.json @@ -5920,5 +5920,9 @@ "tile.gtceu.petrified_foam.name": "石化建筑泡沫", "tile.gtceu.reinforced_foam.name": "强化建筑泡沫", "tile.gtceu.reinforced_stone.name": "防爆石", - "tile.gtceu.seal.name": "密封方块" + "tile.gtceu.seal.name": "密封方块", + "config.gtceu.option.widgetScale": "多方块预览界面尺寸", + "gtceu.gui.highlight": "高亮仓室", + "gtceu.gui.showlayer": "逐层显示", + "gtceu.gui.switchlevel": "切换等级" } From 8104a2b5085fa78e4ba53324de8eb38cf22e5443 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Sat, 21 Mar 2026 00:59:25 +0800 Subject: [PATCH 62/78] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E7=BB=88=E7=AB=AF=E6=97=A0=E6=B3=95=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=B5=81=E4=BD=93=E6=BA=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pattern/predicates/SimplePredicate.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java index 552d450fed2..c35740786e5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java @@ -15,8 +15,11 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Fluids; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -172,12 +175,32 @@ public boolean testLayer(MultiblockState blockWorldState) { public List getCandidates() { if (GTCEu.isClientSide()) { return candidates == null ? Collections.emptyList() : - Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR) - .map(blockInfo -> blockInfo.getItemStackForm(Minecraft.getInstance().level, BlockPos.ZERO)) + Arrays.stream(this.candidates.get()) + .filter(info -> info.getBlockState().getBlock() != Blocks.AIR) + .map(blockInfo -> { + ItemStack form = blockInfo.getItemStackForm(Minecraft.getInstance().level, + BlockPos.ZERO); + if (form.isEmpty() || form.is(Items.AIR)) { + Fluid fluid = blockInfo.getBlockState().getFluidState().getType(); + if (fluid != Fluids.EMPTY) return new ItemStack(fluid.getBucket()); + } + return form; + }) + .filter(stack -> !stack.isEmpty() && !stack.is(Items.AIR)) .collect(Collectors.toList()); } return candidates == null ? Collections.emptyList() : - Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR) - .map(BlockInfo::getItemStackForm).collect(Collectors.toList()); + Arrays.stream(this.candidates.get()) + .filter(info -> info.getBlockState().getBlock() != Blocks.AIR) + .map(blockInfo -> { + ItemStack form = blockInfo.getItemStackForm(); + if (form.isEmpty() || form.is(Items.AIR)) { + Fluid fluid = blockInfo.getBlockState().getFluidState().getType(); + if (fluid != Fluids.EMPTY) return new ItemStack(fluid.getBucket()); + } + return form; + }) + .filter(stack -> !stack.isEmpty() && !stack.is(Items.AIR)) + .collect(Collectors.toList()); } } From b3015c0b3cb6fae53d60e1c2d17feb6f24a4f099 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Wed, 4 Mar 2026 00:01:07 +0800 Subject: [PATCH 63/78] =?UTF-8?q?feat:=20=E5=8F=96=E6=B6=88=E4=B8=8B?= =?UTF-8?q?=E5=B1=8A=E5=92=8C=E6=9C=AB=E5=9C=B0=E7=9F=BF=E7=9F=B3=E7=9A=84?= =?UTF-8?q?=E5=8F=8C=E5=80=8D=E4=BA=A7=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java | 6 +++--- 1 file changed, 3 insertions(+), 3 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 a518f4a4493..63c1613713d 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 @@ -1085,13 +1085,13 @@ public TagPrefix registerOre(Supplier stoneType, Supplier public TagPrefix registerOre(Supplier stoneType, Supplier material, BlockBehaviour.Properties properties, ResourceLocation baseModelLocation, boolean doubleDrops) { - return registerOre(stoneType, material, properties, baseModelLocation, doubleDrops, false, false); + return registerOre(stoneType, material, properties, baseModelLocation, false, false, false); } public TagPrefix registerOre(Supplier stoneType, Supplier material, BlockBehaviour.Properties properties, ResourceLocation baseModelLocation, boolean doubleDrops, boolean isSand, boolean shouldDropAsItem) { - return registerOre(stoneType, material, () -> properties, baseModelLocation, doubleDrops, isSand, + return registerOre(stoneType, material, () -> properties, baseModelLocation, false, isSand, shouldDropAsItem); } @@ -1099,7 +1099,7 @@ public TagPrefix registerOre(Supplier stoneType, Supplier Supplier properties, ResourceLocation baseModelLocation, boolean doubleDrops, boolean isSand, boolean shouldDropAsItem) { ORES.put(this, - new OreType(stoneType, material, properties, baseModelLocation, doubleDrops, isSand, shouldDropAsItem)); + new OreType(stoneType, material, properties, baseModelLocation, false, isSand, shouldDropAsItem)); if (shouldDropAsItem) { GTOreByProduct.addOreByProductPrefix(this); } From 0ce660006968d6e341bb215daa98a8319741c62f Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Thu, 26 Mar 2026 02:49:24 +0800 Subject: [PATCH 64/78] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E6=96=B9=E5=9D=97=E9=A2=84=E8=A7=88=E9=AB=98=E4=BA=AE=E4=BB=93?= =?UTF-8?q?=E5=AE=A4=E6=B3=A8=E5=86=8C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gregtechceu/gtceu/api/addon/IGTAddon.java | 6 ++ .../api/gui/widget/PatternPreviewWidget.java | 51 +---------- .../MultiblockPreviewHighlightRegistry.java | 89 +++++++++++++++++++ .../gregtechceu/gtceu/common/CommonProxy.java | 4 + 4 files changed, 101 insertions(+), 49 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockPreviewHighlightRegistry.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java b/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java index 7aa4eb45714..28d47cb005e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.addon.events.KJSRecipeKeyEvent; import com.gregtechceu.gtceu.api.addon.events.MaterialCasingCollectionEvent; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; +import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockPreviewHighlightRegistry; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.common.data.GTOres; @@ -61,6 +62,11 @@ default void registerSounds() {} */ default void registerCovers() {} + /** + * Register extra multiblock structure preview highlight rules here. + */ + default void registerMultiblockPreviewHighlighters(MultiblockPreviewHighlightRegistry registry) {} + /** * Call init on your custom Recipe Capabilities here */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java index f0cd12a694b..42d48b44bec 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.gui.widget; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; +import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockPreviewHighlightRegistry; import com.gregtechceu.gtceu.api.pattern.BlockPattern; import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; @@ -61,9 +61,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.gregtechceu.gtceu.common.data.GTMachines.*; -import static com.gregtechceu.gtceu.common.data.machines.GCYMMachines.PARALLEL_HATCH; - @OnlyIn(Dist.CLIENT) public class PatternPreviewWidget extends WidgetGroup { @@ -295,51 +292,7 @@ private void rebuildHighlightBuffer() { List candidates = new ArrayList(); predicate.common.forEach(y -> candidates.addAll(y.getCandidates())); predicate.limited.forEach(y -> candidates.addAll(y.getCandidates())); - int cnt = 0; - for (var candidate : candidates) { - if (cnt > 1) break; - if (candidate.equals(ITEM_IMPORT_BUS[GTValues.LV].asStack(), false) || - candidate.equals(FLUID_IMPORT_HATCH[GTValues.LV].asStack(), false) || - candidate.equals(STEAM_IMPORT_BUS.asStack(), false)) { - cnt++; - color = 0x00ff00ff;// 绿色 - continue; - } - if (candidate.equals(ITEM_EXPORT_BUS[GTValues.LV].asStack(), false) || - candidate.equals(FLUID_EXPORT_HATCH[GTValues.LV].asStack(), false) || - candidate.equals(STEAM_EXPORT_BUS.asStack(), false)) { - cnt++; - color = 0xff8000ff;// 橙色 - continue; - } - if (candidate.equals(ENERGY_INPUT_HATCH[GTValues.LV].asStack(), false) || - candidate.equals(ENERGY_OUTPUT_HATCH[GTValues.LV].asStack(), false) || - candidate.equals(LASER_INPUT_HATCH_256[GTValues.IV].asStack(), false) || - candidate.equals(LASER_OUTPUT_HATCH_256[GTValues.IV].asStack(), false) || - candidate.equals(STEAM_HATCH.asStack())) { - cnt++; - color = 0xffff00ff;// 黄色 - continue; - } - if (candidate.equals(MAINTENANCE_HATCH.asStack(), false)) { - cnt++; - color = 0x00ffffff;// 青色 - continue; - } - if (candidate.equals(MUFFLER_HATCH[GTValues.LV].asStack(), false)) { - cnt++; - color = 0x800080ff;// 紫色 - continue; - } - if (candidate.equals(PARALLEL_HATCH[GTValues.IV].asStack(), false)) { - cnt++; - color = 0xf0ffffff;// 蔚蓝色 - } - } - - if (cnt > 1) { - color = 0x3b2525ff; - } + color = MultiblockPreviewHighlightRegistry.resolveColor(candidates); colorCaches.put(pos, color); } } else { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockPreviewHighlightRegistry.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockPreviewHighlightRegistry.java new file mode 100644 index 00000000000..b462a48e07f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockPreviewHighlightRegistry.java @@ -0,0 +1,89 @@ +package com.gregtechceu.gtceu.api.machine.multiblock; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; + +import java.util.*; +import java.util.function.Predicate; + +public final class MultiblockPreviewHighlightRegistry { + + public static final MultiblockPreviewHighlightRegistry INSTANCE = new MultiblockPreviewHighlightRegistry(); + + public static final int INPUT_COLOR = 0x00ff00ff; + public static final int OUTPUT_COLOR = 0xff8000ff; + public static final int POWER_COLOR = 0xffff00ff; + public static final int MAINTENANCE_COLOR = 0x00ffffff; + public static final int MUFFLER_COLOR = 0x800080ff; + public static final int PARALLEL_COLOR = 0xf0ffffff; + public static final int MIXED_COLOR = 0x3b2525ff; + + private static final List RULES = new ArrayList<>(); + + static { + registerAbilityHighlight(INPUT_COLOR, + PartAbility.IMPORT_ITEMS, + PartAbility.IMPORT_FLUIDS, + PartAbility.IMPORT_FLUIDS_1X, + PartAbility.IMPORT_FLUIDS_4X, + PartAbility.IMPORT_FLUIDS_9X, + PartAbility.STEAM_IMPORT_ITEMS); + registerAbilityHighlight(OUTPUT_COLOR, + PartAbility.EXPORT_ITEMS, + PartAbility.EXPORT_FLUIDS, + PartAbility.EXPORT_FLUIDS_1X, + PartAbility.EXPORT_FLUIDS_4X, + PartAbility.EXPORT_FLUIDS_9X, + PartAbility.STEAM_EXPORT_ITEMS); + registerAbilityHighlight(POWER_COLOR, + PartAbility.INPUT_ENERGY, + PartAbility.OUTPUT_ENERGY, + PartAbility.SUBSTATION_INPUT_ENERGY, + PartAbility.SUBSTATION_OUTPUT_ENERGY, + PartAbility.INPUT_LASER, + PartAbility.OUTPUT_LASER, + PartAbility.STEAM); + registerAbilityHighlight(MAINTENANCE_COLOR, PartAbility.MAINTENANCE); + registerAbilityHighlight(MUFFLER_COLOR, PartAbility.MUFFLER); + registerAbilityHighlight(PARALLEL_COLOR, PartAbility.PARALLEL_HATCH); + } + + private MultiblockPreviewHighlightRegistry() {} + + public static void registerAbilityHighlight(int color, PartAbility... abilities) { + List filteredAbilities = Arrays.stream(abilities) + .filter(Objects::nonNull) + .toList(); + if (filteredAbilities.isEmpty()) return; + registerHighlight(color, block -> filteredAbilities.stream().anyMatch(ability -> ability.isApplicable(block))); + } + + public static void registerHighlight(int color, Predicate matcher) { + RULES.add(new HighlightRule(color, matcher)); + } + + public static int resolveColor(Collection candidates) { + Set matchedColors = new LinkedHashSet<>(); + for (ItemStack candidate : candidates) { + Block block = Block.byItem(candidate.getItem()); + if (block == Blocks.AIR) continue; + for (HighlightRule rule : RULES) { + if (rule.matches(block)) { + matchedColors.add(rule.color()); + if (matchedColors.size() > 1) { + return MIXED_COLOR; + } + } + } + } + return matchedColors.isEmpty() ? 0 : matchedColors.iterator().next(); + } + + private record HighlightRule(int color, Predicate matcher) { + + private boolean matches(Block block) { + return matcher.test(block); + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java index 2da4e90b735..bfe7c258a84 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java @@ -19,6 +19,7 @@ import com.gregtechceu.gtceu.api.gui.factory.CoverUIFactory; import com.gregtechceu.gtceu.api.gui.factory.GTUIEditorFactory; import com.gregtechceu.gtceu.api.gui.factory.MachineUIFactory; +import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockPreviewHighlightRegistry; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.ingredient.*; import com.gregtechceu.gtceu.api.recipe.lookup.ingredient.*; @@ -160,6 +161,9 @@ public static void init() { ChanceLogic.init(); WaypointManager.init(); AddonFinder.getAddons().forEach(IGTAddon::initializeAddon); + AddonFinder.getAddons() + .forEach(addon -> addon + .registerMultiblockPreviewHighlighters(MultiblockPreviewHighlightRegistry.INSTANCE)); GTRegistration.REGISTRATE.registerRegistrate(); From 0bfba41801f5b723d6f170c64ef8f7ee6e2de4df Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Tue, 14 Apr 2026 10:47:08 +0800 Subject: [PATCH 65/78] Revert "add simple cooking recipe builder (#4643)" This reverts commit 0a764a448943045640263bb164c9b4d65fe5df52. --- docs/content/Modpacks/Changes/v8.0.0.md | 146 ---------------- .../data/recipe/VanillaRecipeHelper.java | 20 +-- .../recipe/builder/BlastingRecipeBuilder.java | 145 ++++++++++++++++ .../recipe/builder/CampfireRecipeBuilder.java | 145 ++++++++++++++++ .../builder/SimpleCookingRecipeBuilder.java | 161 ------------------ .../recipe/builder/SmeltingRecipeBuilder.java | 145 ++++++++++++++++ .../recipe/builder/SmokingRecipeBuilder.java | 145 ++++++++++++++++ .../data/recipe/builder/package-info.java | 4 - 8 files changed, 589 insertions(+), 322 deletions(-) delete mode 100644 docs/content/Modpacks/Changes/v8.0.0.md create mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java create mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java delete mode 100644 src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java diff --git a/docs/content/Modpacks/Changes/v8.0.0.md b/docs/content/Modpacks/Changes/v8.0.0.md deleted file mode 100644 index 9e9aae3f31a..00000000000 --- a/docs/content/Modpacks/Changes/v8.0.0.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: "Version 8.0.0" ---- - - -# Updating from `7.4.0` to `8.0.0` - -## New Data Save/Sync System - -A new system for saving and syncing object fields has been added. See [this page](../../Development/Data-Sync-System/Migrating-From-LDLib-SyncData.md) for migration instructions. - -## Machine Refactor - -Many aspects of the machine classes have been refactored and changed in order to streamline the machine system and remove legacy and unnecessary abstraction. - -### `MetaMachine` and `MetaMachineBlockEntity` merge - -- The `MetaMachineBlockEntity`(MMBE) class has been removed, and `MetaMachine`(MM) is now a BlockEntity. -- Most methods and properties of MMBE have been moved onto MM. -- The `IMachineBlockEntity` interface has been removed. Use `MetaMachineBlock` directly instead. -- Many methods common to all block entities have been moved to the `IGregtechBlockEntity` interface. -- Machine instance creation functions have signature `(BlockEntityCreationInfo) -> MetaMachine` instead of `(IMachineBlockEntity) -> MetaMachine` - -References to MMBE can generally be replaced with references to MM: -```java -/////// OLD -if (level.getBlockEntity(getPos()) instanceof MetaMachineBlockEntity mmbe) { - MetaMachine machine = mmbe.getMetaMachine(); - ... -} - -////// NEW -if (level.getBlockEntity(getPos()) instanceof MetaMachine machine) { - ... -} -``` - -The `IMachineBlockEntity holder` argument in machine constructors has been replaced with `BlockEntityCreationInfo info`: -```java -////// OLD -public MetaMachine(IMachineBlockEntity holder); -////// NEW -public MetaMachine(BlockEntityCreationInfo info); -``` -A number of methods have been renamed across a number of different interfaces and classes to ensure consistency with default BlockEntity methods: - -- `BlockPos getPipePos()` -> `BlockPos getBlockPos()` -- `Level getPipeLevel()` -> `Level getLevel()` -- `BlockPos getPos()` -> `BlockPos getBlockPos()` -- `BlockState getState()` -> `BlockState getBlockState()` -- `boolean isInvalid()` -> `boolean isRemoved()` -- `void markAsDirty()` -> `void markAsChanged()` - -### Machine constructor and trait initialisation changes - -The constructors for a large number of machines have changed in order to simply machine instance creation. Additionally, methods for trait creation have also been removed and now form part of the machine constructor. - -#### **All Machines** -- Replace the first constructor argument `IMachineBlockEntity holder` with `BlockEntityCreationInfo info` -#### `TieredEnergyMachine` -- Removed `createEnergyContainer` method -- Constructor now has an optional `Supplier` argument -#### `WorkableTieredMachine` -- Removed `createRecipeLogic`, `createImportItemHandler`, `createExportItemHandler`, `createImportFluidHandler`, `createExportFluidHandler` methods -- Added a new constructor: - - `BlockEntityCreationInfo info` - - `int tier` - - `Supplier recipeLogicSupplier` Recipe logic supplier, defaults to the standard `RecipeLogic` class. - - `int importSlots` Item import slots, defaults to the amount of slots in the machine's default recipe type. - - `int exportSlots` Same as above, but for item export slots. - - `int fluidImportSlots` As above, but for fluid import slots. - - `int fluidExportSlots` As above, but for fluid export slots. - - `Int2IntFunction tankScalingFunction` Fluid tank capacity scaling function. -#### `WorkableMultiblockMachine`, `WorkableElectricMultiblockMachine` and `SteamWorkableMachine` -- Removed `createRecipeLogic` method -- Constructor now has an optional `Supplier` argument, defaults to the standard `RecipeLogic` class - -## Machine Trait Refactor - -A new system for attaching traits and custom behaviour to machines has been added, and many machine interfaces and traits now use this new system. - -### New System Example - -Example of the new `AutoOutputTrait` - -```java -public class CustomDrumMachine extends MetaMachine { - - protected final NotifiableFluidTank tank; - public final AutoOutputTrait autoOutput; - - public DrumMachine(BlockEntityCreationInfo info, int capacity) { - super(info); - - // Traits must be attached in the constructor. - - this.tank = new NotifiableFluidTank(this, 1, capacity, IO.BOTH); - - // Registers an auto output trait that provides fluid output behaviour for the given fluid tank. - this.autoOutput = AutoOutputTrait.ofFluids(this, tank); - - autoOutput.setFluidOutputDirection(Direction.DOWN); - autoOutput.setFluidOutputDirectionValidator(d -> d == Direction.DOWN); - } - - // Any code can query traits from a machine - public static void queryTraits(MetaMachine machine) { - - // Returns a trait with the given type, or null. - AutoOutputTrait autoOutputTrait = machine.getTraitHolder().getTrait(AutoOutputTrait.TYPE); - - Optional recipeLogicOptional = machine.getTraitHolder().getTrait(RecipeLogic.TYPE); - - // Gets all traits with the specified type. - List allItemStackHandlers = machine.getTraitHolder().getTraits(NotifiableItemStackHandler.TYPE); - - } -} -``` - -### Removed interfaces - -A large number of machine feature interfaces have been removed, and have had their functionality merged into the standard MetaMachine class, or now use the new machine trait system: - -- `ITurbineMachine` Use the `LargeTurbineMachine` class directly. -- `IRotorHolderMachine` Use the `RotorHolderMachine` class directly. -- `IMultiController` Use the `MultiblockControllerMachine` class directly. -- `IMufflerMachine` Use the `MufflerMachine` class directly. -- `IMachineLife` Override the `MetaMachine::onMachinePlaced` and `MetaMachine::onMachineDestroyed`. -- `IMachineModifyDrops` Override `MetaMachine::modifyDrops`. -- `IInteractedMachine` Override `MetaMachine::onUse` and `MetaMachine::onLeftClick`. -- `ICleanroomReceiver` & `ICleanroomProvider` - Use `CleanroomReceiverTrait` and `CleanroomProviderTrait`. -- `IAutoOutputBoth`, `IAutoOutputFluid`, `IAutoOutputItem` - Use `AutoOutputTrait`. -- `IExplosionMachine` - Use `EnvironmentalExplosionTrait`, `GTUtil::doExplosion`, and `GTUtil::setOnFire` -- `IEnvironmentalHazardCleaner` Use `EnvironmentalHazardCleanerTrait` -- `ILocalizedHazardEmitter` - Use `LocalizedHazardEmitterTrait` -- `IExhaustVentMachine` - Use `ExhaustVentMachineTrait` -- `IHPCAComponentHatch` - Use `HPCAComponentTrait` -- `IHPCAComputationProvider` - Use `HPCAComputationProviderTrait` -- `IHPCACoolantProvider` - Use `HPCACoolantProviderTrait` - - -## Other Changes - -- `BlastingRecipeBuilder`, `CampfireRecipeBuilder`, `SmeltingRecipeBuilder` and `SmokingRecipeBuilder` have been merged into `SimpleCookingRecipeBuilder` - - Example usage: `SimpleCookingRecipeBuilder.campfireCooking("cooking_chicken").input(new ItemStack(Items.CHICKEN)).output(new ItemStacks(Items.COOKED_CHICKEN)).cookingTime(100).experience(100).save(provider);` \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java index 2421207276a..e9d7013bf87 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java @@ -64,13 +64,13 @@ public static void addSmeltingRecipe(Consumer provider, @NotNull public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, Ingredient input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.smelting(regName).input(input).output(output).cookingTime(200).experience(experience) + new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) .save(provider); } public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.smelting(regName).input(input).output(output).cookingTime(200).experience(experience) + new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) .save(provider); } @@ -97,7 +97,7 @@ public static void addSmeltingRecipe(Consumer provider, @NotNull public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.smelting(regName).input(input).output(output).cookingTime(200).experience(experience) + new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) .save(provider); } @@ -133,13 +133,13 @@ public static void addBlastingRecipe(Consumer provider, @NotNull public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, Ingredient input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.blasting(regName).input(input).output(output).cookingTime(100).experience(experience) + new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.blasting(regName).input(input).output(output).cookingTime(100).experience(experience) + new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } @@ -171,13 +171,13 @@ public static void addSmokingRecipe(Consumer provider, @NotNull public static void addSmokingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.smoking(regName).input(input).output(output).cookingTime(100).experience(experience) + new SmokingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } public static void addSmokingRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.smoking(regName).input(input).output(output).cookingTime(100).experience(experience) + new SmokingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } @@ -199,8 +199,7 @@ public static void addCampfireRecipe(Consumer provider, @NotNull public static void addCampfireRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.campfireCooking(regName).input(input).output(output).cookingTime(100) - .experience(experience) + new CampfireRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } @@ -216,8 +215,7 @@ public static void addCampfireRecipe(Consumer provider, @NotNull public static void addCampfireRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - SimpleCookingRecipeBuilder.campfireCooking(regName).input(input).output(output).cookingTime(100) - .experience(experience) + new CampfireRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java new file mode 100644 index 00000000000..1b5718716f7 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java @@ -0,0 +1,145 @@ +package com.gregtechceu.gtceu.data.recipe.builder; + +import com.gregtechceu.gtceu.GTCEu; + +import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; + +@Accessors(chain = true, fluent = true) +public class BlastingRecipeBuilder { + + private Ingredient input; + @Setter + protected String group; + + private ItemStack output = ItemStack.EMPTY; + @Setter + private float experience; + @Setter + private int cookingTime; + @Setter + protected ResourceLocation id; + + public BlastingRecipeBuilder(@Nullable ResourceLocation id) { + this.id = id; + } + + public BlastingRecipeBuilder input(TagKey itemStack) { + return input(Ingredient.of(itemStack)); + } + + public BlastingRecipeBuilder input(ItemStack itemStack) { + input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); + return this; + } + + public BlastingRecipeBuilder input(ItemLike itemLike) { + return input(Ingredient.of(itemLike)); + } + + public BlastingRecipeBuilder input(Ingredient ingredient) { + input = ingredient; + return this; + } + + public BlastingRecipeBuilder output(ItemStack itemStack) { + this.output = itemStack.copy(); + return this; + } + + public BlastingRecipeBuilder output(ItemStack itemStack, int count) { + this.output = itemStack.copy(); + this.output.setCount(count); + return this; + } + + public BlastingRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { + this.output = itemStack.copy(); + this.output.setCount(count); + this.output.setTag(nbt); + return this; + } + + protected ResourceLocation defaultId() { + return BuiltInRegistries.ITEM.getKey(output.getItem()); + } + + public void toJson(JsonObject json) { + if (group != null) { + json.addProperty("group", group); + } + + if (!input.isEmpty()) { + json.add("ingredient", input.toJson()); + } + + if (output.isEmpty()) { + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); + throw new IllegalArgumentException(id + ": output items is empty"); + } else { + JsonObject result = new JsonObject(); + result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); + if (output.getCount() > 1) { + result.addProperty("count", output.getCount()); + } + if (output.hasTag() && output.getTag() != null) { + result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); + } + json.add("result", result); + } + + json.addProperty("experience", experience); + json.addProperty("cookingtime", cookingTime); + } + + public void save(Consumer consumer) { + consumer.accept(new FinishedRecipe() { + + @Override + public void serializeRecipeData(JsonObject pJson) { + toJson(pJson); + } + + @Override + public ResourceLocation getId() { + var ID = id == null ? defaultId() : id; + return new ResourceLocation(ID.getNamespace(), "blasting" + "/" + ID.getPath()); + } + + @Override + public RecipeSerializer getType() { + return RecipeSerializer.BLASTING_RECIPE; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return null; + } + }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java new file mode 100644 index 00000000000..b95064c1fad --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java @@ -0,0 +1,145 @@ +package com.gregtechceu.gtceu.data.recipe.builder; + +import com.gregtechceu.gtceu.GTCEu; + +import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; + +@Accessors(chain = true, fluent = true) +public class CampfireRecipeBuilder { + + private Ingredient input; + @Setter + protected String group; + + private ItemStack output = ItemStack.EMPTY; + @Setter + private float experience; + @Setter + private int cookingTime; + @Setter + protected ResourceLocation id; + + public CampfireRecipeBuilder(@Nullable ResourceLocation id) { + this.id = id; + } + + public CampfireRecipeBuilder input(TagKey itemStack) { + return input(Ingredient.of(itemStack)); + } + + public CampfireRecipeBuilder input(ItemStack itemStack) { + input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); + return this; + } + + public CampfireRecipeBuilder input(ItemLike itemLike) { + return input(Ingredient.of(itemLike)); + } + + public CampfireRecipeBuilder input(Ingredient ingredient) { + input = ingredient; + return this; + } + + public CampfireRecipeBuilder output(ItemStack itemStack) { + this.output = itemStack.copy(); + return this; + } + + public CampfireRecipeBuilder output(ItemStack itemStack, int count) { + this.output = itemStack.copy(); + this.output.setCount(count); + return this; + } + + public CampfireRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { + this.output = itemStack.copy(); + this.output.setCount(count); + this.output.setTag(nbt); + return this; + } + + protected ResourceLocation defaultId() { + return BuiltInRegistries.ITEM.getKey(output.getItem()); + } + + public void toJson(JsonObject json) { + if (group != null) { + json.addProperty("group", group); + } + + if (!input.isEmpty()) { + json.add("ingredient", input.toJson()); + } + + if (output.isEmpty()) { + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); + throw new IllegalArgumentException(id + ": output items is empty"); + } else { + JsonObject result = new JsonObject(); + result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); + if (output.getCount() > 1) { + result.addProperty("count", output.getCount()); + } + if (output.hasTag() && output.getTag() != null) { + result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); + } + json.add("result", result); + } + + json.addProperty("experience", experience); + json.addProperty("cookingtime", cookingTime); + } + + public void save(Consumer consumer) { + consumer.accept(new FinishedRecipe() { + + @Override + public void serializeRecipeData(JsonObject pJson) { + toJson(pJson); + } + + @Override + public ResourceLocation getId() { + var ID = id == null ? defaultId() : id; + return new ResourceLocation(ID.getNamespace(), "campfire" + "/" + ID.getPath()); + } + + @Override + public RecipeSerializer getType() { + return RecipeSerializer.CAMPFIRE_COOKING_RECIPE; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return null; + } + }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java deleted file mode 100644 index cd8d604e533..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SimpleCookingRecipeBuilder.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.gregtechceu.gtceu.data.recipe.builder; - -import com.gregtechceu.gtceu.GTCEu; - -import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.*; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.StrictNBTIngredient; - -import com.google.gson.JsonObject; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Consumer; - -@Accessors(chain = true, fluent = true) -@SuppressWarnings("deprecation") -public class SimpleCookingRecipeBuilder { - - protected final String folder; - protected final RecipeSerializer serializer; - protected @Nullable Ingredient input; - @Setter - protected @Nullable String group; - @Setter - protected CookingBookCategory category = CookingBookCategory.MISC; - - protected ItemStack output = ItemStack.EMPTY; - @Setter - protected float experience; - @Setter - protected int cookingTime; - @Setter - protected @Nullable ResourceLocation id; - - protected SimpleCookingRecipeBuilder(@Nullable ResourceLocation id, String folder, RecipeSerializer serializer) { - this.id = id; - this.folder = folder; - this.serializer = serializer; - } - - public static SimpleCookingRecipeBuilder campfireCooking(@Nullable ResourceLocation id) { - return new SimpleCookingRecipeBuilder<>(id, "campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING_RECIPE); - } - - public static SimpleCookingRecipeBuilder smelting(@Nullable ResourceLocation id) { - return new SimpleCookingRecipeBuilder<>(id, "smelting", RecipeSerializer.SMELTING_RECIPE); - } - - public static SimpleCookingRecipeBuilder blasting(@Nullable ResourceLocation id) { - return new SimpleCookingRecipeBuilder<>(id, "blasting", RecipeSerializer.BLASTING_RECIPE); - } - - public static SimpleCookingRecipeBuilder smoking(@Nullable ResourceLocation id) { - return new SimpleCookingRecipeBuilder<>(id, "smoking", RecipeSerializer.SMOKING_RECIPE); - } - - public SimpleCookingRecipeBuilder input(TagKey tag) { - return input(Ingredient.of(tag)); - } - - public SimpleCookingRecipeBuilder input(ItemStack itemStack) { - input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); - return this; - } - - public SimpleCookingRecipeBuilder input(ItemLike itemLike) { - return input(Ingredient.of(itemLike)); - } - - public SimpleCookingRecipeBuilder input(Ingredient ingredient) { - input = ingredient; - return this; - } - - public SimpleCookingRecipeBuilder output(ItemStack itemStack) { - this.output = itemStack.copy(); - return this; - } - - public SimpleCookingRecipeBuilder output(ItemStack itemStack, int count) { - this.output = itemStack.copyWithCount(count); - return this; - } - - protected ResourceLocation defaultId() { - return BuiltInRegistries.ITEM.getKey(output.getItem()); - } - - public void toJson(JsonObject json) { - if (group != null) { - json.addProperty("group", group); - } - - if (input == null || input.isEmpty()) { - GTCEu.LOGGER.error("{} recipe {} input is empty", folder, id); - throw new IllegalArgumentException(id + ": input item is empty"); - } - if (output.isEmpty()) { - GTCEu.LOGGER.error("{} recipe {} output is empty", folder, id); - throw new IllegalArgumentException(id + ": output item is empty"); - } - - json.add("ingredient", input.toJson()); - - JsonObject result = new JsonObject(); - result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); - if (output.getCount() > 1) { - result.addProperty("count", output.getCount()); - } - if (output.hasTag() && output.getTag() != null) { - result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); - } - json.add("result", result); - - json.addProperty("experience", experience); - json.addProperty("cookingtime", cookingTime); - } - - public void save(Consumer consumer) { - ResourceLocation recipeId = (id == null ? defaultId() : id).withPrefix(folder + "/"); - - consumer.accept(new FinishedRecipe() { - - @Override - public void serializeRecipeData(JsonObject pJson) { - toJson(pJson); - } - - @Override - public ResourceLocation getId() { - return recipeId; - } - - @Override - public RecipeSerializer getType() { - return serializer; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } - }); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java new file mode 100644 index 00000000000..696aee1a594 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java @@ -0,0 +1,145 @@ +package com.gregtechceu.gtceu.data.recipe.builder; + +import com.gregtechceu.gtceu.GTCEu; + +import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; + +@Accessors(chain = true, fluent = true) +public class SmeltingRecipeBuilder { + + private Ingredient input; + @Setter + protected String group; + + private ItemStack output = ItemStack.EMPTY; + @Setter + private float experience; + @Setter + private int cookingTime; + @Setter + protected ResourceLocation id; + + public SmeltingRecipeBuilder(@Nullable ResourceLocation id) { + this.id = id; + } + + public SmeltingRecipeBuilder input(TagKey itemStack) { + return input(Ingredient.of(itemStack)); + } + + public SmeltingRecipeBuilder input(ItemStack itemStack) { + input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); + return this; + } + + public SmeltingRecipeBuilder input(ItemLike itemLike) { + return input(Ingredient.of(itemLike)); + } + + public SmeltingRecipeBuilder input(Ingredient ingredient) { + input = ingredient; + return this; + } + + public SmeltingRecipeBuilder output(ItemStack itemStack) { + this.output = itemStack.copy(); + return this; + } + + public SmeltingRecipeBuilder output(ItemStack itemStack, int count) { + this.output = itemStack.copy(); + this.output.setCount(count); + return this; + } + + public SmeltingRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { + this.output = itemStack.copy(); + this.output.setCount(count); + this.output.setTag(nbt); + return this; + } + + protected ResourceLocation defaultId() { + return BuiltInRegistries.ITEM.getKey(output.getItem()); + } + + public void toJson(JsonObject json) { + if (group != null) { + json.addProperty("group", group); + } + + if (!input.isEmpty()) { + json.add("ingredient", input.toJson()); + } + + if (output.isEmpty()) { + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); + throw new IllegalArgumentException(id + ": output items is empty"); + } else { + JsonObject result = new JsonObject(); + result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); + if (output.getCount() > 1) { + result.addProperty("count", output.getCount()); + } + if (output.hasTag() && output.getTag() != null) { + result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); + } + json.add("result", result); + } + + json.addProperty("experience", experience); + json.addProperty("cookingtime", cookingTime); + } + + public void save(Consumer consumer) { + consumer.accept(new FinishedRecipe() { + + @Override + public void serializeRecipeData(JsonObject pJson) { + toJson(pJson); + } + + @Override + public ResourceLocation getId() { + var ID = id == null ? defaultId() : id; + return new ResourceLocation(ID.getNamespace(), "smelting" + "/" + ID.getPath()); + } + + @Override + public RecipeSerializer getType() { + return RecipeSerializer.SMELTING_RECIPE; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return null; + } + }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java new file mode 100644 index 00000000000..17ac75350a3 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java @@ -0,0 +1,145 @@ +package com.gregtechceu.gtceu.data.recipe.builder; + +import com.gregtechceu.gtceu.GTCEu; + +import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; + +@Accessors(chain = true, fluent = true) +public class SmokingRecipeBuilder { + + private Ingredient input; + @Setter + protected String group; + + private ItemStack output = ItemStack.EMPTY; + @Setter + private float experience; + @Setter + private int cookingTime; + @Setter + protected ResourceLocation id; + + public SmokingRecipeBuilder(@Nullable ResourceLocation id) { + this.id = id; + } + + public SmokingRecipeBuilder input(TagKey itemStack) { + return input(Ingredient.of(itemStack)); + } + + public SmokingRecipeBuilder input(ItemStack itemStack) { + input = itemStack.hasTag() ? StrictNBTIngredient.of(itemStack) : Ingredient.of(itemStack); + return this; + } + + public SmokingRecipeBuilder input(ItemLike itemLike) { + return input(Ingredient.of(itemLike)); + } + + public SmokingRecipeBuilder input(Ingredient ingredient) { + input = ingredient; + return this; + } + + public SmokingRecipeBuilder output(ItemStack itemStack) { + this.output = itemStack.copy(); + return this; + } + + public SmokingRecipeBuilder output(ItemStack itemStack, int count) { + this.output = itemStack.copy(); + this.output.setCount(count); + return this; + } + + public SmokingRecipeBuilder output(ItemStack itemStack, int count, CompoundTag nbt) { + this.output = itemStack.copy(); + this.output.setCount(count); + this.output.setTag(nbt); + return this; + } + + protected ResourceLocation defaultId() { + return BuiltInRegistries.ITEM.getKey(output.getItem()); + } + + public void toJson(JsonObject json) { + if (group != null) { + json.addProperty("group", group); + } + + if (!input.isEmpty()) { + json.add("ingredient", input.toJson()); + } + + if (output.isEmpty()) { + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); + throw new IllegalArgumentException(id + ": output items is empty"); + } else { + JsonObject result = new JsonObject(); + result.addProperty("item", BuiltInRegistries.ITEM.getKey(output.getItem()).toString()); + if (output.getCount() > 1) { + result.addProperty("count", output.getCount()); + } + if (output.hasTag() && output.getTag() != null) { + result.add("nbt", NBTToJsonConverter.getObject(output.getTag())); + } + json.add("result", result); + } + + json.addProperty("experience", experience); + json.addProperty("cookingtime", cookingTime); + } + + public void save(Consumer consumer) { + consumer.accept(new FinishedRecipe() { + + @Override + public void serializeRecipeData(JsonObject pJson) { + toJson(pJson); + } + + @Override + public ResourceLocation getId() { + var ID = id == null ? defaultId() : id; + return new ResourceLocation(ID.getNamespace(), "smoking" + "/" + ID.getPath()); + } + + @Override + public RecipeSerializer getType() { + return RecipeSerializer.SMOKING_RECIPE; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return null; + } + }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java deleted file mode 100644 index db8f1b93e0b..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@NotNullByDefault -package com.gregtechceu.gtceu.data.recipe.builder; - -import org.jetbrains.annotations.NotNullByDefault; From cac52490013eb6ee14cf3b7974254add6078fd00 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Wed, 22 Apr 2026 20:51:53 +0800 Subject: [PATCH 66/78] small fix --- .../gtceu/api/blockentity/MetaMachineBlockEntity.java | 2 +- .../com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java | 2 +- .../com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index 380debf6782..63169f57954 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -325,7 +325,7 @@ public AABB getRenderBoundingBox() { @Override public void load(CompoundTag tag) { - TagFixer.fixFluidTags(tag); + // TagFixer.fixFluidTags(tag); super.load(tag); } 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 bf1ed9d96b9..f78403ec081 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -455,7 +455,7 @@ public static boolean isConnected(int connections, Direction side) { @Override public void load(CompoundTag tag) { - TagFixer.fixFluidTags(tag); + // TagFixer.fixFluidTags(tag); super.load(tag); } 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 8c5598cb3a0..f8f54394e7a 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 @@ -403,6 +403,7 @@ public void setupRecipe(GTRecipe recipe) { chanceCaches.clear(); } failureReasonMap.clear(); + failureReasons.clear(); recipeDirty = false; lastRecipe = recipe; setStatus(Status.WORKING); From 8a7190db4d365ff89a4ad412258e26dbaeb3cb11 Mon Sep 17 00:00:00 2001 From: Gustavo <77560533+gustovafing@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:44:24 +1000 Subject: [PATCH 67/78] Make recipe iterator hasNext work properly (#4770) --- .../gtceu/api/machine/trait/RecipeLogic.java | 5 ++- .../gtceu/api/recipe/lookup/RecipeDB.java | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-) 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 f8f54394e7a..be3e9db4728 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 @@ -68,7 +68,7 @@ public enum Status implements StringRepresentable { public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RecipeLogic.class); public final IRecipeLogicMachine machine; - public List lastFailedMatches; + public @Nullable List lastFailedMatches; @Getter @Persisted @@ -354,10 +354,9 @@ public void findAndHandleRecipe() { recipeDirty = false; } - protected void handleSearchingRecipes(@NotNull Iterator matches) { + protected void handleSearchingRecipes(Iterator matches) { while (matches.hasNext()) { GTRecipe match = matches.next(); - if (match == null) continue; // If a new recipe was found, cache found recipe. if (checkMatchedRecipeAvailable(match)) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java index a7862af48d3..f3ee3967235 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java @@ -75,7 +75,8 @@ public void clear() { @VisibleForTesting public @Nullable GTRecipe find(@NotNull List> list, @NotNull Predicate predicate) { - return (new RecipeIterator(this, list, predicate)).next(); + var iter = new RecipeIterator(this, list, predicate); + return iter.hasNext() ? iter.next() : null; } /** @@ -285,6 +286,9 @@ public static class RecipeIterator implements Iterator { private final Deque stack = new ArrayDeque<>(); + private @Nullable GTRecipe nextCached = null; + private boolean hasCached = false; + @VisibleForTesting public RecipeIterator(@NotNull RecipeDB db, @NotNull List> ingredients, @@ -298,13 +302,7 @@ public RecipeIterator(@NotNull RecipeDB db, } } - @Override - public boolean hasNext() { - return !stack.isEmpty(); - } - - @Override - public GTRecipe next() { + private @Nullable GTRecipe getNext() { while (!stack.isEmpty()) { // We stay on one frame until all ingredients have been checked SearchFrame frame = stack.peek(); @@ -343,6 +341,23 @@ public GTRecipe next() { return null; // no more recipes } + @Override + public boolean hasNext() { + if (!hasCached) { + nextCached = getNext(); + hasCached = true; + } + return nextCached != null; + } + + @Override + public GTRecipe next() { + if (!hasCached) nextCached = getNext(); + hasCached = false; + if (nextCached == null) throw new NoSuchElementException(); + return nextCached; + } + /** * Reset the iterator */ From ca7119e40ac13856488c2fd95ff19d232b1c7956 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Tue, 12 May 2026 20:23:09 +0800 Subject: [PATCH 68/78] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E5=8E=9F=E6=96=99=E5=9C=A8=E6=90=9C=E7=B4=A2=E9=85=8D?= =?UTF-8?q?=E6=96=B9=E6=97=B6=E8=A2=AB=E9=87=8D=E5=A4=8D=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/blockentity/MetaMachineBlockEntity.java | 1 - .../gtceu/api/blockentity/PipeBlockEntity.java | 1 - .../gtceu/api/recipe/lookup/RecipeDB.java | 12 ++++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index 63169f57954..78b610c0dc4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -15,7 +15,6 @@ import com.gregtechceu.gtceu.api.misc.LaserContainerList; import com.gregtechceu.gtceu.client.model.IBlockEntityRendererBakedModel; import com.gregtechceu.gtceu.client.model.machine.MachineRenderState; -import com.gregtechceu.gtceu.common.datafixers.TagFixer; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IManaged; 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 f78403ec081..2400d19bc1f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -14,7 +14,6 @@ import com.gregtechceu.gtceu.api.pipenet.*; import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; import com.gregtechceu.gtceu.common.data.GTMaterials; -import com.gregtechceu.gtceu.common.datafixers.TagFixer; import com.gregtechceu.gtceu.utils.GTUtil; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java index f3ee3967235..11820b83545 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java @@ -19,6 +19,7 @@ import com.mojang.datafixers.util.Either; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.*; import java.util.*; @@ -136,11 +137,14 @@ public void clear() { if (!cap.isRecipeSearchFilter()) { return; } + var ingredientList = new ObjectOpenHashSet<>(); for (var handler : handlers) { - var compressed = cap.compressIngredients(handler.getContents()); - for (var ingredient : compressed) { - list.add(MapIngredientTypeManager.getFrom(ingredient, cap)); - } + ingredientList.addAll(handler.getContents()); + } + + var compressed = cap.compressIngredients(ingredientList); + for (var ingredient : compressed) { + list.add(MapIngredientTypeManager.getFrom(ingredient, cap)); } }); if (list.isEmpty()) { From 9d06ca1ff18cedc19ff96d18b82fe8e0b3cb7467 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Wed, 13 May 2026 11:55:37 +0800 Subject: [PATCH 69/78] =?UTF-8?q?refactor:=20=E5=B0=86CraftingComponent?= =?UTF-8?q?=E6=94=B9=E6=88=90=E6=B3=9B=E5=9E=8B=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?GTRecipeBuilder=E4=B8=AD=E7=9A=84inputItems(Object)=E5=92=8Cout?= =?UTF-8?q?putItem(Object)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/data/recipe/CraftingComponent.java | 68 ++++---- .../data/recipe/GTCraftingComponents.java | 151 +++++++++--------- .../data/recipe/builder/GTRecipeBuilder.java | 88 +--------- .../data/recipe/misc/MachineRecipeLoader.java | 2 +- .../kjs/events/CraftingComponentsEventJS.java | 72 +++++---- 5 files changed, 152 insertions(+), 229 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java index 481a48e1ca0..5151bb65247 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java @@ -5,88 +5,76 @@ import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialEntry; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.ItemStack; - import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import lombok.Setter; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Map; import static com.gregtechceu.gtceu.api.GTValues.V; -public class CraftingComponent { - - public static final Map ALL_COMPONENTS = new Object2ReferenceOpenHashMap<>(); +public class CraftingComponent { - public static final CraftingComponent EMPTY = CraftingComponent.of("empty", ItemStack.EMPTY); + public static final Map> ALL_COMPONENTS = new Object2ReferenceOpenHashMap<>(); - private final Object[] values = new Object[V.length]; + private final List values = new ArrayList<>(Collections.nCopies(V.length, null)); @Setter - private @NotNull Object fallback; + private @NotNull T fallback; - protected CraftingComponent(@NotNull Object fallback) { - checkType(fallback); + protected CraftingComponent(@NotNull T fallback) { this.fallback = fallback; } - public static CraftingComponent of(@NotNull String id, @NotNull Object fallback) { + public static CraftingComponent of(@NotNull String id, @NotNull T fallback) { var existing = ALL_COMPONENTS.get(id); if (existing != null) { GTCEu.LOGGER.error("Duplicate crafting component id: {}, check components", id); - return existing; + // noinspection unchecked + return (CraftingComponent) existing; } - var ret = new CraftingComponent(fallback); + var ret = new CraftingComponent<>(fallback); ALL_COMPONENTS.put(id, ret); return ret; } - public static CraftingComponent of(@NotNull String id, @NotNull TagPrefix prefix, @NotNull Material material) { + public static CraftingComponent of(@NotNull String id, @NotNull TagPrefix prefix, + @NotNull Material material) { return of(id, new MaterialEntry(prefix, material)); } - public @NotNull Object get(int tier) { - if (this == EMPTY) return ItemStack.EMPTY; - if (tier < 0 || tier >= values.length) + public @NotNull T get(int tier) { + if (tier < 0 || tier >= values.size()) throw new IllegalArgumentException("Tier out of range of ULV-MAX, tier: " + tier); - var val = values[tier]; + var val = values.get(tier); return val == null ? fallback : val; } - public @NotNull CraftingComponent add(int tier, @NotNull Object value) { - if (this == EMPTY) return this; - checkType(value); - values[tier] = value; + public @NotNull CraftingComponent add(int tier, @NotNull T value) { + values.set(tier, value); return this; } - public @NotNull CraftingComponent add(int tier, @NotNull TagPrefix prefix, @NotNull Material material) { - return add(tier, new MaterialEntry(prefix, material)); + public @NotNull CraftingComponent add(int tier, @NotNull TagPrefix prefix, @NotNull Material material) { + return add(tier, castValue(new MaterialEntry(prefix, material))); } public void remove(int tier) { - if (this == EMPTY) return; - if (tier < 0 || tier >= values.length) + if (tier < 0 || tier >= values.size()) throw new IllegalArgumentException("Tier out of range of ULV-MAX, tier: " + tier); - values[tier] = null; + values.set(tier, null); } - private void checkType(@NotNull Object o) { - if ((o instanceof TagKey tag)) { - if (!tag.isFor(BuiltInRegistries.ITEM.key())) { - throw new IllegalArgumentException("TagKey must be of type TagKey"); - } - } else if (!(o instanceof ItemStack || o instanceof MaterialEntry)) { - throw new IllegalArgumentException("Object is not of type ItemStack, MaterialEntry or TagKey"); - } + @SuppressWarnings("unchecked") + private T castValue(@NotNull Object value) { + return (T) value; } - public static CraftingComponent get(String id) { + public static CraftingComponent get(String id) { if (!ALL_COMPONENTS.containsKey(id)) { - GTCEu.LOGGER.error("No such crafting component: {}", id); - return EMPTY; + throw new IllegalArgumentException("No such crafting component: " + id); } return ALL_COMPONENTS.get(id); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java index eda2685471d..7dcd0ca8ae5 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java @@ -2,6 +2,8 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialEntry; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMachines; @@ -9,8 +11,11 @@ import com.gregtechceu.gtceu.integration.kjs.GTCEuStartupEvents; import com.gregtechceu.gtceu.integration.kjs.events.CraftingComponentsEventJS; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.Tags; import static com.gregtechceu.gtceu.api.GTValues.*; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; @@ -18,58 +23,58 @@ public class GTCraftingComponents { - public static CraftingComponent CIRCUIT; - public static CraftingComponent BETTER_CIRCUIT; - public static CraftingComponent PUMP; - public static CraftingComponent WIRE_ELECTRIC; - public static CraftingComponent WIRE_QUAD; - public static CraftingComponent WIRE_OCT; - public static CraftingComponent WIRE_HEX; - public static CraftingComponent CABLE; - public static CraftingComponent CABLE_DOUBLE; - public static CraftingComponent CABLE_QUAD; - public static CraftingComponent CABLE_OCT; - public static CraftingComponent CABLE_HEX; - public static CraftingComponent CABLE_TIER_UP; - public static CraftingComponent CABLE_TIER_UP_DOUBLE; - public static CraftingComponent CABLE_TIER_UP_QUAD; - public static CraftingComponent CABLE_TIER_UP_OCT; - public static CraftingComponent CABLE_TIER_UP_HEX; - public static CraftingComponent CASING; - public static CraftingComponent HULL; - public static CraftingComponent PIPE_NORMAL; - public static CraftingComponent PIPE_LARGE; - public static CraftingComponent PIPE_NONUPLE; - public static CraftingComponent GLASS; - public static CraftingComponent PLATE; - public static CraftingComponent HULL_PLATE; - public static CraftingComponent MOTOR; - public static CraftingComponent ROTOR; - public static CraftingComponent SENSOR; - public static CraftingComponent SENSOR_EMITTER_GEM; - public static CraftingComponent GRINDER; - public static CraftingComponent SAWBLADE; - public static CraftingComponent PISTON; - public static CraftingComponent EMITTER; - public static CraftingComponent CONVEYOR; - public static CraftingComponent ROBOT_ARM; - public static CraftingComponent COIL_HEATING; - public static CraftingComponent COIL_HEATING_DOUBLE; - public static CraftingComponent COIL_ELECTRIC; - public static CraftingComponent ROD_MAGNETIC; - public static CraftingComponent ROD_DISTILLATION; - public static CraftingComponent FIELD_GENERATOR; - public static CraftingComponent ROD_ELECTROMAGNETIC; - public static CraftingComponent ROD_RADIOACTIVE; - public static CraftingComponent PIPE_REACTOR; - public static CraftingComponent POWER_COMPONENT; - public static CraftingComponent VOLTAGE_COIL; - public static CraftingComponent SPRING; - public static CraftingComponent CRATE; - public static CraftingComponent DRUM; - public static CraftingComponent FRAME; - public static CraftingComponent SMALL_SPRING_TRANSFORMER; - public static CraftingComponent SPRING_TRANSFORMER; + public static CraftingComponent> CIRCUIT; + public static CraftingComponent> BETTER_CIRCUIT; + public static CraftingComponent PUMP; + public static CraftingComponent WIRE_ELECTRIC; + public static CraftingComponent WIRE_QUAD; + public static CraftingComponent WIRE_OCT; + public static CraftingComponent WIRE_HEX; + public static CraftingComponent CABLE; + public static CraftingComponent CABLE_DOUBLE; + public static CraftingComponent CABLE_QUAD; + public static CraftingComponent CABLE_OCT; + public static CraftingComponent CABLE_HEX; + public static CraftingComponent CABLE_TIER_UP; + public static CraftingComponent CABLE_TIER_UP_DOUBLE; + public static CraftingComponent CABLE_TIER_UP_QUAD; + public static CraftingComponent CABLE_TIER_UP_OCT; + public static CraftingComponent CABLE_TIER_UP_HEX; + public static CraftingComponent CASING; + public static CraftingComponent HULL; + public static CraftingComponent PIPE_NORMAL; + public static CraftingComponent PIPE_LARGE; + public static CraftingComponent PIPE_NONUPLE; + public static CraftingComponent GLASS; + public static CraftingComponent PLATE; + public static CraftingComponent HULL_PLATE; + public static CraftingComponent MOTOR; + public static CraftingComponent ROTOR; + public static CraftingComponent SENSOR; + public static CraftingComponent SENSOR_EMITTER_GEM; + public static CraftingComponent GRINDER; + public static CraftingComponent SAWBLADE; + public static CraftingComponent PISTON; + public static CraftingComponent EMITTER; + public static CraftingComponent CONVEYOR; + public static CraftingComponent ROBOT_ARM; + public static CraftingComponent COIL_HEATING; + public static CraftingComponent COIL_HEATING_DOUBLE; + public static CraftingComponent COIL_ELECTRIC; + public static CraftingComponent ROD_MAGNETIC; + public static CraftingComponent ROD_DISTILLATION; + public static CraftingComponent FIELD_GENERATOR; + public static CraftingComponent ROD_ELECTROMAGNETIC; + public static CraftingComponent ROD_RADIOACTIVE; + public static CraftingComponent PIPE_REACTOR; + public static CraftingComponent POWER_COMPONENT; + public static CraftingComponent VOLTAGE_COIL; + public static CraftingComponent SPRING; + public static CraftingComponent CRATE; + public static CraftingComponent DRUM; + public static CraftingComponent FRAME; + public static CraftingComponent SMALL_SPRING_TRANSFORMER; + public static CraftingComponent SPRING_TRANSFORMER; public static void init() { CraftingComponent.ALL_COMPONENTS.clear(); @@ -355,10 +360,10 @@ public static void init() { * Laminated Glass: IV, LuV * Fusion: ZPM, UV, UHV */ - GLASS = CraftingComponent.of("glass", Tags.Items.GLASS) - .add(ULV, Tags.Items.GLASS) - .add(LV, Tags.Items.GLASS) - .add(MV, Tags.Items.GLASS) + GLASS = CraftingComponent.of("glass", Items.GLASS.getDefaultInstance()) + .add(ULV, Items.GLASS.getDefaultInstance()) + .add(LV, Items.GLASS.getDefaultInstance()) + .add(MV, Items.GLASS.getDefaultInstance()) .add(HV, GTBlocks.CASING_TEMPERED_GLASS.asStack()) .add(EV, GTBlocks.CASING_TEMPERED_GLASS.asStack()) .add(IV, GTBlocks.CASING_LAMINATED_GLASS.asStack()) @@ -403,10 +408,10 @@ public static void init() { .add(UV, rotor, Darmstadtium) .add(UHV, rotor, Darmstadtium); - GRINDER = CraftingComponent.of("grinder", gem, Diamond) - .add(ULV, gem, Diamond) - .add(LV, gem, Diamond) - .add(MV, gem, Diamond) + GRINDER = CraftingComponent.of("grinder", ChemicalHelper.get(gem, Diamond)) + .add(ULV, ChemicalHelper.get(gem, Diamond)) + .add(LV, ChemicalHelper.get(gem, Diamond)) + .add(MV, ChemicalHelper.get(gem, Diamond)) .add(HV, GTItems.COMPONENT_GRINDER_DIAMOND.asStack()) .add(EV, GTItems.COMPONENT_GRINDER_DIAMOND.asStack()) .add(IV, GTItems.COMPONENT_GRINDER_TUNGSTEN.asStack()) @@ -513,10 +518,10 @@ public static void init() { .add(OpV, GTItems.SENSOR_OpV.asStack()); } - SENSOR_EMITTER_GEM = CraftingComponent.of("sensor_emitter_gem", gem, Quartzite) - .add(LV, gem, Quartzite) - .add(MV, gemFlawless, Emerald) - .add(HV, gem, EnderEye) + SENSOR_EMITTER_GEM = CraftingComponent.of("sensor_emitter_gem", ChemicalHelper.get(gem, Quartzite)) + .add(LV, ChemicalHelper.get(gem, Quartzite)) + .add(MV, ChemicalHelper.get(gemFlawless, Emerald)) + .add(HV, ChemicalHelper.get(gem, EnderEye)) .add(EV, GTItems.QUANTUM_EYE.asStack()) .add(IV, GTItems.QUANTUM_STAR.asStack()) .add(LuV, GTItems.QUANTUM_STAR.asStack()) @@ -654,10 +659,10 @@ public static void init() { .add(UV, rod, Tritanium) .add(UHV, rod, Tritanium); - PIPE_REACTOR = CraftingComponent.of("pipe_reactor", Tags.Items.GLASS) - .add(ULV, Tags.Items.GLASS) - .add(LV, Tags.Items.GLASS) - .add(MV, Tags.Items.GLASS) + PIPE_REACTOR = CraftingComponent.of("pipe_reactor", block, Glass) + .add(ULV, block, Glass) + .add(LV, block, Glass) + .add(MV, block, Glass) .add(HV, pipeNormalFluid, Polyethylene) .add(EV, pipeLargeFluid, Polyethylene) .add(IV, pipeHugeFluid, Polyethylene) @@ -699,8 +704,8 @@ public static void init() { .add(UV, spring, YttriumBariumCuprate) .add(UHV, spring, Europium); - CRATE = CraftingComponent.of("crate", Tags.Items.CHESTS_WOODEN) - .add(ULV, Tags.Items.CHESTS_WOODEN) + CRATE = CraftingComponent.of("crate", Items.CHEST.getDefaultInstance()) + .add(ULV, Items.CHEST.getDefaultInstance()) .add(LV, GTMachines.WOODEN_CRATE.asStack()) .add(MV, GTMachines.BRONZE_CRATE.asStack()) .add(HV, GTMachines.STEEL_CRATE.asStack()) @@ -711,8 +716,8 @@ public static void init() { .add(UV, GTMachines.SUPER_CHEST[1].asStack()) .add(UHV, GTMachines.SUPER_CHEST[2].asStack()); - DRUM = CraftingComponent.of("drum", Tags.Items.GLASS) - .add(ULV, Tags.Items.GLASS) + DRUM = CraftingComponent.of("drum", Items.GLASS.getDefaultInstance()) + .add(ULV, Items.GLASS.getDefaultInstance()) .add(LV, GTMachines.WOODEN_DRUM.asStack()) .add(MV, GTMachines.BRONZE_DRUM.asStack()) .add(HV, GTMachines.STEEL_DRUM.asStack()) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 76ccac9f8dd..d736228e6d1 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -301,52 +301,8 @@ public GTRecipeBuilder outputCWU(int cwu) { return output(CWURecipeCapability.CAP, cwu); } - public GTRecipeBuilder inputItems(Object input) { - if (input instanceof Item item) { - return inputItems(item); - } else if (input instanceof Supplier supplier && supplier.get() instanceof ItemLike item) { - return inputItems(item.asItem()); - } else if (input instanceof ItemStack stack) { - return inputItems(stack); - } else if (input instanceof Ingredient ingredient) { - return inputItems(ingredient); - } else if (input instanceof MaterialEntry entry) { - return inputItems(entry); - } else if (input instanceof TagKey tag) { - return inputItems((TagKey) tag); - } else if (input instanceof MachineDefinition machine) { - return inputItems(machine); - } else { - GTCEu.LOGGER.error(""" - Input item is not one of: - Item, Supplier, ItemStack, Ingredient, MaterialEntry, TagKey, MachineDefinition - id: {}""", id); - return this; - } - } - - public GTRecipeBuilder inputItems(Object input, int count) { - if (input instanceof Item item) { - return inputItems(item, count); - } else if (input instanceof Supplier supplier && supplier.get() instanceof ItemLike item) { - return inputItems(item.asItem(), count); - } else if (input instanceof ItemStack stack) { - return inputItems(stack.copyWithCount(count)); - } else if (input instanceof Ingredient ingredient) { - return inputItems(ingredient, count); - } else if (input instanceof MaterialEntry entry) { - return inputItems(entry, count); - } else if (input instanceof TagKey tag) { - return inputItems((TagKey) tag, count); - } else if (input instanceof MachineDefinition machine) { - return inputItems(machine, count); - } else { - GTCEu.LOGGER.error(""" - Input item is not one of: - Item, Supplier, ItemStack, Ingredient, MaterialEntry, TagKey, MachineDefinition - id: {}""", id); - return this; - } + public GTRecipeBuilder inputItems(ItemStack stack, int count) { + return inputItems(stack.copyWithCount(count)); } public GTRecipeBuilder inputItems(Ingredient inputs) { @@ -503,44 +459,8 @@ public GTRecipeBuilder inputItemNbtPredicate(ItemStack stack, NBTPredicate predi return inputItems(NBTPredicateIngredient.of(stack, predicate)); } - public GTRecipeBuilder outputItems(Object output) { - if (output instanceof Item item) { - return outputItems(item); - } else if (output instanceof Supplier supplier && supplier.get() instanceof ItemLike item) { - return outputItems(item.asItem()); - } else if (output instanceof ItemStack stack) { - return outputItems(stack); - } else if (output instanceof MaterialEntry entry) { - return outputItems(entry); - } else if (output instanceof MachineDefinition machine) { - return outputItems(machine); - } else { - GTCEu.LOGGER.error(""" - Output item is not one of: - Item, Supplier, ItemStack, MaterialEntry, MachineDefinition - id: {}""", id); - return this; - } - } - - public GTRecipeBuilder outputItems(Object output, int count) { - if (output instanceof Item item) { - return outputItems(item, count); - } else if (output instanceof Supplier supplier && supplier.get() instanceof ItemLike item) { - return outputItems(item.asItem(), count); - } else if (output instanceof ItemStack stack) { - return outputItems(stack.copyWithCount(count)); - } else if (output instanceof MaterialEntry entry) { - return outputItems(entry, count); - } else if (output instanceof MachineDefinition machine) { - return outputItems(machine, count); - } else { - GTCEu.LOGGER.error(""" - Output item is not one of: - Item, Supplier, ItemStack, MaterialEntry, MachineDefinition - id: {}""", id); - return this; - } + public GTRecipeBuilder outputItems(ItemStack output, int count) { + return outputItems(output.copyWithCount(count)); } public GTRecipeBuilder outputItems(ItemStack output) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 5371cbd9b1b..7326a87dbfd 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -650,7 +650,7 @@ private static void registerAssemblerRecipes(Consumer provider) .save(provider); ASSEMBLER_RECIPES.recipeBuilder("cover_storage") - .inputItems(Tags.Blocks.CHESTS_WOODEN) + .inputItems(Tags.Items.CHESTS_WOODEN) .inputItems(ELECTRIC_PISTON_LV) .inputItems(plate, Iron) .inputFluids(SolderingAlloy, L / 2) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/CraftingComponentsEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/CraftingComponentsEventJS.java index 8e58c054d58..33f4f2a72e4 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/CraftingComponentsEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/CraftingComponentsEventJS.java @@ -26,52 +26,52 @@ @NoArgsConstructor public class CraftingComponentsEventJS extends StartupEventJS { - private ComponentWrapper create(String id, Object fallback) { + private ComponentWrapper create(String id, T fallback) { return ComponentWrapper.of(id, fallback); } - public ComponentWrapper createItem(String id, ItemStack stack) { + public ComponentWrapper createItem(String id, ItemStack stack) { return create(id, stack); } - public ComponentWrapper createTag(String id, ResourceLocation tag) { + public ComponentWrapper> createTag(String id, ResourceLocation tag) { return create(id, TagKey.create(Registries.ITEM, tag)); } - public ComponentWrapper createMaterialEntry(String id, MaterialEntry entry) { + public ComponentWrapper createMaterialEntry(String id, MaterialEntry entry) { return create(id, entry); } // Set singular - private void set(CraftingComponent craftingComponent, int tier, Object value) { + private void set(CraftingComponent craftingComponent, int tier, T value) { craftingComponent.add(tier, value); } - public void setItem(CraftingComponent craftingComponent, int tier, ItemStack item) { + public void setItem(CraftingComponent craftingComponent, int tier, ItemStack item) { set(craftingComponent, tier, item); } - public void setTag(CraftingComponent craftingComponent, int tier, ResourceLocation tag) { + public void setTag(CraftingComponent> craftingComponent, int tier, ResourceLocation tag) { set(craftingComponent, tier, TagKey.create(Registries.ITEM, tag)); } - public void setMaterialEntry(CraftingComponent craftingComponent, int tier, + public void setMaterialEntry(CraftingComponent craftingComponent, int tier, MaterialEntry matEntry) { set(craftingComponent, tier, matEntry); } // Set from Map methods - public void set(CraftingComponent craftingComponent, Map map) { + public void set(CraftingComponent craftingComponent, Map map) { for (var val : map.entrySet()) { int tier = parseTier(val.getKey()); if (tier == -1) return; Object obj = parseObject(val.getValue()); if (obj == null) return; - craftingComponent.add(tier, obj); + addUnchecked(craftingComponent, tier, obj); } } - public void setItems(CraftingComponent craftingComponent, Map map) { + public void setItems(CraftingComponent craftingComponent, Map map) { for (var val : map.entrySet()) { int tier = parseTier(val.getKey()); if (tier == -1) return; @@ -84,7 +84,7 @@ public void setItems(CraftingComponent craftingComponent, Map ma } } - public void setTags(CraftingComponent craftingComponent, Map map) { + public void setTags(CraftingComponent> craftingComponent, Map map) { for (var val : map.entrySet()) { int tier = parseTier(val.getKey()); if (tier == -1) return; @@ -97,7 +97,7 @@ public void setTags(CraftingComponent craftingComponent, Map map } } - public void setMaterialEntries(CraftingComponent craftingComponent, Map map) { + public void setMaterialEntries(CraftingComponent craftingComponent, Map map) { for (var val : map.entrySet()) { int tier = parseTier(val.getKey()); if (tier == -1) return; @@ -110,28 +110,34 @@ public void setMaterialEntries(CraftingComponent craftingComponent, Map craftingComponent, ItemStack stack) { craftingComponent.setFallback(stack); } - public void setFallbackTag(CraftingComponent craftingComponent, ResourceLocation tag) { + public void setFallbackTag(CraftingComponent> craftingComponent, ResourceLocation tag) { craftingComponent.setFallback(TagKey.create(Registries.ITEM, tag)); } - public void setFallbackMaterialEntry(CraftingComponent craftingComponent, MaterialEntry materialEntry) { + public void setFallbackMaterialEntry(CraftingComponent craftingComponent, + MaterialEntry materialEntry) { craftingComponent.setFallback(materialEntry); } - public void removeTier(CraftingComponent craftingComponent, int tier) { + public void removeTier(CraftingComponent craftingComponent, int tier) { craftingComponent.remove(tier); } - public void removeTiers(CraftingComponent craftingComponent, int... tiers) { + public void removeTiers(CraftingComponent craftingComponent, int... tiers) { for (int t : tiers) { craftingComponent.remove(t); } } + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static void addUnchecked(CraftingComponent craftingComponent, int tier, Object value) { + ((CraftingComponent) craftingComponent).add(tier, value); + } + private static ItemStack parseItemStack(Object o) { ItemStack stack = ItemStackJS.of(o); if (stack == null || stack.isEmpty()) return null; @@ -175,26 +181,26 @@ private static int parseTier(Object o) { return ret; } - public static class ComponentWrapper extends CraftingComponent { + public static class ComponentWrapper extends CraftingComponent { private final String id; - private ComponentWrapper(String id, Object fallback) { + private ComponentWrapper(String id, T fallback) { super(fallback); this.id = id; } - public static ComponentWrapper of(@NotNull String id, @NotNull Object fallback) { + public static ComponentWrapper of(@NotNull String id, @NotNull T fallback) { if (ALL_COMPONENTS.containsKey(id)) { // Throw here because we don't want Kubers to mess with existing components throw new IllegalArgumentException("Duplicate crafting component: " + id); } - var ret = new ComponentWrapper(id, fallback); + var ret = new ComponentWrapper<>(id, fallback); ALL_COMPONENTS.put(id, ret); return ret; } - public @NotNull ComponentWrapper add(int tier, @NotNull Object value) { + public @NotNull ComponentWrapper add(int tier, @NotNull T value) { try { super.add(tier, value); } catch (RuntimeException e) { @@ -203,20 +209,24 @@ public static ComponentWrapper of(@NotNull String id, @NotNull Object fallback) return this; } - public ComponentWrapper addItem(int tier, ItemStack stack) { - return add(tier, stack); + @SuppressWarnings("unchecked") + public ComponentWrapper addItem(int tier, ItemStack stack) { + return ((ComponentWrapper) this).add(tier, stack); } - public ComponentWrapper addTag(int tier, ResourceLocation tag) { - return add(tier, TagKey.create(Registries.ITEM, tag)); + @SuppressWarnings("unchecked") + public ComponentWrapper> addTag(int tier, ResourceLocation tag) { + return ((ComponentWrapper>) this).add(tier, TagKey.create(Registries.ITEM, tag)); } - public ComponentWrapper addMaterialEntry(int tier, MaterialEntry entry) { - return add(tier, entry); + @SuppressWarnings("unchecked") + public ComponentWrapper addMaterialEntry(int tier, MaterialEntry entry) { + return ((ComponentWrapper) this).add(tier, entry); } - public ComponentWrapper addMaterialEntry(int tier, TagPrefix prefix, Material mat) { - return add(tier, new MaterialEntry(prefix, mat)); + @SuppressWarnings("unchecked") + public ComponentWrapper addMaterialEntry(int tier, TagPrefix prefix, Material mat) { + return ((ComponentWrapper) this).add(tier, new MaterialEntry(prefix, mat)); } } } From c8a08373221e49ca70cd037ecbcf3abde179f371 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Thu, 14 May 2026 19:37:41 +0800 Subject: [PATCH 70/78] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0gradle?= =?UTF-8?q?=E5=92=8Cmdfg=E7=89=88=E6=9C=AC=EF=BC=8C=E6=B7=BB=E5=8A=A0at?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fb0dce9c777..00940a3d58b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ minecraftForge = "1.20.1-47.4.1" parchment = "2023.09.03" # https://parchmentmc.org/docs/getting-started shadow = "8.3.5" spotless = "8.1.0" -modDevGradle = "2.0.91" +modDevGradle = "2.0.141" lombok = "8.14" jetbrains-annotations = "26.0.1" renderNurse = "0.0.12" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ca025c83a7c..2e1113280ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 292a2027a0299e7fed76015956c5963bcf4a061a Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Thu, 14 May 2026 20:13:34 +0800 Subject: [PATCH 71/78] fix --- gradle/scripts/moddevgradle.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gradle/scripts/moddevgradle.gradle b/gradle/scripts/moddevgradle.gradle index cce16a5db05..9f136295b35 100644 --- a/gradle/scripts/moddevgradle.gradle +++ b/gradle/scripts/moddevgradle.gradle @@ -167,3 +167,7 @@ idea { downloadJavadoc = true } } + +tasks.named("test", Test).configure { + failOnNoDiscoveredTests = false +} From b1c359f2fe1de1bd4d5052448fd783b6b616bd1c Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Fri, 15 May 2026 20:18:27 +0800 Subject: [PATCH 72/78] =?UTF-8?q?refactor:=20=E4=BD=BF=E7=94=A8FieldHolder?= =?UTF-8?q?Map=E9=81=BF=E5=85=8D=E6=98=BE=E5=BC=8F=E5=88=9B=E5=BB=BAMANAGE?= =?UTF-8?q?D=5FFIELD=5FHOLDER?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/scripts/spotless.gradle | 2 +- .../blockentity/MetaMachineBlockEntity.java | 6 +-- .../api/blockentity/PipeBlockEntity.java | 13 +++--- .../gtceu/api/cover/CoverBehavior.java | 6 ++- .../gtceu/api/cover/filter/FilterHandler.java | 6 ++- .../api/machine/MachineCoverContainer.java | 6 ++- .../gtceu/api/machine/MetaMachine.java | 5 ++- .../api/machine/SimpleTieredMachine.java | 9 ----- .../api/machine/TieredEnergyMachine.java | 8 ---- .../api/machine/WorkableTieredMachine.java | 9 ----- .../MultiblockControllerMachine.java | 8 ---- ...eredWorkableElectricMultiblockMachine.java | 8 ---- .../WorkableElectricMultiblockMachine.java | 8 ---- .../multiblock/WorkableMultiblockMachine.java | 8 ---- .../part/MultiblockPartMachine.java | 9 ----- .../multiblock/part/TieredIOPartMachine.java | 9 ----- .../api/machine/steam/SimpleSteamMachine.java | 9 ----- .../api/machine/steam/SteamBoilerMachine.java | 9 ----- .../gtceu/api/machine/steam/SteamMachine.java | 9 ----- .../machine/steam/SteamWorkableMachine.java | 8 ---- .../machine/trait/FluidTankProxyTrait.java | 8 ---- .../machine/trait/ItemHandlerProxyTrait.java | 8 ---- .../gtceu/api/machine/trait/MachineTrait.java | 10 +++++ .../trait/NotifiableEnergyContainer.java | 9 ----- .../machine/trait/NotifiableFluidTank.java | 9 ----- .../trait/NotifiableItemStackHandler.java | 9 ----- .../trait/NotifiableLaserContainer.java | 5 --- .../trait/NotifiableRecipeHandlerTrait.java | 9 ----- .../gtceu/api/machine/trait/RecipeLogic.java | 9 ----- .../gtceu/api/pipenet/PipeCoverContainer.java | 6 ++- .../common/blockentity/CableBlockEntity.java | 10 ----- .../common/cover/ComputerMonitorCover.java | 10 ----- .../gtceu/common/cover/ConveyorCover.java | 9 ----- .../gtceu/common/cover/FacadeCover.java | 9 ----- .../gtceu/common/cover/FluidFilterCover.java | 9 ----- .../common/cover/FluidRegulatorCover.java | 10 ----- .../gtceu/common/cover/ItemFilterCover.java | 10 ----- .../common/cover/MachineControllerCover.java | 9 ----- .../gtceu/common/cover/PumpCover.java | 10 ----- .../gtceu/common/cover/RobotArmCover.java | 10 ----- .../gtceu/common/cover/ShutterCover.java | 9 ----- .../gtceu/common/cover/StorageCover.java | 10 ----- .../cover/WirelessTransmitterCover.java | 9 ----- .../detector/AdvancedEnergyDetectorCover.java | 9 ----- .../detector/AdvancedFluidDetectorCover.java | 9 ----- .../detector/AdvancedItemDetectorCover.java | 9 ----- .../common/cover/detector/DetectorCover.java | 10 ----- .../cover/ender/AbstractEnderLinkCover.java | 9 ----- .../cover/ender/EnderFluidLinkCover.java | 9 ----- .../cover/ender/EnderItemLinkCover.java | 9 ----- .../cover/ender/EnderRedstoneLinkCover.java | 9 ----- .../voiding/AdvancedFluidVoidingCover.java | 10 ----- .../voiding/AdvancedItemVoidingCover.java | 10 ----- .../cover/voiding/FluidVoidingCover.java | 9 ----- .../cover/voiding/ItemVoidingCover.java | 9 ----- .../electric/BatteryBufferMachine.java | 9 ----- .../machine/electric/BlockBreakerMachine.java | 9 ----- .../machine/electric/ChargerMachine.java | 9 ----- .../machine/electric/ConverterMachine.java | 10 ----- .../machine/electric/FisherMachine.java | 9 ----- .../common/machine/electric/HullMachine.java | 10 ----- .../electric/ItemCollectorMachine.java | 9 ----- .../common/machine/electric/MinerMachine.java | 9 ----- .../common/machine/electric/PumpMachine.java | 9 ----- .../machine/electric/TransformerMachine.java | 10 ----- .../electric/WorldAcceleratorMachine.java | 9 ----- .../electric/CentralMonitorMachine.java | 10 ----- .../multiblock/electric/CleanroomMachine.java | 9 ----- .../electric/FusionReactorMachine.java | 9 ----- .../electric/LargeMinerMachine.java | 9 ----- .../electric/MultiblockTankMachine.java | 9 ----- .../electric/PowerSubstationMachine.java | 16 -------- .../gcym/LargeChemicalBathMachine.java | 10 ----- .../electric/gcym/LargeMixerMachine.java | 10 ----- .../electric/research/HPCAMachine.java | 15 ++++--- .../LargeCombustionEngineMachine.java | 9 ----- .../multiblock/part/CokeOvenHatch.java | 10 ----- .../part/DataAccessHatchMachine.java | 10 ----- .../multiblock/part/DiodePartMachine.java | 10 ----- .../multiblock/part/DualHatchPartMachine.java | 9 ----- .../part/EnergyHatchPartMachine.java | 10 ----- .../part/FluidHatchPartMachine.java | 10 ----- .../multiblock/part/ItemBusPartMachine.java | 9 ----- .../part/LaserHatchPartMachine.java | 11 ----- .../part/MaintenanceHatchPartMachine.java | 10 ----- .../multiblock/part/MufflerPartMachine.java | 8 ---- .../multiblock/part/ObjectHolderMachine.java | 9 ----- .../part/ParallelHatchPartMachine.java | 10 ----- .../part/RotorHolderPartMachine.java | 10 ----- .../part/hpca/HPCAComponentPartMachine.java | 9 ----- .../monitor/AdvancedMonitorPartMachine.java | 10 ----- .../primitive/CharcoalPileIgniterMachine.java | 10 ----- .../PrimitiveBlastFurnaceMachine.java | 10 ----- .../primitive/PrimitivePumpMachine.java | 10 ----- .../primitive/PrimitiveWorkableMachine.java | 10 ----- .../multiblock/steam/LargeBoilerMachine.java | 9 ----- .../steam/SteamLiquidBoilerMachine.java | 9 ----- .../steam/SteamSolidBoilerMachine.java | 9 ----- .../common/machine/storage/BufferMachine.java | 10 ----- .../common/machine/storage/CrateMachine.java | 10 ----- .../machine/storage/CreativeChestMachine.java | 10 ----- .../CreativeComputationProviderMachine.java | 9 ----- .../CreativeEnergyContainerMachine.java | 10 ----- .../machine/storage/CreativeTankMachine.java | 10 ----- .../common/machine/storage/DrumMachine.java | 10 ----- .../storage/LongDistanceEndpointMachine.java | 10 ----- .../machine/storage/QuantumChestMachine.java | 14 ------- .../machine/storage/QuantumTankMachine.java | 14 ------- .../common/machine/trait/CleanroomLogic.java | 9 ----- .../common/machine/trait/ConverterTrait.java | 16 -------- .../machine/trait/miner/LargeMinerLogic.java | 9 ----- .../machine/trait/miner/MinerLogic.java | 9 ----- .../ae2/machine/MEBusPartMachine.java | 10 ----- .../ae2/machine/MEHatchPartMachine.java | 10 ----- .../ae2/machine/MEInputBusPartMachine.java | 8 ---- .../ae2/machine/MEInputHatchPartMachine.java | 9 ----- .../ae2/machine/MEOutputBusPartMachine.java | 10 ----- .../ae2/machine/MEOutputHatchPartMachine.java | 10 ----- .../machine/MEPatternBufferPartMachine.java | 9 ----- .../MEPatternBufferProxyPartMachine.java | 10 ----- .../ae2/machine/MEStockingBusPartMachine.java | 10 ----- .../machine/MEStockingHatchPartMachine.java | 10 ----- .../ae2/machine/trait/GridNodeHolder.java | 9 ----- .../ae2/machine/trait/GridNodeHostTrait.java | 7 ---- .../ae2/slot/ExportOnlyAEFluidList.java | 10 ----- .../ae2/slot/ExportOnlyAEItemList.java | 10 ----- .../gtceu/utils/ManagedFieldHolderMap.java | 40 +++++++++++++++++++ 127 files changed, 90 insertions(+), 1124 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/utils/ManagedFieldHolderMap.java diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle index fb24ac6bebb..092a32bc1e1 100644 --- a/gradle/scripts/spotless.gradle +++ b/gradle/scripts/spotless.gradle @@ -3,7 +3,7 @@ // Can be locally toggled via spotless:off/spotless:on comments spotless { encoding 'UTF-8' - ratchetFrom 'origin/1.20.1' + // ratchetFrom 'origin/1.20.1' format 'misc', { target '.gitignore' diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index 78b610c0dc4..12d42765f9a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -16,6 +16,7 @@ import com.gregtechceu.gtceu.client.model.IBlockEntityRendererBakedModel; import com.gregtechceu.gtceu.client.model.machine.MachineRenderState; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; @@ -54,8 +55,7 @@ public class MetaMachineBlockEntity extends BlockEntity implements IMachineBlockEntity, IManaged { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MetaMachineBlockEntity.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MetaMachineBlockEntity.class); public final MultiManagedStorage managedStorage = new MultiManagedStorage(); @Getter @@ -84,7 +84,7 @@ public MultiManagedStorage getRootStorage() { @Override public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override 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 2400d19bc1f..a668174f116 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -27,6 +27,8 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -64,7 +66,8 @@ public abstract class PipeBlockEntity & IPipeTyp IAsyncAutoSyncBlockEntity, IAutoPersistBlockEntity, IToolGridHighlight, IToolable, ICopyable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PipeBlockEntity.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(PipeBlockEntity.class); + @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); private final long offset = GTValues.RNG.nextInt(20); @@ -118,13 +121,13 @@ public void scheduleRenderUpdate() { } @Override - public IManagedStorage getRootStorage() { - return syncStorage; + public ManagedFieldHolder getFieldHolder() { + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + public IManagedStorage getRootStorage() { + return syncStorage; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java index 8be3ad670aa..400e614fc20 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java @@ -19,6 +19,8 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -51,7 +53,7 @@ @MethodsReturnNonnullByDefault public abstract class CoverBehavior implements IEnhancedManaged, IToolGridHighlight, ICopyable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CoverBehavior.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(CoverBehavior.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @@ -82,7 +84,7 @@ public void scheduleRenderUpdate() { @Override public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override 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 e46b233e1cb..75d9bea311c 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 @@ -17,6 +17,8 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; @@ -187,14 +189,14 @@ private void updateFilterGroupUI() { // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FilterHandler.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(FilterHandler.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @Override public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java index 9a122721d41..ea7670a443d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java @@ -17,6 +17,8 @@ import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.syncdata.managed.IRef; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -32,7 +34,7 @@ public class MachineCoverContainer implements ICoverable, IEnhancedManaged { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MachineCoverContainer.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MachineCoverContainer.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @Getter @@ -58,7 +60,7 @@ private void onCoverSet(CoverBehavior newValue, CoverBehavior oldValue) { @Override public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java index 7357c7637ec..7fb3f08b2b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java @@ -34,6 +34,7 @@ import com.gregtechceu.gtceu.common.machine.owner.MachineOwner; import com.gregtechceu.gtceu.common.machine.owner.PlayerOwner; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; @@ -99,7 +100,7 @@ public class MetaMachine implements IEnhancedManaged, IToolable, ITickSubscription, IToolGridHighlight, IFancyTooltip, IPaintable, IRedstoneSignalMachine, ICopyable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MetaMachine.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MetaMachine.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @Setter @@ -142,7 +143,7 @@ public MetaMachine(IMachineBlockEntity holder) { @Override public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java index f7b9f2e3c68..05b29418a7b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java @@ -34,7 +34,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.Util; @@ -69,9 +68,6 @@ public class SimpleTieredMachine extends WorkableTieredMachine implements IAutoOutputBoth, IFancyUIMachine, IHasCircuitSlot { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleTieredMachine.class, - WorkableTieredMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @RequireRerender @@ -121,11 +117,6 @@ public SimpleTieredMachine(IMachineBlockEntity holder, int tier, Int2IntFunction ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected CustomItemStackHandler createChargerItemHandler(Object... args) { var handler = new CustomItemStackHandler() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java index 92e5ed60b36..ac7e3ae5adb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java @@ -13,7 +13,6 @@ import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.util.Mth; @@ -24,8 +23,6 @@ @MethodsReturnNonnullByDefault public class TieredEnergyMachine extends TieredMachine implements ITieredMachine, IExplosionMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredEnergyMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); @Persisted @DescSynced public final NotifiableEnergyContainer energyContainer; @@ -39,11 +36,6 @@ public TieredEnergyMachine(IMachineBlockEntity holder, int tier, Object... args) ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableEnergyContainer createEnergyContainer(Object... args) { long tierVoltage = GTValues.V[tier]; if (isEnergyEmitter()) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java index df32c32c7bd..edd94616828 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java @@ -10,7 +10,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.mojang.blaze3d.MethodsReturnNonnullByDefault; import it.unimi.dsi.fastutil.ints.Int2IntFunction; @@ -30,9 +29,6 @@ public abstract class WorkableTieredMachine extends TieredEnergyMachine implements IRecipeLogicMachine, IMachineLife, IMufflableMachine, IOverclockMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(WorkableTieredMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @@ -98,11 +94,6 @@ public WorkableTieredMachine(IMachineBlockEntity holder, int tier, Int2IntFuncti ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableEnergyContainer createEnergyContainer(Object... args) { long tierVoltage = GTValues.V[getTier()]; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java index 44a162c65a0..87224a3f499 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java @@ -18,7 +18,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -49,8 +48,6 @@ @MethodsReturnNonnullByDefault public class MultiblockControllerMachine extends MetaMachine implements IMultiController { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MultiblockControllerMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); private MultiblockState multiblockState; private final List parts = new ArrayList<>(); private @Nullable IParallelHatch parallelHatch = null; @@ -76,11 +73,6 @@ public MultiblockControllerMachine(IMachineBlockEntity holder) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public MultiblockMachineDefinition getDefinition() { return (MultiblockMachineDefinition) super.getDefinition(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java index b3fa9310bee..062af0082d0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; @@ -19,9 +18,6 @@ public class TieredWorkableElectricMultiblockMachine extends WorkableElectricMultiblockMachine implements ITieredMachine, IOverclockMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - TieredWorkableElectricMultiblockMachine.class, WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); - private final int tier; @Persisted @Getter @@ -35,10 +31,6 @@ public TieredWorkableElectricMultiblockMachine(IMachineBlockEntity holder, int t ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } ////////////////////////////////////// // ******** OVERCLOCK *********// diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java index 1273ced2670..621af770699 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java @@ -23,7 +23,6 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -43,8 +42,6 @@ public class WorkableElectricMultiblockMachine extends WorkableMultiblockMachine implements IFancyUIMachine, IDisplayUIMachine, ITieredMachine, IOverclockMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - WorkableElectricMultiblockMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); // runtime protected EnergyContainerList energyContainer; @Getter @@ -57,11 +54,6 @@ public WorkableElectricMultiblockMachine(IMachineBlockEntity holder, Object... a super(holder, args); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ////////////////////////////////////// // *** Multiblock Lifecycle ***// ////////////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java index 5d15879b1b0..e13eb1a6cdb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java @@ -21,7 +21,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -47,8 +46,6 @@ public abstract class WorkableMultiblockMachine extends MultiblockControllerMachine implements IWorkableMultiController, IMufflableMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - WorkableMultiblockMachine.class, MultiblockControllerMachine.MANAGED_FIELD_HOLDER); @Nullable @Getter @Setter @@ -97,11 +94,6 @@ public WorkableMultiblockMachine(IMachineBlockEntity holder, Object... args) { // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onUnload() { super.onUnload(); 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 4d0f47585c1..7e9b0192ae4 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 @@ -13,7 +13,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -39,9 +38,6 @@ @MethodsReturnNonnullByDefault public class MultiblockPartMachine extends MetaMachine implements IMultiPart { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockPartMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); - @DescSynced @UpdateListener(methodName = "onControllersUpdated") protected final Set controllerPositions = new ObjectOpenHashSet<>(8); @@ -57,11 +53,6 @@ public MultiblockPartMachine(IMachineBlockEntity holder) { // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public boolean hasController(BlockPos controllerPos) { return controllerPositions.contains(controllerPos); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java index d0bc262c0f7..a229881211c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java @@ -7,7 +7,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; @@ -21,9 +20,6 @@ @MethodsReturnNonnullByDefault public class TieredIOPartMachine extends TieredPartMachine implements IControllable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredIOPartMachine.class, - MultiblockPartMachine.MANAGED_FIELD_HOLDER); - protected final IO io; /** @@ -46,11 +42,6 @@ public TieredIOPartMachine(IMachineBlockEntity holder, int tier, IO io) { // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Nullable @Override public PageGroupingData getPageGroupingData() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java index e34ee2d0277..2e2ba9f8e44 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java @@ -26,7 +26,6 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -48,9 +47,6 @@ @MethodsReturnNonnullByDefault public class SimpleSteamMachine extends SteamWorkableMachine implements IExhaustVentMachine, IUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleSteamMachine.class, - SteamWorkableMachine.MANAGED_FIELD_HOLDER); - @Persisted public final NotifiableItemStackHandler importItems; @Persisted @@ -76,11 +72,6 @@ public SimpleSteamMachine(IMachineBlockEntity holder, boolean isHighPressure, Ob // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableFluidTank createSteamTank(Object... args) { return new NotifiableFluidTank(this, 1, 16 * FluidType.BUCKET_VOLUME, IO.IN); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java index 36357ef0e81..2f11290a4e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java @@ -30,7 +30,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.resources.language.I18n; @@ -70,9 +69,6 @@ public abstract class SteamBoilerMachine extends SteamWorkableMachine implements IUIMachine, IExplosionMachine, IDataInfoProvider, IInteractedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamBoilerMachine.class, - SteamWorkableMachine.MANAGED_FIELD_HOLDER); - @Persisted public final NotifiableFluidTank waterTank; @Persisted @@ -98,11 +94,6 @@ public SteamBoilerMachine(IMachineBlockEntity holder, boolean isHighPressure, Ob ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableFluidTank createSteamTank(Object... args) { return new NotifiableFluidTank(this, 1, 16 * FluidType.BUCKET_VOLUME, IO.OUT); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java index 52e8fc65de9..79e5373b618 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java @@ -8,7 +8,6 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.level.block.state.properties.BooleanProperty; @@ -21,9 +20,6 @@ @MethodsReturnNonnullByDefault public abstract class SteamMachine extends MetaMachine implements ITieredMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); - public static final BooleanProperty STEEL_PROPERTY = GTMachineModelProperties.IS_STEEL_MACHINE; @Getter @@ -41,11 +37,6 @@ public SteamMachine(IMachineBlockEntity holder, boolean isHighPressure, Object.. ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public int getTier() { return isHighPressure ? 1 : 0; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java index 5721c0a9435..90bf104758c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java @@ -21,7 +21,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -47,8 +46,6 @@ public abstract class SteamWorkableMachine extends SteamMachine implements IRecipeLogicMachine, IMufflableMachine, IMachineLife { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamWorkableMachine.class, - SteamMachine.MANAGED_FIELD_HOLDER); @Nullable @Getter @Setter @@ -92,11 +89,6 @@ public SteamWorkableMachine(IMachineBlockEntity holder, boolean isHighPressure, ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onLoad() { super.onLoad(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java index 19fa260639b..607ae9ca84b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java @@ -5,8 +5,6 @@ import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; import com.gregtechceu.gtceu.utils.GTTransferUtils; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraftforge.fluids.FluidStack; @@ -18,7 +16,6 @@ @Accessors(chain = true) public class FluidTankProxyTrait extends MachineTrait implements IFluidHandlerModifiable, ICapabilityTrait { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidTankProxyTrait.class); @Getter public final IO capabilityIO; @Setter @@ -30,11 +27,6 @@ public FluidTankProxyTrait(MetaMachine machine, IO capabilityIO) { this.capabilityIO = capabilityIO; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ////////////////////////////////////// // ******* Capability ********// ////////////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java index 169ef746b3d..b2bb0a8e7e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java @@ -4,8 +4,6 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.utils.GTTransferUtils; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; @@ -19,7 +17,6 @@ @Accessors(chain = true) public class ItemHandlerProxyTrait extends MachineTrait implements IItemHandlerModifiable, ICapabilityTrait { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemHandlerProxyTrait.class); @Getter public final IO capabilityIO; @Setter @@ -32,11 +29,6 @@ public ItemHandlerProxyTrait(MetaMachine machine, IO capabilityIO) { this.capabilityIO = capabilityIO; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ////////////////////////////////////// // ******* Capability ********// ////////////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java index 1b9faabef81..551d954de38 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java @@ -5,6 +5,9 @@ import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; +import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -23,6 +26,8 @@ */ public abstract class MachineTrait implements IEnhancedManaged { + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MachineTrait.class); + @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @@ -37,6 +42,11 @@ public MachineTrait(MetaMachine machine) { machine.attachTraits(this); } + @Override + public ManagedFieldHolder getFieldHolder() { + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); + } + public final boolean hasCapability(@Nullable Direction side) { return capabilityValidator.test(side); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java index a8cf22eccad..441e18e18f5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java @@ -19,8 +19,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; @@ -36,8 +34,6 @@ public class NotifiableEnergyContainer extends NotifiableRecipeHandlerTrait implements IEnergyContainer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - NotifiableEnergyContainer.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter protected IO handlerIO; @Getter @@ -97,11 +93,6 @@ public void resetBasicInfo(long maxCapacity, long maxInputVoltage, long maxInput checkOutputSubscription(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onMachineLoad() { super.onMachineLoad(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java index 85905c71f6e..0f82399dafd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidType; @@ -28,8 +26,6 @@ public class NotifiableFluidTank extends NotifiableRecipeHandlerTrait implements ICapabilityTrait, IFluidHandlerModifiable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableFluidTank.class, - NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter public final IO handlerIO; @Getter @@ -86,11 +82,6 @@ public void onContentsChanged() { notifyListeners(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public List handleRecipeInner(IO io, GTRecipe recipe, List left, boolean simulate) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index 7ca88ea0321..898c8ad4aab 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -15,8 +15,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; @@ -37,8 +35,6 @@ public class NotifiableItemStackHandler extends NotifiableRecipeHandlerTrait implements ICapabilityTrait, IItemHandlerModifiable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - NotifiableItemStackHandler.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter public final IO handlerIO; @Getter @@ -79,11 +75,6 @@ public void onContentsChanged() { notifyListeners(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public List handleRecipeInner(IO io, GTRecipe recipe, List left, boolean simulate) { return handleRecipe(io, recipe, left, simulate, handlerIO, storage); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java index b1e65e8fb10..23229f60c2d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java @@ -5,16 +5,11 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; public class NotifiableLaserContainer extends NotifiableEnergyContainer implements ILaserContainer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - NotifiableEnergyContainer.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); - public NotifiableLaserContainer(MetaMachine machine, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { super(machine, maxCapacity, maxInputVoltage, maxInputAmperage, maxOutputVoltage, maxOutputAmperage); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java index 476a92cccc6..b4931a6b650 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java @@ -5,8 +5,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import lombok.Getter; import lombok.Setter; @@ -15,8 +13,6 @@ public abstract class NotifiableRecipeHandlerTrait extends MachineTrait implements IRecipeHandlerTrait { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - NotifiableRecipeHandlerTrait.class); protected List listeners = new ArrayList<>(); @Persisted @@ -29,11 +25,6 @@ public NotifiableRecipeHandlerTrait(MetaMachine machine) { super(machine); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public ISubscription addChangedListener(Runnable listener) { listeners.add(listener); 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 be3e9db4728..661c52dee19 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 @@ -26,8 +26,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; @@ -65,8 +63,6 @@ public enum Status implements StringRepresentable { } public static final EnumProperty STATUS_PROPERTY = GTMachineModelProperties.RECIPE_LOGIC_STATUS; - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RecipeLogic.class); - public final IRecipeLogicMachine machine; public @Nullable List lastFailedMatches; @@ -573,11 +569,6 @@ public void interruptRecipe() { // Remains for legacy + for subclasses public void inValid() {} - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ////////////////////////////////////// // ******** MISC *********// ////////////////////////////////////// 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 decb3be4929..0be85f8f182 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java @@ -19,6 +19,8 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -33,7 +35,7 @@ public class PipeCoverContainer implements ICoverable, IEnhancedManaged { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PipeCoverContainer.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(PipeCoverContainer.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); private final IPipeNode pipeTile; @@ -59,7 +61,7 @@ private void onCoverSet(CoverBehavior newValue, CoverBehavior oldValue) { @Override public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; + return ManagedFieldHolderMap.getManagedFieldHolder(getClass()); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java index 9845dd66447..33b83cfedd2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java @@ -21,8 +21,6 @@ import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -51,9 +49,6 @@ @MethodsReturnNonnullByDefault public class CableBlockEntity extends PipeBlockEntity implements IDataInfoProvider { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CableBlockEntity.class, - PipeBlockEntity.MANAGED_FIELD_HOLDER); - protected WeakReference currentEnergyNet = new WeakReference<>(null); private static final int meltTemp = 3000; @@ -334,11 +329,6 @@ public GTToolType getPipeTuneTool() { return GTToolType.WIRE_CUTTER; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public @NotNull List getDataInfo(PortableScannerBehavior.DisplayMode mode) { List list = new ArrayList<>(); 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 ba2ff20ed92..c598a7ee79e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java @@ -24,8 +24,6 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -53,9 +51,6 @@ public class ComputerMonitorCover extends CoverBehavior implements IUICover, IDataStickInteractable, IPlaceholderInfoProviderCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ComputerMonitorCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - private TickableSubscription subscription; private final CoverTextRenderer renderer; @Persisted @@ -128,11 +123,6 @@ public Supplier getDynamicRenderer() { return () -> renderer; } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public Widget createUIWidget() { int textFieldWidth = 160, horizontalPadding = 10, verticalPadding = 2; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java index 618016bab5c..13748a348ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java @@ -31,7 +31,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import net.minecraft.MethodsReturnNonnullByDefault; @@ -64,9 +63,6 @@ @MethodsReturnNonnullByDefault public class ConveyorCover extends CoverBehavior implements IIOCover, IUICover, IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConveyorCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - // 8 32 128 512 1024 public static final Int2IntFunction CONVEYOR_SCALING = tier -> 2 * (int) Math.pow(4, Math.min(tier, GTValues.LuV)); @@ -138,11 +134,6 @@ protected boolean isSubscriptionActive() { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public boolean canAttach() { return super.canAttach() && getOwnItemHandler() != null; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java index c4aad91ea87..8e0f0ebcb34 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java @@ -8,8 +8,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -28,8 +26,6 @@ @MethodsReturnNonnullByDefault public class FacadeCover extends CoverBehavior { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FacadeCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); @Setter @Getter @DescSynced @@ -41,11 +37,6 @@ public FacadeCover(CoverDefinition definition, ICoverable coverHolder, Direction super(definition, coverHolder, attachedSide); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onAttached(ItemStack itemStack, @Nullable ServerPlayer player) { super.onAttached(itemStack, player); 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 b2365d8e23f..37600d3eead 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java @@ -16,8 +16,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -35,8 +33,6 @@ @MethodsReturnNonnullByDefault public class FluidFilterCover extends CoverBehavior implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidFilterCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); protected FluidFilter fluidFilter; @Persisted @DescSynced @@ -93,11 +89,6 @@ public Widget createUIWidget() { return group; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private class FilteredFluidHandlerWrapper extends FluidHandlerDelegate { public FilteredFluidHandlerWrapper(IFluidHandlerModifiable delegate) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java index f9d17083340..bc6039e2b0b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java @@ -14,8 +14,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -33,9 +31,6 @@ @MethodsReturnNonnullByDefault public class FluidRegulatorCover extends PumpCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidRegulatorCover.class, - PumpCover.MANAGED_FIELD_HOLDER); - private static final int MAX_STACK_SIZE = 2_048_000_000; // Capacity of quantum tank IX @Persisted @@ -65,11 +60,6 @@ public FluidRegulatorCover(CoverDefinition definition, ICoverable coverHolder, D this(definition, coverHolder, attachedSide, tier, PUMP_SCALING.applyAsInt(tier)); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ////////////////////////////////////// // ***** Transfer Logic ******// ////////////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java index 107de2a3ea8..7b009c42787 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java @@ -18,8 +18,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -38,9 +36,6 @@ @MethodsReturnNonnullByDefault public class ItemFilterCover extends CoverBehavior implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemFilterCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - protected ItemFilter itemFilter; @Persisted @DescSynced @@ -104,11 +99,6 @@ public Widget createUIWidget() { return group; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private class FilteredItemHandlerWrapper extends ItemHandlerDelegate { public FilteredItemHandlerWrapper(IItemHandlerModifiable delegate) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java index 4e9299bfda2..128de08948d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java @@ -22,8 +22,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -49,16 +47,9 @@ @MethodsReturnNonnullByDefault public class MachineControllerCover extends CoverBehavior implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MachineControllerCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); private CustomItemStackHandler sideCoverSlot; private ButtonWidget modeButton; - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Persisted @Getter private boolean isInverted = false; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java index 00cc21e2c36..e1f2edbdcca 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java @@ -28,8 +28,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -57,9 +55,6 @@ @MethodsReturnNonnullByDefault public class PumpCover extends CoverBehavior implements IIOCover, IUICover, IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PumpCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - // .5b 2b 8b public static final Int2IntFunction PUMP_SCALING = tier -> 64 * (int) Math.pow(4, Math.min(tier - 1, GTValues.IV)); @@ -132,11 +127,6 @@ protected boolean isSubscriptionActive() { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public boolean canAttach() { return super.canAttach() && getOwnFluidHandler() != null; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java index 76cd60fc8cb..bce0261644d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -35,9 +33,6 @@ @MethodsReturnNonnullByDefault public class RobotArmCover extends ConveyorCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RobotArmCover.class, - ConveyorCover.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @Getter @@ -61,11 +56,6 @@ public RobotArmCover(CoverDefinition definition, ICoverable coverHolder, Directi this(definition, coverHolder, attachedSide, tier, CONVEYOR_SCALING.applyAsInt(tier)); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected int doTransferItems(IItemHandler itemHandler, IItemHandler myItemHandler, int maxTransferAmount) { if (io == IO.OUT && itemHandler instanceof ItemNetHandler && transferMode == TransferMode.KEEP_EXACT) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java index e1be88cf33d..94aef1a5f48 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java @@ -7,8 +7,6 @@ import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -29,9 +27,6 @@ @MethodsReturnNonnullByDefault public class ShutterCover extends CoverBehavior implements IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ShutterCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - @Persisted @Getter @Setter @@ -72,8 +67,4 @@ public InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand return isWorkingEnabled() ? null : super.getFluidHandlerCap(defaultValue); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } 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 7094e0f18a1..faea038ea92 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/StorageCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/StorageCover.java @@ -16,7 +16,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import net.minecraft.core.Direction; @@ -35,9 +34,6 @@ public class StorageCover extends CoverBehavior implements IUICover { public final CustomItemStackHandler inventory; private final int SIZE = 18; - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(StorageCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - public StorageCover(@NotNull CoverDefinition definition, @NotNull ICoverable coverableView, @NotNull Direction attachedSide) { super(definition, coverableView, attachedSide); @@ -50,12 +46,6 @@ public int getSlotLimit(int slot) { }; } - @Override - @NotNull - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override @NotNull public List getAdditionalDrops() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java index 1eafece311d..8be1a0a88dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java @@ -6,8 +6,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IDataStickInteractable; import com.gregtechceu.gtceu.api.placeholder.IPlaceholderInfoProviderCover; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.ComponentContents; @@ -28,9 +26,6 @@ public class WirelessTransmitterCover extends CoverBehavior implements IDataStickInteractable, IPlaceholderInfoProviderCover { - private static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - WirelessTransmitterCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); - @Getter private final List createDisplayTargetBuffer = new ArrayList<>(); @Getter @@ -69,8 +64,4 @@ public void setComputerCraftTextBufferLine(int line, MutableComponent component) computerCraftTextBuffer.set(line, component); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java index 25f753d1c09..8c2b99e3d94 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java @@ -15,7 +15,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import net.minecraft.MethodsReturnNonnullByDefault; @@ -37,14 +36,6 @@ @MethodsReturnNonnullByDefault public class AdvancedEnergyDetectorCover extends EnergyDetectorCover implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - AdvancedEnergyDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private static final int DEFAULT_MIN_PERCENT = 33; private static final int DEFAULT_MAX_PERCENT = 66; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java index 910d2fdc478..5f0b5338ffb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java @@ -16,7 +16,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import net.minecraft.MethodsReturnNonnullByDefault; @@ -42,14 +41,6 @@ @MethodsReturnNonnullByDefault public class AdvancedFluidDetectorCover extends FluidDetectorCover implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - AdvancedFluidDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private static final int DEFAULT_MIN = 64; private static final int DEFAULT_MAX = 512; @Persisted diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java index 252cbe915a7..18c558ebf24 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java @@ -17,7 +17,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import net.minecraft.MethodsReturnNonnullByDefault; @@ -39,14 +38,6 @@ @MethodsReturnNonnullByDefault public class AdvancedItemDetectorCover extends ItemDetectorCover implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - AdvancedItemDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private static final int DEFAULT_MIN = 64; private static final int DEFAULT_MAX = 512; @Persisted 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 b03a02829fe..0a754107cf2 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 @@ -8,8 +8,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -29,14 +27,6 @@ @MethodsReturnNonnullByDefault public abstract class DetectorCover extends CoverBehavior implements IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DetectorCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Persisted @Getter @Setter diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java index 1b16df60c9c..ff9bc563caf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java @@ -28,8 +28,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.ChatFormatting; import net.minecraft.core.Direction; import net.minecraft.network.FriendlyByteBuf; @@ -49,8 +47,6 @@ public abstract class AbstractEnderLinkCover extends CoverBehavior implements IUICover, IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AbstractEnderLinkCover.class, - CoverBehavior.MANAGED_FIELD_HOLDER); public static final Pattern COLOR_INPUT_PATTERN = Pattern.compile("^[0-9a-fA-F]{0,8}$"); protected final ConditionalSubscriptionHandler subscriptionHandler; @@ -136,11 +132,6 @@ public Widget createUIWidget() { return virtualEntryWidget; } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - public void setIo(IO io) { if (io == IO.IN || io == IO.OUT) { this.io = io; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java index f4660d14df0..a5308203a53 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java @@ -17,8 +17,6 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; @@ -32,8 +30,6 @@ @ParametersAreNonnullByDefault public class EnderFluidLinkCover extends AbstractEnderLinkCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(EnderFluidLinkCover.class, - AbstractEnderLinkCover.MANAGED_FIELD_HOLDER); public static final int TRANSFER_RATE = 8000; // mB/t @Persisted @@ -112,11 +108,6 @@ private int doTransferFluids(int platformTransferLimit) { return 0; } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ////////////////////////////////////// // ************ GUI ************ // ////////////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java index f3a9b418fc6..8681906a8b4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java @@ -16,8 +16,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -28,9 +26,6 @@ public class EnderItemLinkCover extends AbstractEnderLinkCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(EnderItemLinkCover.class, - AbstractEnderLinkCover.MANAGED_FIELD_HOLDER); - protected static final int TRANSFER_RATE = 8; @Persisted @@ -114,8 +109,4 @@ protected String getUITitle() { return "cover.ender_item_link.title"; } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java index 919d907a63d..699ac8291df 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java @@ -10,8 +10,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import org.jetbrains.annotations.NotNull; @@ -20,9 +18,6 @@ public class EnderRedstoneLinkCover extends AbstractEnderLinkCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(EnderRedstoneLinkCover.class, - AbstractEnderLinkCover.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced private VirtualRedstone storage; @@ -99,8 +94,4 @@ protected int getSignalInput() { attachedSide.getOpposite()); } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java index ea2c8bc8466..65c14f6f2d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java @@ -15,8 +15,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -181,14 +179,6 @@ private boolean shouldShowStackSize() { // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - AdvancedFluidVoidingCover.class, FluidVoidingCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public CompoundTag copyConfig(CompoundTag tag) { tag.putInt("voidingMode", getVoidingMode().ordinal()); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java index b00bd9c5a41..642e202263d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java @@ -12,8 +12,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -161,14 +159,6 @@ private boolean shouldShowStackSize() { // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedItemVoidingCover.class, - ItemVoidingCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public CompoundTag copyConfig(CompoundTag tag) { tag.putInt("voidingMode", getVoidingMode().ordinal()); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java index e6580e6ed78..31127f8e14c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -142,11 +140,4 @@ public boolean shouldRenderGrid(Player player, BlockPos pos, BlockState state, I // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidVoidingCover.class, - PumpCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java index a1ec57e81f0..53fd3ad8735 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java @@ -14,8 +14,6 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -140,11 +138,4 @@ public boolean shouldRenderGrid(Player player, BlockPos pos, BlockState state, I // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemVoidingCover.class, - ConveyorCover.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java index 2b2ea3648d9..26ee42be982 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java @@ -22,7 +22,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -44,9 +43,6 @@ public class BatteryBufferMachine extends TieredEnergyMachine public static final long AMPS_PER_BATTERY = 2L; - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BatteryBufferMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Persisted @Getter private boolean isWorkingEnabled; @@ -67,11 +63,6 @@ public BatteryBufferMachine(IMachineBlockEntity holder, int tier, int inventoryS ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableEnergyContainer createEnergyContainer(Object... args) { return new EnergyBatteryTrait((int) args[0]); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java index d04b1099b89..555717d84e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java @@ -28,7 +28,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -64,9 +63,6 @@ public class BlockBreakerMachine extends TieredEnergyMachine implements IAutoOutputItem, IFancyUIMachine, IMachineLife, IControllable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BlockBreakerMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @@ -123,11 +119,6 @@ else if (efficiencyMultiplier < .1f) // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected CustomItemStackHandler createChargerItemHandler() { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java index 42f2f43d870..7d8411392bf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java @@ -21,7 +21,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -45,9 +44,6 @@ public class ChargerMachine extends TieredEnergyMachine implements IControllable public static final long AMPS_PER_ITEM = 4L; - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ChargerMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - public enum State implements StringRepresentable { IDLE("idle"), @@ -90,11 +86,6 @@ public ChargerMachine(IMachineBlockEntity holder, int tier, int inventorySize, O ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableEnergyContainer createEnergyContainer(Object... args) { return new EnergyBatteryTrait((int) args[0]); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java index 0a2e4f57c08..529e3e0abf9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java @@ -11,8 +11,6 @@ import com.gregtechceu.gtceu.common.machine.trait.ConverterTrait; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -34,9 +32,6 @@ @MethodsReturnNonnullByDefault public class ConverterMachine extends TieredEnergyMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConverterMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - public static final BooleanProperty FE_TO_EU_PROPERTY = GTMachineModelProperties.IS_FE_TO_EU; public ConverterMachine(IMachineBlockEntity holder, int tier, int amps, Object... args) { @@ -46,11 +41,6 @@ public ConverterMachine(IMachineBlockEntity holder, int tier, int amps, Object.. ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableEnergyContainer createEnergyContainer(Object... args) { if (args.length > 0 && args[args.length - 1] instanceof Integer ampsValue) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java index 234bf29d9d7..30c7116a969 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java @@ -30,7 +30,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -74,9 +73,6 @@ public class FisherMachine extends TieredEnergyMachine implements IAutoOutputItem, IFancyUIMachine, IMachineLife, IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FisherMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @@ -156,11 +152,6 @@ protected CustomItemStackHandler createChargerItemHandler() { return handler; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableItemStackHandler createCacheItemHandler() { return new NotifiableItemStackHandler(this, inventorySize, IO.BOTH, IO.OUT); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java index 4f5c9d06f9e..a7715b93aa8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java @@ -12,8 +12,6 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -29,9 +27,6 @@ @MethodsReturnNonnullByDefault public class HullMachine extends TieredPartMachine implements IMonitorComponent { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HullMachine.class, - MultiblockPartMachine.MANAGED_FIELD_HOLDER); - private final Object gridNodeHost; @Persisted protected NotifiableEnergyContainer energyContainer; @@ -79,11 +74,6 @@ public void setFrontFacing(Direction facing) { } } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void saveCustomPersistedData(@NotNull CompoundTag tag, boolean forDrop) { super.saveCustomPersistedData(tag, forDrop); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java index 3da4764c093..60b64311bd9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java @@ -32,7 +32,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -71,9 +70,6 @@ public class ItemCollectorMachine extends TieredEnergyMachine implements IAutoOutputItem, IFancyUIMachine, IMachineLife, IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemCollectorMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Getter private static final int[] INVENTORY_SIZES = { 4, 9, 16, 25, 25 }; private static final double MOTION_MULTIPLIER = 0.04; @@ -161,11 +157,6 @@ protected CustomItemStackHandler createFilterItemHandler() { return handler; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableItemStackHandler createOutputItemHandler() { return new NotifiableItemStackHandler(this, inventorySize, IO.BOTH, IO.OUT); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java index 7e40071abd2..e43d523aa6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java @@ -33,7 +33,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; @@ -71,9 +70,6 @@ public class MinerMachine extends WorkableTieredMachine implements IMiner, IControllable, IFancyUIMachine, IDataInfoProvider, IAutoOutputItem { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MinerMachine.class, - WorkableTieredMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @@ -109,11 +105,6 @@ public MinerMachine(IMachineBlockEntity holder, int tier, int speed, int maximum // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected CustomItemStackHandler createChargerItemHandler(Object... args) { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java index 3e3d14f65bc..f1fb40b23e4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java @@ -23,8 +23,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; import net.minecraft.core.BlockPos; @@ -62,8 +60,6 @@ @MethodsReturnNonnullByDefault public class PumpMachine extends TieredEnergyMachine implements IAutoOutputFluid, IUIMachine, IMachineLife { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PumpMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); public static final int BASE_PUMP_RADIUS = 16; public static final int EXTRA_PUMP_RADIUS = 4; public static final int PUMP_SPEED_BASE = 80; @@ -90,11 +86,6 @@ public PumpMachine(IMachineBlockEntity holder, int tier, Object... args) { ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableFluidTank createCacheFluidHandler(Object... args) { return new NotifiableFluidTank(this, 1, 16 * FluidType.BUCKET_VOLUME * Math.max(1, getTier()), IO.NONE, IO.OUT); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java index 0e8cf1afcb3..969396dce98 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java @@ -10,8 +10,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -30,9 +28,6 @@ @MethodsReturnNonnullByDefault public class TransformerMachine extends TieredEnergyMachine implements IControllable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TransformerMachine.class, - TieredEnergyMachine.MANAGED_FIELD_HOLDER); - public static final BooleanProperty TRANSFORM_UP_PROPERTY = GTMachineModelProperties.IS_TRANSFORM_UP; @Persisted @@ -56,11 +51,6 @@ public TransformerMachine(IMachineBlockEntity holder, int tier, int baseAmp, Obj ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @SuppressWarnings("unused") private void onTransformUpdated(boolean newValue, boolean oldValue) { updateEnergyContainer(newValue); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java index 01692defe8c..54bdd3592a1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java @@ -20,8 +20,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -59,8 +57,6 @@ public class WorldAcceleratorMachine extends TieredEnergyMachine implements ICon public static final BooleanProperty RANDOM_TICK_PROPERTY = GTMachineModelProperties.IS_RANDOM_TICK_MODE; - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - WorldAcceleratorMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); private static final long blockEntityAmperage = 6; private static final long randomTickAmperage = 3; // Variables for Random Tick mode optimization @@ -98,11 +94,6 @@ public WorldAcceleratorMachine(IMachineBlockEntity holder, int tier, Object... a return new NotifiableEnergyContainer(this, tierVoltage * 256L, tierVoltage, 8, 0L, 0L); } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - public void updateSubscription() { if (isWorkingEnabled && drainEnergy(true)) { tickSubs = subscribeServerTick(tickSubs, this::update); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java index 2c579be5fcb..3e280efa678 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java @@ -38,8 +38,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -67,9 +65,6 @@ public class CentralMonitorMachine extends WorkableElectricMultiblockMachine implements IMonitorComponent, IDataInfoProvider, IMachineLife, ICentralMonitor { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CentralMonitorMachine.class, - WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @Getter @@ -106,11 +101,6 @@ public static TraceabilityPredicate getMultiPredicate() { return MULTI_PREDICATE; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onStructureInvalid() { super.onStructureInvalid(); 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 51ddb521f98..c9030c6f8bc 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 @@ -42,7 +42,6 @@ import com.gregtechceu.gtceu.utils.GTUtil; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.BlockInfo; import net.minecraft.ChatFormatting; @@ -80,9 +79,6 @@ public class CleanroomMachine extends WorkableElectricMultiblockMachine implements ICleanroomProvider, IDisplayUIMachine, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CleanroomMachine.class, - WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); - public static final int CLEAN_AMOUNT_THRESHOLD = 95; public static final int MIN_CLEAN_AMOUNT = 0; @@ -111,11 +107,6 @@ public CleanroomMachine(IMachineBlockEntity metaTileEntityId) { // ****** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected RecipeLogic createRecipeLogic(Object... args) { return new CleanroomLogic(this); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java index f1409069226..eaf6a985a86 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java @@ -27,7 +27,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import net.minecraft.MethodsReturnNonnullByDefault; @@ -57,9 +56,6 @@ @MethodsReturnNonnullByDefault public class FusionReactorMachine extends WorkableElectricMultiblockMachine implements ITieredMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FusionReactorMachine.class, - WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); - // Standard OC used for Fusion public static final OverclockingLogic FUSION_OC = OverclockingLogic.create(PERFECT_HALF_DURATION_FACTOR, PERFECT_HALF_VOLTAGE_FACTOR, false); @@ -94,11 +90,6 @@ public FusionReactorMachine(IMachineBlockEntity holder, int tier) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - public NotifiableEnergyContainer createEnergyContainer() { // create an internal energy container for temp storage. its capacity is decided when the structure formed. // it doesn't provide any capability of all sides, but null for the goggles mod to check it storages. diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java index f2b776e41cb..b62fd09983d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java @@ -25,8 +25,6 @@ import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -59,8 +57,6 @@ public class LargeMinerMachine extends WorkableElectricMultiblockMachine implements IMiner, IControllable, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeMinerMachine.class, - WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); public static final int CHUNK_LENGTH = 16; @Getter private final int tier; @@ -90,11 +86,6 @@ public LargeMinerMachine(IMachineBlockEntity holder, int tier, int speed, int ma "MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public LargeMinerLogic getRecipeLogic() { return (LargeMinerLogic) super.getRecipeLogic(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java index b84bf2bf1b9..0bfd7e9df15 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java @@ -15,8 +15,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -104,11 +102,4 @@ private String getFluidLabel() { // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockTankMachine.class, - MultiblockControllerMachine.MANAGED_FIELD_HOLDER); - - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java index 769161fe634..0cf79a595da 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java @@ -25,8 +25,6 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.*; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -51,9 +49,6 @@ public class PowerSubstationMachine extends WorkableMultiblockMachine implements IEnergyInfoProvider, IFancyUIMachine, IDisplayUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - PowerSubstationMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); - // Structure Constants public static final int MAX_BATTERY_LAYERS = 18; public static final int MIN_CASINGS = 14; @@ -342,11 +337,6 @@ public boolean supportsBigIntEnergyValues() { return true; } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 182 + 8, 117 + 8); @@ -392,8 +382,6 @@ public void loadCustomPersistedData(@NotNull CompoundTag tag) { public static class PowerStationEnergyBank extends MachineTrait { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - PowerSubstationMachine.PowerStationEnergyBank.class); private static final String NBT_SIZE = "Size"; private static final String NBT_STORED = "Stored"; private static final String NBT_MAX = "Max"; @@ -568,10 +556,6 @@ public long getPassiveDrainPerTick() { .longValue(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } @Getter diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java index 9dd22537545..d3db461ce76 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java @@ -7,8 +7,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -26,9 +24,6 @@ @MethodsReturnNonnullByDefault public class LargeChemicalBathMachine extends WorkableElectricMultiblockMachine implements IFluidRenderMulti { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - LargeChemicalBathMachine.class, WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); - @Getter @Setter @DescSynced @@ -39,11 +34,6 @@ public LargeChemicalBathMachine(IMachineBlockEntity holder, Object... args) { super(holder, args); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onStructureFormed() { super.onStructureFormed(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java index 6ea69b2d342..5afc4dbb291 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java @@ -7,8 +7,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -26,9 +24,6 @@ @MethodsReturnNonnullByDefault public class LargeMixerMachine extends WorkableElectricMultiblockMachine implements IFluidRenderMulti { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - LargeMixerMachine.class, WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); - @Getter @Setter @DescSynced @@ -39,11 +34,6 @@ public LargeMixerMachine(IMachineBlockEntity holder, Object... args) { super(holder, args); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onStructureFormed() { super.onStructureFormed(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java index 6fbf139577e..931c8a4041d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java @@ -36,6 +36,8 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -380,10 +382,16 @@ private ChatFormatting getDisplayTemperatureColor() { // Handles the logic of this structure's specific HPCA component grid public static class HPCAGridHandler implements IManaged { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HPCAGridHandler.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(HPCAGridHandler.class); + @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); + @Override + public ManagedFieldHolder getFieldHolder() { + return MANAGED_FIELD_HOLDER; + } + @Nullable // for testing private final HPCAMachine controller; @@ -749,11 +757,6 @@ public void clearClientComponents() { components.clear(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onChanged() { controller.onChanged(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java index 0a403a92907..bff4c11cbc4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java @@ -26,8 +26,6 @@ import com.gregtechceu.gtceu.utils.GTMath; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -47,9 +45,6 @@ @MethodsReturnNonnullByDefault public class LargeCombustionEngineMachine extends WorkableElectricMultiblockMachine implements ITieredMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - LargeCombustionEngineMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); - private static final FluidStack OXYGEN_STACK = GTMaterials.Oxygen.getFluid(1); private static final FluidStack LIQUID_OXYGEN_STACK = GTMaterials.Oxygen.getFluid(FluidStorageKeys.LIQUID, 4); private static final FluidStack LUBRICANT_STACK = GTMaterials.Lubricant.getFluid(1); @@ -239,8 +234,4 @@ public void attachTooltips(TooltipsPanel tooltipsPanel) { () -> null)); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java index e4946d9a585..0b34a242d8c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java @@ -11,8 +11,6 @@ import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.lowdragmc.lowdraglib.syncdata.ISubscription; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -29,9 +27,6 @@ @MethodsReturnNonnullByDefault public class CokeOvenHatch extends MultiblockPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CokeOvenHatch.class, - MultiblockPartMachine.MANAGED_FIELD_HOLDER); - public final ItemHandlerProxyTrait inputInventory, outputInventory; public final FluidTankProxyTrait tank; @Nullable @@ -49,11 +44,6 @@ public CokeOvenHatch(IMachineBlockEntity holder, Object... args) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onUnload() { super.onUnload(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java index 3acbcf15885..d2c9dba8128 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java @@ -28,8 +28,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; @@ -52,9 +50,6 @@ public class DataAccessHatchMachine extends TieredPartMachine implements IMachineLife, IDataAccessHatch, IDataInfoProvider, IMonitorComponent { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - DataAccessHatchMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); - private final Set recipes; @Getter private final boolean isCreative; @@ -191,11 +186,6 @@ public GTRecipe modifyRecipe(GTRecipe recipe) { return IDataAccessHatch.super.modifyRecipe(recipe); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public IGuiTexture getComponentIcon() { return new ResourceTexture(GTCEu.id("textures/item/data_module.png")).getSubTexture(0, 0, 1, 1 / 13f); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java index 6ed52085002..a1f77f95750 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java @@ -10,8 +10,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -30,9 +28,6 @@ @MethodsReturnNonnullByDefault public class DiodePartMachine extends TieredIOPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DiodePartMachine.class, - TieredIOPartMachine.MANAGED_FIELD_HOLDER); - // spotless:off public enum AmpMode implements StringRepresentable { MODE_1A("1a", 1), @@ -146,11 +141,6 @@ protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand h return InteractionResult.CONSUME; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @SuppressWarnings("unused") public void onAmpUpdated(int newValue, int oldValue) { this.scheduleRenderUpdate(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java index 203c825859a..b0b3945352c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java @@ -15,8 +15,6 @@ import com.lowdragmc.lowdraglib.jei.IngredientIO; import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; @@ -31,9 +29,6 @@ public class DualHatchPartMachine extends ItemBusPartMachine { public static final int INITIAL_TANK_CAPACITY = 16 * FluidType.BUCKET_VOLUME; - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DualHatchPartMachine.class, - ItemBusPartMachine.MANAGED_FIELD_HOLDER); - @Persisted public final NotifiableFluidTank tank; @@ -189,8 +184,4 @@ public Widget createUIWidget() { return group; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java index a3225356a0f..4c238d3eb10 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java @@ -10,8 +10,6 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; @@ -25,9 +23,6 @@ @MethodsReturnNonnullByDefault public class EnergyHatchPartMachine extends TieredIOPartMachine implements IExplosionMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - EnergyHatchPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); - @Persisted public final NotifiableEnergyContainer energyContainer; protected TickableSubscription explosionSub; @@ -43,11 +38,6 @@ public EnergyHatchPartMachine(IMachineBlockEntity holder, int tier, IO io, int a ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableEnergyContainer createEnergyContainer(Object... args) { NotifiableEnergyContainer container; if (io == IO.OUT) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java index 03aa1050cd4..20e99d1fa1c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java @@ -29,8 +29,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -57,9 +55,6 @@ @MethodsReturnNonnullByDefault public class FluidHatchPartMachine extends TieredIOPartMachine implements IMachineLife, IHasCircuitSlot, IPaintable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidHatchPartMachine.class, - TieredIOPartMachine.MANAGED_FIELD_HOLDER); - public static final int INITIAL_TANK_CAPACITY_1X = 8 * FluidType.BUCKET_VOLUME; public static final int INITIAL_TANK_CAPACITY_4X = 2 * FluidType.BUCKET_VOLUME; public static final int INITIAL_TANK_CAPACITY_9X = FluidType.BUCKET_VOLUME; @@ -94,11 +89,6 @@ public FluidHatchPartMachine(IMachineBlockEntity holder, int tier, IO io, int in ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableFluidTank createTank(int initialCapacity, int slots, Object... args) { return new NotifiableFluidTank(this, slots, getTankCapacity(initialCapacity, getTier()), io); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java index f000c5cd05f..c5c36f535a3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java @@ -29,8 +29,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -59,8 +57,6 @@ public class ItemBusPartMachine extends TieredIOPartMachine implements IDistinctPart, IMachineLife, IHasCircuitSlot, IPaintable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemBusPartMachine.class, - TieredIOPartMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted private final NotifiableItemStackHandler inventory; @@ -98,11 +94,6 @@ public ItemBusPartMachine(IMachineBlockEntity holder, int tier, IO io, Object... ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected int getInventorySize() { int sizeRoot = 1 + Math.min(9, getTier()); return sizeRoot * sizeRoot; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java index f1a9d52366f..3a769521659 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java @@ -9,8 +9,6 @@ import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; @@ -27,9 +25,6 @@ @ParametersAreNonnullByDefault public class LaserHatchPartMachine extends TieredIOPartMachine implements IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LaserHatchPartMachine.class, - TieredIOPartMachine.MANAGED_FIELD_HOLDER); - @Persisted private NotifiableLaserContainer buffer; @@ -56,12 +51,6 @@ public boolean canShared() { return false; } - @Override - @NotNull - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java index aee050a0c43..03684d57881 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java @@ -23,8 +23,6 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -60,9 +58,6 @@ public class MaintenanceHatchPartMachine extends TieredPartMachine implements IMachineLife, IMaintenanceMachine, IInteractedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MaintenanceHatchPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); - private static final float MAX_DURATION_MULTIPLIER = 1.1f; private static final float MIN_DURATION_MULTIPLIER = 0.9f; private static final float DURATION_ACTION_AMOUNT = 0.01f; @@ -103,11 +98,6 @@ protected NotifiableItemStackHandler createInventory() { return new NotifiableItemStackHandler(this, 1, IO.BOTH, IO.BOTH); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onMachineRemoved() { clearInventory(itemStackHandler); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java index aa7cc47d1fb..60db93338e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java @@ -18,8 +18,6 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; @@ -39,8 +37,6 @@ @MethodsReturnNonnullByDefault public class MufflerPartMachine extends TieredPartMachine implements IMufflerMachine, IUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MufflerPartMachine.class, - MultiblockPartMachine.MANAGED_FIELD_HOLDER); @Getter private final int recoveryChance; @Getter @@ -58,10 +54,6 @@ public MufflerPartMachine(IMachineBlockEntity holder, int tier) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } ////////////////////////////////////// // ******** Muffler *********// diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java index 22ef0219ce9..ed219251deb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java @@ -19,7 +19,6 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -36,9 +35,6 @@ @MethodsReturnNonnullByDefault public class ObjectHolderMachine extends MultiblockPartMachine implements IObjectHolder, IMachineLife { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ObjectHolderMachine.class, - MultiblockPartMachine.MANAGED_FIELD_HOLDER); - // purposefully not exposed to automation or capabilities @Persisted private final ObjectHolderHandler heldItems; @@ -115,11 +111,6 @@ public void setFrontFacing(Direction frontFacing) { } } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private class ObjectHolderHandler extends NotifiableItemStackHandler { public ObjectHolderHandler(MetaMachine metaTileEntity) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java index ad8baf58b49..36644b85c67 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.util.Mth; import lombok.Getter; @@ -22,8 +20,6 @@ public class ParallelHatchPartMachine extends TieredPartMachine implements IFancyUIMachine, IParallelHatch { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - ParallelHatchPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); private static final int MIN_PARALLEL = 1; private final int maxParallel; @@ -57,12 +53,6 @@ public Widget createUIWidget() { return parallelAmountGroup; } - @Override - @NotNull - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public boolean canShared() { return false; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java index aed7a478e4b..dc2e2f5d984 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java @@ -22,8 +22,6 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; @@ -48,9 +46,6 @@ public class RotorHolderPartMachine extends TieredPartMachine implements IMachineLife, IRotorHolderMachine, IInteractedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - RotorHolderPartMachine.class, TieredPartMachine.MANAGED_FIELD_HOLDER); - @Persisted public final NotifiableItemStackHandler inventory; @Getter @@ -78,11 +73,6 @@ public RotorHolderPartMachine(IMachineBlockEntity holder, int tier) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onMachineRemoved() { clearInventory(inventory.storage); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java index 0c5c524c964..d36d20aaa2a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java @@ -11,8 +11,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; @@ -28,9 +26,6 @@ public abstract class HPCAComponentPartMachine extends MultiblockPartMachine implements IHPCAComponentHatch, IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - HPCAComponentPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @RequireRerender @@ -122,8 +117,4 @@ public void onDrops(List drops) { * return super.getMetaName(); * } */ - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java index fbb785ce4e1..ce9397adee7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java @@ -7,8 +7,6 @@ import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -25,9 +23,6 @@ @MethodsReturnNonnullByDefault public class AdvancedMonitorPartMachine extends MonitorPartMachine implements IInteractedMachine { - private static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - AdvancedMonitorPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted private double clickPosX; @@ -75,11 +70,6 @@ private void unsetClicked() { resetClickedNextTick = false; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onLoad() { super.onLoad(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CharcoalPileIgniterMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CharcoalPileIgniterMachine.java index b263a5efe86..cec2b1e2f79 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CharcoalPileIgniterMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CharcoalPileIgniterMachine.java @@ -16,7 +16,6 @@ import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.BlockInfo; import net.minecraft.core.BlockPos; @@ -51,10 +50,6 @@ public class CharcoalPileIgniterMachine extends WorkableMultiblockMachine implements IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - CharcoalPileIgniterMachine.class, - WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); - private static final int MIN_RADIUS = 1; private static final int MIN_DEPTH = 2; private static final int MAX_HEIGHT = 5; @@ -104,11 +99,6 @@ public void onStructureFormed() { return (CharcoalRecipeLogic) super.getRecipeLogic(); } - @Override - public @NotNull ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public boolean isActive() { return recipeLogic.isWorking(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java index fa933d9fc8f..50d0bc64718 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java @@ -22,8 +22,6 @@ import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -51,9 +49,6 @@ @MethodsReturnNonnullByDefault public class PrimitiveBlastFurnaceMachine extends PrimitiveWorkableMachine implements IUIMachine, IFluidRenderMulti { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - PrimitiveBlastFurnaceMachine.class, PrimitiveWorkableMachine.MANAGED_FIELD_HOLDER); - private TickableSubscription hurtSubscription; @Getter @@ -66,11 +61,6 @@ public PrimitiveBlastFurnaceMachine(IMachineBlockEntity holder, Object... args) super(holder, args); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected NotifiableItemStackHandler createImportItemHandler(Object... args) { return new NotifiableItemStackHandler(this, getRecipeType().getMaxInputs(ItemRecipeCapability.CAP), IO.IN, diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java index fb2dfd206d5..19bff9fb510 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java @@ -11,8 +11,6 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.level.biome.Biome.Precipitation; import net.minecraftforge.fluids.FluidType; @@ -25,9 +23,6 @@ @MethodsReturnNonnullByDefault public class PrimitivePumpMachine extends MultiblockControllerMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PrimitivePumpMachine.class, - MultiblockControllerMachine.MANAGED_FIELD_HOLDER); - private int biomeModifier = 0; private int hatchModifier = 0; private NotifiableFluidTank fluidTank; @@ -37,11 +32,6 @@ public PrimitivePumpMachine(IMachineBlockEntity holder) { super(holder); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onStructureFormed() { super.onStructureFormed(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java index e9ce4022838..5237820a39a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java @@ -11,8 +11,6 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraftforge.fluids.FluidType; @@ -23,9 +21,6 @@ public class PrimitiveWorkableMachine extends WorkableMultiblockMachine implements IMachineLife, IEnvironmentalHazardEmitter { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - PrimitiveWorkableMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); - @Persisted public final NotifiableItemStackHandler importItems; @Persisted @@ -46,11 +41,6 @@ public PrimitiveWorkableMachine(IMachineBlockEntity holder, Object... args) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableItemStackHandler createImportItemHandler(Object... args) { return new NotifiableItemStackHandler(this, getRecipeType().getMaxInputs(ItemRecipeCapability.CAP), IO.IN); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java index 42dbf15c317..cf42a24d6a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java @@ -23,8 +23,6 @@ import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -48,8 +46,6 @@ @MethodsReturnNonnullByDefault public class LargeBoilerMachine extends WorkableMultiblockMachine implements IExplosionMachine, IDisplayUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeBoilerMachine.class, - WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); public static final int TICKS_PER_STEAM_GENERATION = 5; @Getter @@ -68,11 +64,6 @@ public LargeBoilerMachine(IMachineBlockEntity holder, int maxTemperature, int he this.throttle = 100; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override protected RecipeLogic createRecipeLogic(Object... args) { return new LargeBoilerMachine.LargeBoilerRecipeLogic(this); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java index bd3526f738e..015553ab83e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java @@ -12,8 +12,6 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; @@ -40,8 +38,6 @@ @MethodsReturnNonnullByDefault public class SteamLiquidBoilerMachine extends SteamBoilerMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - SteamLiquidBoilerMachine.class, SteamBoilerMachine.MANAGED_FIELD_HOLDER); public static final Object2BooleanMap FUEL_CACHE = new Object2BooleanOpenHashMap<>(); @Persisted @@ -65,11 +61,6 @@ public SteamLiquidBoilerMachine(IMachineBlockEntity holder, boolean isHighPressu ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableFluidTank createFuelTank(Object... args) { return new NotifiableFluidTank(this, 1, 16 * FluidType.BUCKET_VOLUME, IO.IN); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java index 9e637bfd3b6..d69c965eef3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java @@ -19,8 +19,6 @@ import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -39,8 +37,6 @@ @MethodsReturnNonnullByDefault public class SteamSolidBoilerMachine extends SteamBoilerMachine implements IMachineLife { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - SteamSolidBoilerMachine.class, SteamBoilerMachine.MANAGED_FIELD_HOLDER); public static final Object2BooleanMap FUEL_CACHE = new Object2BooleanOpenHashMap<>(); @Persisted @@ -70,11 +66,6 @@ public SteamSolidBoilerMachine(IMachineBlockEntity holder, boolean isHighPressur ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableItemStackHandler createFuelHandler(Object... args) { return new NotifiableItemStackHandler(this, 1, IO.IN, IO.IN); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java index 19398d8d360..b12abe4d72f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java @@ -23,8 +23,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -46,9 +44,6 @@ @MethodsReturnNonnullByDefault public class BufferMachine extends TieredMachine implements IMachineLife, IAutoOutputBoth, IFancyUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BufferMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); - public static final int TANK_SIZE = 64000; @Getter @@ -104,11 +99,6 @@ public BufferMachine(IMachineBlockEntity holder, int tier, Object... args) { // ***** Initialization ******// //////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - public static int getInventorySize(int tier) { return (int) Math.pow(tier + 2, 2); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java index 7e1d337f1ee..d42f01fee58 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java @@ -17,8 +17,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -42,16 +40,8 @@ public class CrateMachine extends MetaMachine implements IUIMachine, IMachineLife, IDropSaveMachine, IInteractedMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CrateMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); - public static final BooleanProperty TAPED_PROPERTY = GTMachineModelProperties.IS_TAPED; - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Getter private final Material material; @Getter diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java index 7b8b7acb951..4edd263622b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; @@ -35,9 +33,6 @@ @MethodsReturnNonnullByDefault public class CreativeChestMachine extends QuantumChestMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeChestMachine.class, - QuantumChestMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DropSaved @@ -134,11 +129,6 @@ public Widget createUIWidget() { return group; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private class InfiniteCache extends ItemCache { public InfiniteCache(MetaMachine holder) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java index ce8a64fd97e..285b7ef9159 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java @@ -15,8 +15,6 @@ import com.lowdragmc.lowdraglib.gui.widget.SwitchWidget; import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; @@ -33,9 +31,6 @@ public class CreativeComputationProviderMachine extends MetaMachine implements IUIMachine, IOpticalComputationProvider { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - CreativeComputationProviderMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); - @Persisted private int maxCWUt; private int lastRequestedCWUt; @@ -119,8 +114,4 @@ public ModularUI createUI(Player entityPlayer) { new TextTexture("gtceu.creative.activity.on")))); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java index bbf26fda39f..9f671d04961 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java @@ -18,8 +18,6 @@ import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; @@ -35,9 +33,6 @@ @MethodsReturnNonnullByDefault public class CreativeEnergyContainerMachine extends TieredMachine implements ILaserContainer, IUIMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - CreativeEnergyContainerMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); - @Persisted private long voltage = 0; @Persisted @@ -61,11 +56,6 @@ public CreativeEnergyContainerMachine(IMachineBlockEntity holder) { ////////////////////////////////////// // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onLoad() { super.onLoad(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java index 1a6e7d2ca8a..d4afcfb11fd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -32,9 +30,6 @@ public class CreativeTankMachine extends QuantumTankMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeTankMachine.class, - QuantumTankMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DropSaved @@ -154,11 +149,6 @@ public WidgetGroup createUIWidget() { return group; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private class InfiniteCache extends FluidCache { public InfiniteCache(MetaMachine holder) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java index d97fb3c1a9e..328e046876a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java @@ -21,8 +21,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -52,9 +50,6 @@ @MethodsReturnNonnullByDefault public class DrumMachine extends MetaMachine implements IAutoOutputFluid, IDropSaveMachine, IInteractedMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DrumMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @@ -88,11 +83,6 @@ public DrumMachine(IMachineBlockEntity holder, Material material, int maxStoredF ////////////////////////////////////// // ***** Initialization *****// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected NotifiableFluidTank createCacheFluidHandler(Object... args) { return new NotifiableFluidTank(this, 1, maxStoredFluids, IO.BOTH) .setFilter(material.getProperty(PropertyKey.FLUID_PIPE)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java index 58281770ba8..a839e74dbcc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java @@ -12,8 +12,6 @@ import com.gregtechceu.gtceu.utils.FormattingUtil; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -37,9 +35,6 @@ @MethodsReturnNonnullByDefault public abstract class LongDistanceEndpointMachine extends MetaMachine implements ILDEndpoint, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - LongDistanceEndpointMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); - @NotNull @Getter private final LongDistancePipeType pipeType; @@ -221,11 +216,6 @@ public Direction getOutputFacing() { return getFrontFacing().getOpposite(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { List textComponents = new ArrayList<>(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java index e56c03116df..63fed2ab6d3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java @@ -31,8 +31,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -69,9 +67,6 @@ public class QuantumChestMachine extends TieredMachine implements IAutoOutputItem, IInteractedMachine, IControllable, IDropSaveMachine, IFancyUIMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(QuantumChestMachine.class, - MetaMachine.MANAGED_FIELD_HOLDER); - /** * Sourced from FunctionalStorage's * TANK_CAPACITY = new Object2LongArrayMap<>(); @Getter @@ -116,11 +111,6 @@ public QuantumTankMachine(IMachineBlockEntity holder, int tier, long maxAmount, // ***** Initialization ******// ////////////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - protected FluidCache createCacheFluidHandler(Object... args) { return new FluidCache(this); } @@ -456,9 +446,5 @@ public void exportToNearby(@NotNull Direction... facings) { } } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java index dd83079f14a..2880637e19f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java @@ -10,8 +10,6 @@ import com.gregtechceu.gtceu.common.machine.multiblock.electric.CleanroomMachine; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; @@ -22,8 +20,6 @@ public class CleanroomLogic extends RecipeLogic implements IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CleanroomLogic.class, - RecipeLogic.MANAGED_FIELD_HOLDER); public static final int BASE_CLEAN_AMOUNT = 2; @Setter @Nullable @@ -48,11 +44,6 @@ public CleanroomMachine getMachine() { return (CleanroomMachine) machine; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - /** * Performs the actual cleaning * Call this method every tick in update diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java index 9958ce16f2f..4b0527f5b6b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java @@ -12,17 +12,12 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraftforge.energy.IEnergyStorage; import lombok.Getter; public class ConverterTrait extends NotifiableEnergyContainer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConverterTrait.class, - NotifiableEnergyContainer.MANAGED_FIELD_HOLDER); - /** * If TRUE, the front facing of the machine will OUTPUT EU, other sides INPUT FE. * If FALSE, the front facing of the machine will OUTPUT FE, other sides INPUT EU. @@ -52,11 +47,6 @@ public ConverterTrait(ConverterMachine machine, int amps) { //////////////////////////////// // ***** Initialization ******// //////////////////////////////// - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - public void setFeToEu(boolean feToEu) { this.feToEu = feToEu; setRenderState(getRenderState().setValue(GTMachineModelProperties.IS_FE_TO_EU, feToEu)); @@ -94,8 +84,6 @@ public void serverTick() { private class FEContainer extends MachineTrait implements IEnergyStorage { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FEContainer.class); - public FEContainer(MetaMachine machine) { super(machine); } @@ -146,9 +134,5 @@ public boolean canReceive() { return feToEu; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java index f99d8de0e6f..7e2fc4d673b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java @@ -5,8 +5,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; @@ -31,8 +29,6 @@ public class LargeMinerLogic extends MinerLogic { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeMinerLogic.class, - MinerLogic.MANAGED_FIELD_HOLDER); private static final int CHUNK_LENGTH = 16; private static final LootItemFunction DROP_MULTIPLIER = ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE) .build(); @@ -63,11 +59,6 @@ public LargeMinerLogic(IRecipeLogicMachine machine, int fortune, int speed, int super(machine, fortune, speed, maximumRadius); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void initPos(@NotNull BlockPos pos, int currentRadius) { if (!isChunkMode) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java index 688d4a5df17..85c46e1ddca 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java @@ -22,8 +22,6 @@ import com.gregtechceu.gtceu.utils.GTUtil; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.commands.arguments.blocks.BlockStateParser; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -51,8 +49,6 @@ public class MinerLogic extends RecipeLogic implements IRecipeCapabilityHolder { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MinerLogic.class, - RecipeLogic.MANAGED_FIELD_HOLDER); private static final short MAX_SPEED = Short.MAX_VALUE; private static final byte POWER = 5; private static final byte TICK_TOLERANCE = 20; @@ -166,11 +162,6 @@ public void resetRecipeLogic() { this.pipeLength = 0; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void inValid() { super.inValid(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java index 7bd09427d3b..e9baeba1e9f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java @@ -9,8 +9,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -28,9 +26,6 @@ @MethodsReturnNonnullByDefault public abstract class MEBusPartMachine extends ItemBusPartMachine implements IGridConnectedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEBusPartMachine.class, - ItemBusPartMachine.MANAGED_FIELD_HOLDER); - @Persisted protected final GridNodeHolder nodeHolder; @@ -82,11 +77,6 @@ public void onRotated(Direction oldFacing, Direction newFacing) { getMainNode().setExposedOnSides(EnumSet.of(newFacing)); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - // By returning false here, we don't allow shift-clicking // with a screwdriver to swap the IO. @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java index c7237baaf41..1c953e1f454 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java @@ -9,8 +9,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -27,9 +25,6 @@ @MethodsReturnNonnullByDefault public abstract class MEHatchPartMachine extends FluidHatchPartMachine implements IGridConnectedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEHatchPartMachine.class, - FluidHatchPartMachine.MANAGED_FIELD_HOLDER); - protected final static int CONFIG_SIZE = 16; @Persisted @@ -83,11 +78,6 @@ public void onRotated(Direction oldFacing, Direction newFacing) { getMainNode().setExposedOnSides(EnumSet.of(newFacing)); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - // By returning false here, we don't allow shift-clicking // with a screwdriver to swap the IO. @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java index d1c45b4f5c8..f2b8ce52b29 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java @@ -15,7 +15,6 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -36,8 +35,6 @@ public class MEInputBusPartMachine extends MEBusPartMachine implements IDataStickInteractable, IMachineLife, IHasCircuitSlot { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEInputBusPartMachine.class, - MEBusPartMachine.MANAGED_FIELD_HOLDER); protected final static int CONFIG_SIZE = 16; protected ExportOnlyAEItemList aeItemHandler; @@ -61,11 +58,6 @@ protected NotifiableItemStackHandler createInventory(Object... args) { return this.aeItemHandler; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ///////////////////////////////// // ********** Sync ME *********// ///////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java index 14b821bf6dc..2f2b56ab523 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java @@ -15,7 +15,6 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import net.minecraft.MethodsReturnNonnullByDefault; @@ -37,9 +36,6 @@ public class MEInputHatchPartMachine extends MEHatchPartMachine implements IDataStickInteractable, IMachineLife, IHasCircuitSlot { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEInputHatchPartMachine.class, MEHatchPartMachine.MANAGED_FIELD_HOLDER); - protected ExportOnlyAEFluidList aeFluidHandler; public MEInputHatchPartMachine(IMachineBlockEntity holder, Object... args) { @@ -61,11 +57,6 @@ protected NotifiableFluidTank createTank(int initialCapacity, int slots, Object. return aeFluidHandler; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ///////////////////////////////// // ********** Sync ME *********// ///////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java index 6914f7782a3..72a5009e632 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java @@ -14,8 +14,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; @@ -36,9 +34,6 @@ @ParametersAreNonnullByDefault public class MEOutputBusPartMachine extends MEBusPartMachine implements IMachineLife, IInteractedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEOutputBusPartMachine.class, MEBusPartMachine.MANAGED_FIELD_HOLDER); - @Persisted private KeyStorage internalBuffer; // Do not use KeyCounter, use our simple implementation @@ -67,11 +62,6 @@ public void onMachineRemoved() { } } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ///////////////////////////////// // ********** Sync ME *********// ///////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java index 560cf98d83a..8b0cb8b3818 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java @@ -16,8 +16,6 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraftforge.fluids.FluidStack; @@ -35,9 +33,6 @@ @ParametersAreNonnullByDefault public class MEOutputHatchPartMachine extends MEHatchPartMachine implements IMachineLife { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEOutputHatchPartMachine.class, MEHatchPartMachine.MANAGED_FIELD_HOLDER); - @Persisted private KeyStorage internalBuffer; // Do not use KeyCounter, use our simple implementation @@ -72,11 +67,6 @@ public void onMachineRemoved() { } } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ///////////////////////////////// // ********** Sync ME *********// ///////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java index f8c5e49e6f9..545960aff07 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java @@ -36,8 +36,6 @@ import com.lowdragmc.lowdraglib.syncdata.ITagSerializable; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -87,8 +85,6 @@ public class MEPatternBufferPartMachine extends MEBusPartMachine implements ICraftingProvider, PatternContainer, IDataStickInteractable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEPatternBufferPartMachine.class, MEBusPartMachine.MANAGED_FIELD_HOLDER); protected static final int MAX_PATTERN_COUNT = 27; private final InternalInventory internalPatternInventory = new InternalInventory() { @@ -364,11 +360,6 @@ private boolean checkInput(KeyCounter[] inputHolder) { return true; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public @Nullable IGrid getGrid() { return getMainNode().getGrid(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java index 1e8901b2b8b..19c4cd1de7f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java @@ -13,8 +13,6 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.Tag; @@ -38,9 +36,6 @@ public class MEPatternBufferProxyPartMachine extends TieredIOPartMachine implements IMachineLife, IDataStickInteractable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEPatternBufferProxyPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); - @Getter private final ProxySlotRecipeHandler proxySlotRecipeHandler; @@ -102,11 +97,6 @@ public ModularUI createUI(Player entityPlayer) { return getBuffer().createUI(entityPlayer); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @Override public void onMachineRemoved() { var buf = getBuffer(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java index 288dac498f5..2a842fc9500 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java @@ -19,8 +19,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -52,9 +50,6 @@ @MethodsReturnNonnullByDefault public class MEStockingBusPartMachine extends MEInputBusPartMachine implements IMEStockingPart { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEStockingBusPartMachine.class, MEInputBusPartMachine.MANAGED_FIELD_HOLDER); - @DescSynced @Persisted @Getter @@ -101,11 +96,6 @@ protected NotifiableItemStackHandler createInventory(Object... args) { return this.aeItemHandler; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ///////////////////////////////// // ********** Sync ME *********// ///////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java index 8b07ee7ad05..11fa0f3c2ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java @@ -20,8 +20,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -53,9 +51,6 @@ @MethodsReturnNonnullByDefault public class MEStockingHatchPartMachine extends MEInputHatchPartMachine implements IMEStockingPart { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - MEStockingHatchPartMachine.class, MEInputHatchPartMachine.MANAGED_FIELD_HOLDER); - private static final int CONFIG_SIZE = 16; @DescSynced @@ -105,11 +100,6 @@ protected NotifiableFluidTank createTank(int initialCapacity, int slots, Object. return this.aeFluidHandler; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - ///////////////////////////////// // ********** Sync ME *********// ///////////////////////////////// diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java index 50933b53c0f..f5eb9f14a6b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java @@ -7,8 +7,6 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.ReadOnlyManaged; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.TickTask; @@ -27,8 +25,6 @@ */ public class GridNodeHolder extends MachineTrait { - protected final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(GridNodeHolder.class); - @Getter @Persisted @ReadOnlyManaged(onDirtyMethod = "onGridNodeDirty", @@ -73,11 +69,6 @@ public void onMachineUnLoad() { mainNode.destroy(); } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - @SuppressWarnings("unused") public boolean onGridNodeDirty(SerializableManagedGridNode node) { return node != null && node.isActive() && node.isOnline(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java index 41398dff529..97a8017a96b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java @@ -3,8 +3,6 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.trait.MachineTrait; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.core.Direction; import appeng.api.networking.GridHelper; @@ -15,7 +13,6 @@ public class GridNodeHostTrait extends MachineTrait implements IGridConnectedBlockEntity { - protected final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(GridNodeHostTrait.class); private final IManagedGridNode proxy; public GridNodeHostTrait(MetaMachine machine) { @@ -44,8 +41,4 @@ public AECableType getCableConnectionType(Direction dir) { return AECableType.SMART; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java index a87d46b4269..efe81ed1935 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java @@ -6,8 +6,6 @@ import com.gregtechceu.gtceu.api.transfer.fluid.CustomFluidTank; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraftforge.fluids.FluidStack; import lombok.Getter; @@ -17,9 +15,6 @@ public class ExportOnlyAEFluidList extends NotifiableFluidTank implements IConfigurableSlotList { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( - ExportOnlyAEFluidList.class, NotifiableFluidTank.MANAGED_FIELD_HOLDER); - @Getter @Persisted protected ExportOnlyAEFluidSlot[] inventory; @@ -101,11 +96,6 @@ public boolean ownsSlot(ExportOnlyAEFluidSlot testSlot) { return false; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private static class FluidStorageDelegate extends CustomFluidTank { private final ExportOnlyAEFluidSlot fluid; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java index a757ca42bfa..0aa6efdac33 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java @@ -7,8 +7,6 @@ import com.gregtechceu.gtceu.api.transfer.item.CustomItemStackHandler; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; - import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; @@ -20,9 +18,6 @@ public class ExportOnlyAEItemList extends NotifiableItemStackHandler implements IConfigurableSlotList { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ExportOnlyAEItemList.class, - NotifiableItemStackHandler.MANAGED_FIELD_HOLDER); - @Persisted @Getter protected ExportOnlyAEItemSlot[] inventory; @@ -114,11 +109,6 @@ public boolean isStocking() { return false; } - @Override - public ManagedFieldHolder getFieldHolder() { - return MANAGED_FIELD_HOLDER; - } - private static class ItemStackHandlerDelegate extends CustomItemStackHandler { private final ExportOnlyAEItemSlot[] inventory; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/ManagedFieldHolderMap.java b/src/main/java/com/gregtechceu/gtceu/utils/ManagedFieldHolderMap.java new file mode 100644 index 00000000000..44e0109444b --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/utils/ManagedFieldHolderMap.java @@ -0,0 +1,40 @@ +package com.gregtechceu.gtceu.utils; + +import com.lowdragmc.lowdraglib.syncdata.IManaged; +import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class ManagedFieldHolderMap { + + private static final Map, ManagedFieldHolder> CLASS_HOLDER_MAP = new ConcurrentHashMap<>(); + + public static ManagedFieldHolder getManagedFieldHolder(Class clazz) { + var holder = CLASS_HOLDER_MAP.get(clazz); + if (holder == null) { + Class sc = clazz.getSuperclass(); + if (sc != null && sc != Object.class) { + var sh = getManagedFieldHolder(sc); + holder = new ManagedFieldHolder(clazz, sh); + if (holder.getFields().length == sh.getFields().length) { + holder = sh; + } + } + if (holder == null) { + holder = new ManagedFieldHolder(clazz); + } + CLASS_HOLDER_MAP.put(clazz, holder); + } + return holder; + } + + public static ManagedFieldHolder createManagedFieldHolder(Class clazz) { + var holder = CLASS_HOLDER_MAP.get(clazz); + if (holder == null) { + holder = new ManagedFieldHolder(clazz); + CLASS_HOLDER_MAP.put(clazz, holder); + } + return holder; + } +} From bcf2381d45b9abd7fc7b068e9157564c2894d4f1 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Sun, 17 May 2026 13:54:28 +0800 Subject: [PATCH 73/78] spotless --- .../gtceu/api/blockentity/MetaMachineBlockEntity.java | 5 +++-- .../gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java | 6 +++--- .../gtceu/api/capability/recipe/EURecipeCapability.java | 2 +- .../java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java | 6 +++--- .../gregtechceu/gtceu/api/cover/filter/FilterHandler.java | 6 +++--- .../gtceu/api/machine/MachineCoverContainer.java | 6 +++--- .../java/com/gregtechceu/gtceu/api/machine/MetaMachine.java | 5 +++-- .../gregtechceu/gtceu/api/machine/trait/MachineTrait.java | 6 +++--- .../gtceu/api/machine/trait/NotifiableEnergyContainer.java | 1 + .../gtceu/api/machine/trait/NotifiableFluidTank.java | 1 + .../gtceu/api/machine/trait/NotifiableItemStackHandler.java | 1 + .../api/machine/trait/NotifiableRecipeHandlerTrait.java | 1 + .../gregtechceu/gtceu/api/machine/trait/RecipeLogic.java | 1 + .../gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java | 6 +++--- .../gtceu/common/blockentity/CableBlockEntity.java | 1 + .../gtceu/common/cover/ComputerMonitorCover.java | 2 +- .../com/gregtechceu/gtceu/common/cover/FacadeCover.java | 1 + .../gregtechceu/gtceu/common/cover/FluidFilterCover.java | 1 + .../gregtechceu/gtceu/common/cover/FluidRegulatorCover.java | 1 + .../com/gregtechceu/gtceu/common/cover/ItemFilterCover.java | 1 + .../gtceu/common/cover/MachineControllerCover.java | 1 + .../java/com/gregtechceu/gtceu/common/cover/PumpCover.java | 1 + .../com/gregtechceu/gtceu/common/cover/RobotArmCover.java | 1 + .../com/gregtechceu/gtceu/common/cover/ShutterCover.java | 2 +- .../gtceu/common/cover/WirelessTransmitterCover.java | 1 - .../gtceu/common/cover/detector/DetectorCover.java | 1 + .../gtceu/common/cover/ender/AbstractEnderLinkCover.java | 1 + .../gtceu/common/cover/ender/EnderFluidLinkCover.java | 1 + .../gtceu/common/cover/ender/EnderItemLinkCover.java | 3 +-- .../gtceu/common/cover/ender/EnderRedstoneLinkCover.java | 4 +--- .../common/cover/voiding/AdvancedFluidVoidingCover.java | 1 + .../common/cover/voiding/AdvancedItemVoidingCover.java | 1 + .../gtceu/common/cover/voiding/FluidVoidingCover.java | 2 +- .../gtceu/common/cover/voiding/ItemVoidingCover.java | 2 +- .../gtceu/common/machine/electric/ConverterMachine.java | 1 + .../gtceu/common/machine/electric/HullMachine.java | 2 +- .../gtceu/common/machine/electric/PumpMachine.java | 1 + .../gtceu/common/machine/electric/TransformerMachine.java | 1 + .../common/machine/electric/WorldAcceleratorMachine.java | 1 + .../machine/multiblock/electric/CentralMonitorMachine.java | 2 +- .../machine/multiblock/electric/CleanroomMachine.java | 1 - .../machine/multiblock/electric/LargeMinerMachine.java | 2 +- .../machine/multiblock/electric/MultiblockTankMachine.java | 2 +- .../machine/multiblock/electric/PowerSubstationMachine.java | 2 +- .../multiblock/electric/gcym/LargeChemicalBathMachine.java | 1 + .../machine/multiblock/electric/gcym/LargeMixerMachine.java | 1 + .../machine/multiblock/electric/research/HPCAMachine.java | 6 +++--- .../multiblock/generator/LargeCombustionEngineMachine.java | 3 +-- .../gtceu/common/machine/multiblock/part/CokeOvenHatch.java | 1 + .../machine/multiblock/part/DataAccessHatchMachine.java | 2 +- .../common/machine/multiblock/part/DiodePartMachine.java | 1 + .../machine/multiblock/part/DualHatchPartMachine.java | 2 +- .../machine/multiblock/part/EnergyHatchPartMachine.java | 1 + .../machine/multiblock/part/FluidHatchPartMachine.java | 1 + .../common/machine/multiblock/part/ItemBusPartMachine.java | 1 + .../machine/multiblock/part/LaserHatchPartMachine.java | 1 + .../multiblock/part/MaintenanceHatchPartMachine.java | 2 +- .../common/machine/multiblock/part/MufflerPartMachine.java | 2 +- .../machine/multiblock/part/ParallelHatchPartMachine.java | 3 +-- .../machine/multiblock/part/RotorHolderPartMachine.java | 1 + .../multiblock/part/hpca/HPCAComponentPartMachine.java | 1 + .../multiblock/part/monitor/AdvancedMonitorPartMachine.java | 2 +- .../multiblock/primitive/PrimitiveBlastFurnaceMachine.java | 1 + .../multiblock/primitive/PrimitiveWorkableMachine.java | 1 + .../common/machine/multiblock/steam/LargeBoilerMachine.java | 1 + .../common/machine/steam/SteamLiquidBoilerMachine.java | 1 + .../gtceu/common/machine/steam/SteamSolidBoilerMachine.java | 1 + .../gtceu/common/machine/storage/BufferMachine.java | 2 +- .../gtceu/common/machine/storage/CrateMachine.java | 1 + .../gtceu/common/machine/storage/CreativeChestMachine.java | 1 + .../machine/storage/CreativeComputationProviderMachine.java | 2 +- .../machine/storage/CreativeEnergyContainerMachine.java | 2 +- .../gtceu/common/machine/storage/CreativeTankMachine.java | 1 + .../gtceu/common/machine/storage/DrumMachine.java | 1 + .../common/machine/storage/LongDistanceEndpointMachine.java | 1 + .../gtceu/common/machine/storage/QuantumChestMachine.java | 2 +- .../gtceu/common/machine/storage/QuantumTankMachine.java | 2 +- .../gtceu/common/machine/trait/CleanroomLogic.java | 1 + .../gtceu/common/machine/trait/ConverterTrait.java | 2 +- .../gtceu/common/machine/trait/miner/LargeMinerLogic.java | 1 + .../gtceu/common/machine/trait/miner/MinerLogic.java | 1 + .../gtceu/integration/ae2/machine/MEBusPartMachine.java | 1 + .../gtceu/integration/ae2/machine/MEHatchPartMachine.java | 1 + .../integration/ae2/machine/MEOutputBusPartMachine.java | 1 + .../integration/ae2/machine/MEOutputHatchPartMachine.java | 1 + .../integration/ae2/machine/MEPatternBufferPartMachine.java | 1 + .../ae2/machine/MEPatternBufferProxyPartMachine.java | 1 + .../integration/ae2/machine/MEStockingBusPartMachine.java | 1 + .../integration/ae2/machine/MEStockingHatchPartMachine.java | 1 + .../gtceu/integration/ae2/machine/trait/GridNodeHolder.java | 1 + .../integration/ae2/machine/trait/GridNodeHostTrait.java | 1 - .../gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java | 1 + .../gtceu/integration/ae2/slot/ExportOnlyAEItemList.java | 1 + 93 files changed, 108 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index 12d42765f9a..2fa62ee5cf4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -15,8 +15,8 @@ import com.gregtechceu.gtceu.api.misc.LaserContainerList; import com.gregtechceu.gtceu.client.model.IBlockEntityRendererBakedModel; import com.gregtechceu.gtceu.client.model.machine.MachineRenderState; - import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; @@ -55,7 +55,8 @@ public class MetaMachineBlockEntity extends BlockEntity implements IMachineBlockEntity, IManaged { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MetaMachineBlockEntity.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(MetaMachineBlockEntity.class); public final MultiManagedStorage managedStorage = new MultiManagedStorage(); @Getter 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 a668174f116..52aea0d99a8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -15,6 +15,7 @@ import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.utils.GTUtil; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; @@ -27,8 +28,6 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -66,7 +65,8 @@ public abstract class PipeBlockEntity & IPipeTyp IAsyncAutoSyncBlockEntity, IAutoPersistBlockEntity, IToolGridHighlight, IToolable, ICopyable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(PipeBlockEntity.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(PipeBlockEntity.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java index c518228571c..2fd5766315a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java @@ -31,7 +31,7 @@ public EnergyStack copyInner(EnergyStack content) { @Override public EnergyStack copyWithModifier(EnergyStack content, ContentModifier modifier) { - return content.withVoltage(modifier.apply(content.voltage())); + return content.withAmperage(modifier.apply(content.amperage())); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java index 400e614fc20..d70ae04e7b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; import com.gregtechceu.gtceu.client.renderer.cover.ICoverRenderer; import com.gregtechceu.gtceu.client.renderer.cover.IDynamicCoverRenderer; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; @@ -19,8 +20,6 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -53,7 +52,8 @@ @MethodsReturnNonnullByDefault public abstract class CoverBehavior implements IEnhancedManaged, IToolGridHighlight, ICopyable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(CoverBehavior.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(CoverBehavior.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); 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 75d9bea311c..98187e0cd5a 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 @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.machine.MachineCoverContainer; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.transfer.item.CustomItemStackHandler; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -17,8 +18,6 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; @@ -189,7 +188,8 @@ private void updateFilterGroupUI() { // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(FilterHandler.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(FilterHandler.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java index ea7670a443d..225df66ab58 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; import com.gregtechceu.gtceu.utils.GTUtil; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; @@ -17,8 +18,6 @@ import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.syncdata.managed.IRef; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -34,7 +33,8 @@ public class MachineCoverContainer implements ICoverable, IEnhancedManaged { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MachineCoverContainer.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(MachineCoverContainer.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @Getter diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java index 7fb3f08b2b0..8c595ca222a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java @@ -33,8 +33,8 @@ import com.gregtechceu.gtceu.common.item.tool.behavior.ToolModeSwitchBehavior; import com.gregtechceu.gtceu.common.machine.owner.MachineOwner; import com.gregtechceu.gtceu.common.machine.owner.PlayerOwner; - import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; @@ -100,7 +100,8 @@ public class MetaMachine implements IEnhancedManaged, IToolable, ITickSubscription, IToolGridHighlight, IFancyTooltip, IPaintable, IRedstoneSignalMachine, ICopyable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MetaMachine.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(MetaMachine.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @Setter diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java index 551d954de38..ae66351fb94 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java @@ -2,13 +2,12 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.client.model.machine.MachineRenderState; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraftforge.client.model.data.ModelData; @@ -26,7 +25,8 @@ */ public abstract class MachineTrait implements IEnhancedManaged { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(MachineTrait.class); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(MachineTrait.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java index 441e18e18f5..5ded2eb0062 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java @@ -19,6 +19,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.Direction; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java index 0f82399dafd..9d0af59700d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java @@ -13,6 +13,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.Direction; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidType; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index 898c8ad4aab..9d4b57318e8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -15,6 +15,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java index b4931a6b650..60b9e7fd5b8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java @@ -5,6 +5,7 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import lombok.Getter; import lombok.Setter; 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 661c52dee19..ed84616e7ab 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 @@ -26,6 +26,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; + import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; 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 0be85f8f182..9f54dceda6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; import com.gregtechceu.gtceu.common.blockentity.ItemPipeBlockEntity; import com.gregtechceu.gtceu.utils.GTUtil; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; @@ -19,8 +20,6 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -35,7 +34,8 @@ public class PipeCoverContainer implements ICoverable, IEnhancedManaged { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(PipeCoverContainer.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(PipeCoverContainer.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); private final IPipeNode pipeTile; diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java index 33b83cfedd2..07871ba75cd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java @@ -21,6 +21,7 @@ import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; 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 c598a7ee79e..349eb75d6fd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java @@ -24,6 +24,7 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -39,7 +40,6 @@ import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.function.Supplier; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java index 8e0f0ebcb34..9e6d1516ecb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java @@ -8,6 +8,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; 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 37600d3eead..b4cf03c60b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java @@ -16,6 +16,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java index bc6039e2b0b..b12c9d0184b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java @@ -14,6 +14,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java index 7b009c42787..5587283f1b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java @@ -18,6 +18,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java index 128de08948d..68387ed0e7f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java @@ -22,6 +22,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java index e1f2edbdcca..15a7c2358ea 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java @@ -28,6 +28,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java index bce0261644d..6f907998693 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java @@ -13,6 +13,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java index 94aef1a5f48..9a6be7e48e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -66,5 +67,4 @@ public InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand public @Nullable IFluidHandlerModifiable getFluidHandlerCap(IFluidHandlerModifiable defaultValue) { return isWorkingEnabled() ? null : super.getFluidHandlerCap(defaultValue); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java index 8be1a0a88dc..56f40a83402 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/WirelessTransmitterCover.java @@ -63,5 +63,4 @@ public void setDisplayTargetBufferLine(int line, MutableComponent component) { public void setComputerCraftTextBufferLine(int line, MutableComponent component) { computerCraftTextBuffer.set(line, component); } - } 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 0a754107cf2..0b551fe4c85 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 @@ -8,6 +8,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java index ff9bc563caf..7d70fb42bc5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/AbstractEnderLinkCover.java @@ -28,6 +28,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.ChatFormatting; import net.minecraft.core.Direction; import net.minecraft.network.FriendlyByteBuf; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java index a5308203a53..4069ea22225 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderFluidLinkCover.java @@ -17,6 +17,7 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.Direction; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java index 8681906a8b4..d490fc473a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderItemLinkCover.java @@ -16,12 +16,12 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; import lombok.Getter; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class EnderItemLinkCover extends AbstractEnderLinkCover { @@ -108,5 +108,4 @@ protected Widget addVirtualEntryWidget(VirtualEntry entry, int x, int y, int wid protected String getUITitle() { return "cover.ender_item_link.title"; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java index 699ac8291df..1aefb7c24a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ender/EnderRedstoneLinkCover.java @@ -10,9 +10,8 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import net.minecraft.core.Direction; -import org.jetbrains.annotations.NotNull; +import net.minecraft.core.Direction; import java.util.UUID; @@ -93,5 +92,4 @@ protected int getSignalInput() { return coverHolder.getLevel().getSignal(coverHolder.getPos().relative(attachedSide), attachedSide.getOpposite()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java index 65c14f6f2d5..1c6f4093f7f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java @@ -15,6 +15,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java index 642e202263d..953fd266213 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java @@ -12,6 +12,7 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java index 31127f8e14c..5007620b8bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java @@ -13,6 +13,7 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -139,5 +140,4 @@ public boolean shouldRenderGrid(Player player, BlockPos pos, BlockState state, I ////////////////////////////////////// // ***** LDLib SyncData ******// ////////////////////////////////////// - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java index 53fd3ad8735..b3599742233 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java @@ -14,6 +14,7 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -137,5 +138,4 @@ public boolean shouldRenderGrid(Player player, BlockPos pos, BlockState state, I ////////////////////////////////////// // ***** LDLib SyncData ******// ////////////////////////////////////// - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java index 529e3e0abf9..44076b9911d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.common.machine.trait.ConverterTrait; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java index a7715b93aa8..d5a7ea1a452 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java @@ -5,13 +5,13 @@ import com.gregtechceu.gtceu.api.capability.IMonitorComponent; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.integration.ae2.machine.trait.GridNodeHostTrait; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java index f1fb40b23e4..5eba9decba7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java @@ -23,6 +23,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; import net.minecraft.core.BlockPos; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java index 969396dce98..af3c756fa48 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java @@ -10,6 +10,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java index 54bdd3592a1..d40b41acbae 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java @@ -20,6 +20,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java index 3e280efa678..98e9b821719 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CentralMonitorMachine.java @@ -17,7 +17,6 @@ import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockDisplayText; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.api.pattern.*; @@ -38,6 +37,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; 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 c9030c6f8bc..3d616bb5de6 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 @@ -19,7 +19,6 @@ import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.api.pattern.BlockPattern; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java index b62fd09983d..dce3e73544d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java @@ -12,7 +12,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IDataInfoProvider; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.api.transfer.fluid.FluidHandlerList; @@ -25,6 +24,7 @@ import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java index 0bfd7e9df15..8a6346c55bd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java @@ -15,6 +15,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -101,5 +102,4 @@ private String getFluidLabel() { ////////////////////////////////////// // ***** LDLib SyncData ******// ////////////////////////////////////// - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java index 0cf79a595da..88d1e470816 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java @@ -25,6 +25,7 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.*; + import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -555,7 +556,6 @@ public long getPassiveDrainPerTick() { .add(BigInteger.valueOf(PASSIVE_DRAIN_MAX_PER_STORAGE * numExcl)) .longValue(); } - } @Getter diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java index d3db461ce76..1f25ebd22e3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeChemicalBathMachine.java @@ -7,6 +7,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java index 5afc4dbb291..68cd6488efe 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/gcym/LargeMixerMachine.java @@ -7,6 +7,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java index 931c8a4041d..9becc700c69 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java @@ -23,6 +23,7 @@ import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.gregtechceu.gtceu.utils.GTUtil; +import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; @@ -36,8 +37,6 @@ import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.gregtechceu.gtceu.utils.ManagedFieldHolderMap; - import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -382,7 +381,8 @@ private ChatFormatting getDisplayTemperatureColor() { // Handles the logic of this structure's specific HPCA component grid public static class HPCAGridHandler implements IManaged { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap.createManagedFieldHolder(HPCAGridHandler.class); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = ManagedFieldHolderMap + .createManagedFieldHolder(HPCAGridHandler.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java index bff4c11cbc4..d16f478d212 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java @@ -11,7 +11,6 @@ import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockDisplayText; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; @@ -26,6 +25,7 @@ import com.gregtechceu.gtceu.utils.GTMath; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -233,5 +233,4 @@ public void attachTooltips(TooltipsPanel tooltipsPanel) { this::isIntakesObstructed, () -> null)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java index 0b34a242d8c..e6ff424e303 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.lowdragmc.lowdraglib.syncdata.ISubscription; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java index d2c9dba8128..b6bd26fefe0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java @@ -12,7 +12,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IDataInfoProvider; import com.gregtechceu.gtceu.api.machine.feature.IMachineLife; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipe; @@ -28,6 +27,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java index a1f77f95750..a68ec5799f6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java @@ -10,6 +10,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java index b0b3945352c..96027d43f6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java @@ -15,6 +15,7 @@ import com.lowdragmc.lowdraglib.jei.IngredientIO; import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; @@ -183,5 +184,4 @@ public Widget createUIWidget() { group.addWidget(container); return group; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java index 4c238d3eb10..1ee3adda6be 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java index 20e99d1fa1c..9efc69c3081 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java @@ -29,6 +29,7 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java index c5c36f535a3..89559062e89 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java @@ -29,6 +29,7 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java index 3a769521659..87006e4fd0e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java @@ -9,6 +9,7 @@ import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java index 03684d57881..a25943f34d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java @@ -11,7 +11,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; import com.gregtechceu.gtceu.api.machine.feature.IMachineLife; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; @@ -23,6 +22,7 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java index 60db93338e0..3e6377be4d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java @@ -10,7 +10,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMufflerMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.transfer.item.CustomItemStackHandler; import com.gregtechceu.gtceu.utils.GTUtil; @@ -18,6 +17,7 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java index 36644b85c67..91949a3b679 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ParallelHatchPartMachine.java @@ -7,16 +7,15 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.util.Mth; import lombok.Getter; -import org.jetbrains.annotations.NotNull; public class ParallelHatchPartMachine extends TieredPartMachine implements IFancyUIMachine, IParallelHatch { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java index dc2e2f5d984..e34e0ab4497 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java @@ -22,6 +22,7 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java index d36d20aaa2a..98039457eac 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java @@ -11,6 +11,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java index ce9397adee7..2694d20833a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/monitor/AdvancedMonitorPartMachine.java @@ -3,10 +3,10 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.TickableSubscription; import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java index 50d0bc64718..d7096a536ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java @@ -22,6 +22,7 @@ import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java index 5237820a39a..e05546a3c5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraftforge.fluids.FluidType; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java index cf42a24d6a2..81b279d0a90 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java @@ -23,6 +23,7 @@ import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java index 015553ab83e..563acd84c22 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java @@ -12,6 +12,7 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java index d69c965eef3..4e660268d15 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java @@ -19,6 +19,7 @@ import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java index b12abe4d72f..72dd96cd15b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/BufferMachine.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.gui.widget.TankWidget; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.TickableSubscription; import com.gregtechceu.gtceu.api.machine.TieredMachine; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputBoth; @@ -23,6 +22,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java index d42f01fee58..622613871d3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java @@ -17,6 +17,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java index 4edd263622b..a42177655e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java @@ -13,6 +13,7 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java index 285b7ef9159..be21b25d4ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeComputationProviderMachine.java @@ -15,6 +15,7 @@ import com.lowdragmc.lowdraglib.gui.widget.SwitchWidget; import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; @@ -113,5 +114,4 @@ public ModularUI createUI(Player entityPlayer) { new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.on")))); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java index 9f671d04961..66ae07272ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.capability.ILaserContainer; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.TieredMachine; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.utils.GTUtil; @@ -18,6 +17,7 @@ import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java index d4afcfb11fd..1d86c97202f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java @@ -13,6 +13,7 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java index 328e046876a..01cf1643953 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java @@ -21,6 +21,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java index a839e74dbcc..7807b6d5f9f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.utils.FormattingUtil; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java index 63fed2ab6d3..5410b14c095 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java @@ -31,6 +31,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -512,6 +513,5 @@ public void exportToNearby(@NotNull Direction... facings) { public boolean canInsert(ItemStack stack) { return filter.test(stack) && (insertItem(0, stack, true).getCount() != stack.getCount()); } - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java index 80de65e0f1d..4813a302c73 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java @@ -28,6 +28,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -445,6 +446,5 @@ public void exportToNearby(@NotNull Direction... facings) { .ifPresent(adj -> GTTransferUtils.transferFluidsFiltered(this, adj, filter)); } } - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java index 2880637e19f..ac455bd979d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.common.machine.multiblock.electric.CleanroomMachine; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java index 4b0527f5b6b..f2c7d35bd93 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java @@ -12,6 +12,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import net.minecraftforge.energy.IEnergyStorage; import lombok.Getter; @@ -133,6 +134,5 @@ public boolean canExtract() { public boolean canReceive() { return feToEu; } - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java index 7e2fc4d673b..746c1b73725 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java index 85c46e1ddca..c6b7d44d81b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java @@ -22,6 +22,7 @@ import com.gregtechceu.gtceu.utils.GTUtil; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.commands.arguments.blocks.BlockStateParser; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java index e9baeba1e9f..b8c8b7fe9a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java @@ -9,6 +9,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java index 1c953e1f454..ec08be92e85 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java @@ -9,6 +9,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java index 72a5009e632..c282582d922 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java @@ -14,6 +14,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java index 8b0cb8b3818..4b2cd537c83 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java @@ -16,6 +16,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java index 545960aff07..deeebf71d5e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferPartMachine.java @@ -36,6 +36,7 @@ import com.lowdragmc.lowdraglib.syncdata.ITagSerializable; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java index 19c4cd1de7f..9bea84c117a 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEPatternBufferProxyPartMachine.java @@ -13,6 +13,7 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.Tag; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java index 2a842fc9500..fa1e018958b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingBusPartMachine.java @@ -19,6 +19,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java index 11fa0f3c2ef..4c24d3106c2 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEStockingHatchPartMachine.java @@ -20,6 +20,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java index f5eb9f14a6b..d6ac3e3cc97 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHolder.java @@ -7,6 +7,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.ReadOnlyManaged; + import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.TickTask; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java index 97a8017a96b..828ea875f6b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java @@ -40,5 +40,4 @@ public void saveChanges() { public AECableType getCableConnectionType(Direction dir) { return AECableType.SMART; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java index efe81ed1935..515b072ebd5 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEFluidList.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.transfer.fluid.CustomFluidTank; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraftforge.fluids.FluidStack; import lombok.Getter; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java index 0aa6efdac33..64c2683f7ec 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/slot/ExportOnlyAEItemList.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.transfer.item.CustomItemStackHandler; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; From ad2c3bd5f9df8d0e6e068914cd0aebc91a83ce35 Mon Sep 17 00:00:00 2001 From: mmyddd Date: Thu, 28 May 2026 00:36:48 +0800 Subject: [PATCH 74/78] =?UTF-8?q?feat:=20=E4=B8=8A=E4=BC=A0AGENTS.mb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000000..f0c22ce801f --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,55 @@ +# GregTech-Modern KNOWLEDGE BASE + +## OVERVIEW +`GregTech-Modern` is the vendored GTCEu upstream project used as CTNH's API/runtime dependency and reference implementation. Treat it as upstream code first, local code second. + +## WHERE TO LOOK +- Addon API: `src/main/java/com/gregtechceu/gtceu/api/addon/GTAddon.java`, `IGTAddon.java`. CTNH modules implement addon hooks against these APIs. +- Material APIs: `src/main/java/com/gregtechceu/gtceu/api/data/chemical/`. Material registries, properties, tag prefixes. +- Machine APIs: `src/main/java/com/gregtechceu/gtceu/api/machine/`. Machine definitions and behavior base classes. +- Recipe APIs: `src/main/java/com/gregtechceu/gtceu/api/recipe/`. Recipe types, capabilities, modifiers. +- Datagen/reference data: `src/main/java/com/gregtechceu/gtceu/data/`, `src/generated/resources`. Upstream-generated resources and providers. +- Tests: `src/test/java`. Only test suite currently present in the workspace. +- Version catalogs: `gradle/libs.versions.toml`, `gradle/forge.versions.toml`. Root `settings.gradle` imports these catalogs. + +## COMMON GTCEu API QUICK REFERENCE +- `IGTAddon`: `api/addon/IGTAddon.java`. Addon lifecycle hooks: `getRegistrate()`, `initializeAddon()`, `addonModId()`, `registerTagPrefixes()`, `registerElements()`, `registerRecipeCapabilities()`, `addRecipes()`, `removeRecipes()`, ore/fluid vein hooks, and KubeJS recipe key registration. +- `GTAddon`: `api/addon/GTAddon.java`. Annotation used by GTCEu to discover addon implementations. +- `MachineDefinition`: `api/machine/MachineDefinition.java`. Registered machine definition; exposes block/item/block entity suppliers, `createMetaMachine()`, `asStack()`, shape, tier, recipe modifier, UI, tooltip, and render state settings. +- `MultiblockMachineDefinition`: `api/machine/MultiblockMachineDefinition.java`. Multiblock-specific machine definition; adds `patternFactory`, preview shapes, generator flag, flip rules, recovery items, part sorting, part appearance, and additional display hooks. +- `MetaMachine` / `IMachineBlockEntity`: `api/machine/MetaMachine.java`, `api/machine/IMachineBlockEntity.java`. Runtime machine object and block-entity bridge used by machine behavior code. +- `WorkableElectricMultiblockMachine`: `api/machine/multiblock/WorkableElectricMultiblockMachine.java`. Common base for electric multiblocks with recipe logic. +- `PartAbility`: `api/machine/multiblock/PartAbility.java`. Multiblock part capability registry: item/fluid import/export, energy hatches, maintenance, muffler, parallel hatch, laser, computation/data abilities; maps tiers to valid part blocks. +- `GTRecipe` / `GTRecipeType`: `api/recipe/GTRecipe.java`, `api/recipe/GTRecipeType.java`. Runtime recipe object and recipe type definition; use when inspecting processing, UI limits, categories, and capability maps. +- `RecipeModifier`: `api/recipe/modifier/RecipeModifier.java`. Functional interface returning a `ModifierFunction` for a machine and recipe; `applyModifier()` returns a modified recipe copy or `null`. +- `RecipeCapability`: `api/capability/recipe/RecipeCapability.java`. Capability abstraction for recipe inputs/outputs; controls KubeJS conversion, slot names, matching, parallel limits, XEI widgets, and distinct-bypass behavior. +- `Material`: `api/data/chemical/material/Material.java`. Material data model; check properties, flags, components, formula, color/icon set, and generated item/fluid/block behavior. +- `MaterialRegistry`: `api/data/chemical/material/registry/MaterialRegistry.java`. Registry container for materials; CTNH material registration should respect GTCEu event/addon lifecycle. +- `TagPrefix`: `api/data/tag/TagPrefix.java`. Material item/block prefix definition; controls generated tags/items/blocks, ignored materials, material amount overrides, and localization keys. +- `BlockPattern` / `TraceabilityPredicate`: `api/pattern/BlockPattern.java`, `api/pattern/TraceabilityPredicate.java`. Multiblock structure matching and predicate DSL; includes global/layer limits, preview count, IO marking, render masking, and NBT parser metadata. +- `MultiblockShapeInfo`: `api/pattern/MultiblockShapeInfo.java`. XEI/preview shape representation; used by multiblock definitions and pattern previews. + +## REGISTRATION ENTRYPOINTS +- Core registries: `api/registry/GTRegistries.java`, `api/registry/GTRegistry.java`, `api/registry/registrate/GTRegistrate.java`. +- Upstream content registries: `common/data/GTItems.java`, `GTBlocks.java`, `GTMachines.java`, `GTRecipeTypes.java`, `GTMaterials.java`, `GTElements.java`, `GTFluids.java`, `GTCreativeModeTabs.java`, `GTEntityTypes.java`. +- Machine builders: `api/registry/registrate/MachineBuilder.java`, `MultiblockMachineBuilder.java`. +- Recipe infrastructure: `api/recipe/GTRecipe.java`, `GTRecipeType.java`, `api/recipe/modifier/`, `api/capability/recipe/`. +- Material/tag APIs: `api/data/chemical/material/`, `api/data/tag/TagPrefix.java`; generated material content is driven from these APIs and common data registries. +- Datagen providers: `data/` and `api/registry/registrate/provider/`; prefer these over hand-editing generated resources. + +## CONVENTIONS +- Namespace is `com.gregtechceu.gtceu`. +- This project has its own Gradle configuration and is excluded from root `ctnhSubprojects` shared CTNH plugin setup. +- Generated and resource directories are much larger than CTNH modules; narrow searches before editing. +- Prefer reading GTCEu APIs from here instead of guessing addon contracts in CTNH modules. + +## COMMANDS +```bash +./gradlew :modules:GregTech-Modern:build +./gradlew :modules:GregTech-Modern:test +``` + +## ANTI-PATTERNS +- Do not make incidental style or API changes here while working on CTNH modules. +- Do not assume CTNH root Spotless/moddev settings apply to this project. +- Do not update vendored upstream behavior unless the task explicitly targets GTCEu internals or a required local compatibility patch. From f9cfe813e9f63deed3e5026f239e0bab4dd12ccc Mon Sep 17 00:00:00 2001 From: moguang <184676648@qq.com> Date: Sun, 14 Jun 2026 14:04:07 +0800 Subject: [PATCH 75/78] =?UTF-8?q?fix:=20action=E4=BF=AE=E5=A4=8D=E5=B0=9D?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/ctnh_prepare_workspace/action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/actions/ctnh_prepare_workspace/action.yml b/.github/actions/ctnh_prepare_workspace/action.yml index 63324774bf9..9629b748e29 100644 --- a/.github/actions/ctnh_prepare_workspace/action.yml +++ b/.github/actions/ctnh_prepare_workspace/action.yml @@ -27,6 +27,15 @@ inputs: required: false default: dev + ctnh_astral_repository: + description: CTNH-Astral repository. + required: false + default: CTNH-Team/CTNH-Astral + ctnh_astral_ref: + description: CTNH-Astral ref. + required: false + default: dev + ctnh_bio_repository: description: CTNH-Bio repository. required: false @@ -108,6 +117,15 @@ runs: ref: ${{ inputs.ctnh_core_ref }} path: CTNH-Modules/modules/CTNH-Core + - name: Checkout CTNH-Astral + if: ${{ inputs.module_name != 'CTNH-Astral' }} + uses: actions/checkout@v4 + with: + token: ${{ inputs.token }} + repository: ${{ inputs.ctnh_astral_repository }} + ref: ${{ inputs.ctnh_astral_ref }} + path: CTNH-Modules/modules/CTNH-Astral + - name: Checkout CTNH-Bio if: ${{ inputs.module_name != 'CTNH-Bio' }} uses: actions/checkout@v4 From 367462527cab45cd203e438201314eef21b33fe3 Mon Sep 17 00:00:00 2001 From: Donjuanplatinum Date: Sun, 14 Jun 2026 14:06:40 +0800 Subject: [PATCH 76/78] ci(): fix ci error reports --- .../gtceu/common/data/GTBlocks.java | 24 ++++++++++++------- .../gtceu/common/data/GTParticleTypes.java | 15 ++++++++---- .../machine/electric/FisherMachine.java | 10 ++++++-- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index 241aa9101ff..5fbf38f680f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -1180,15 +1180,23 @@ public static ItemColor leavesItemColor() { .lang("Brittle Charcoal") .exBlockstate(GTModels.cubeAllModel(GTCEu.id("block/misc/brittle_charcoal"))) .tag(BlockTags.MINEABLE_WITH_SHOVEL) - .item((b, p) -> new BlockItem(b, p) { - - @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, - TooltipFlag isAdvanced) { - super.appendHoverText(stack, level, tooltipComponents, isAdvanced); - tooltipComponents.add(1, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.0")); - tooltipComponents.add(2, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.1")); + .item((b, p) -> { + class BrittleCharcoalItem extends BlockItem { + + BrittleCharcoalItem(Block block, Item.Properties properties) { + super(block, properties); + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level level, + List tooltipComponents, + TooltipFlag isAdvanced) { + super.appendHoverText(stack, level, tooltipComponents, isAdvanced); + tooltipComponents.add(1, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.0")); + tooltipComponents.add(2, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.1")); + } } + return new BrittleCharcoalItem(b, p); }) .build() .register(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java index 8bc29948a19..4062bff1600 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java @@ -18,12 +18,19 @@ public class GTParticleTypes { .create(Registries.PARTICLE_TYPE, GTCEu.MOD_ID); public static final RegistryObject> HAZARD_PARTICLE = PARTICLE_TYPES - .register("hazard", () -> new ParticleType<>(false, HazardParticleOptions.DESERIALIZER) { + .register("hazard", () -> { + class HazardParticle extends ParticleType { - @Override - public Codec codec() { - return HazardParticleOptions.CODEC; + HazardParticle() { + super(false, HazardParticleOptions.DESERIALIZER); + } + + @Override + public Codec codec() { + return HazardParticleOptions.CODEC; + } } + return new HazardParticle(); }); public static final RegistryObject MUFFLER_PARTICLE = PARTICLE_TYPES .register("muffler", () -> new SimpleParticleType(false)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java index 30c7116a969..19abe03fff3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java @@ -48,6 +48,7 @@ import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; @@ -255,12 +256,17 @@ public void fishingUpdate() { lootTable = getLevel().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING_FISH); } - FishingHook simulatedHook = new FishingHook(EntityType.FISHING_BOBBER, getLevel()) { + class SimulatedFishingHook extends FishingHook { + + SimulatedFishingHook(EntityType type, Level level) { + super(type, level); + } public boolean isOpenWaterFishing() { return true; } - }; + } + FishingHook simulatedHook = new SimulatedFishingHook(EntityType.FISHING_BOBBER, getLevel()); LootParams lootContext = new LootParams.Builder((ServerLevel) getLevel()) .withOptionalParameter(LootContextParams.THIS_ENTITY, simulatedHook) From 5aa64618ca9c0d06918f291bad4f7ee2133b3f98 Mon Sep 17 00:00:00 2001 From: lucky_block <1774432258@qq.com> Date: Mon, 15 Jun 2026 11:39:36 +0800 Subject: [PATCH 77/78] Revert "ci(): fix ci error reports" This reverts commit 367462527cab45cd203e438201314eef21b33fe3. --- .../gtceu/common/data/GTBlocks.java | 24 +++++++------------ .../gtceu/common/data/GTParticleTypes.java | 15 ++++-------- .../machine/electric/FisherMachine.java | 10 ++------ 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index 5fbf38f680f..241aa9101ff 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -1180,23 +1180,15 @@ public static ItemColor leavesItemColor() { .lang("Brittle Charcoal") .exBlockstate(GTModels.cubeAllModel(GTCEu.id("block/misc/brittle_charcoal"))) .tag(BlockTags.MINEABLE_WITH_SHOVEL) - .item((b, p) -> { - class BrittleCharcoalItem extends BlockItem { - - BrittleCharcoalItem(Block block, Item.Properties properties) { - super(block, properties); - } - - @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, - List tooltipComponents, - TooltipFlag isAdvanced) { - super.appendHoverText(stack, level, tooltipComponents, isAdvanced); - tooltipComponents.add(1, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.0")); - tooltipComponents.add(2, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.1")); - } + .item((b, p) -> new BlockItem(b, p) { + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { + super.appendHoverText(stack, level, tooltipComponents, isAdvanced); + tooltipComponents.add(1, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.0")); + tooltipComponents.add(2, Component.translatable("tile.gtceu.brittle_charcoal.tooltip.1")); } - return new BrittleCharcoalItem(b, p); }) .build() .register(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java index 4062bff1600..8bc29948a19 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTParticleTypes.java @@ -18,19 +18,12 @@ public class GTParticleTypes { .create(Registries.PARTICLE_TYPE, GTCEu.MOD_ID); public static final RegistryObject> HAZARD_PARTICLE = PARTICLE_TYPES - .register("hazard", () -> { - class HazardParticle extends ParticleType { + .register("hazard", () -> new ParticleType<>(false, HazardParticleOptions.DESERIALIZER) { - HazardParticle() { - super(false, HazardParticleOptions.DESERIALIZER); - } - - @Override - public Codec codec() { - return HazardParticleOptions.CODEC; - } + @Override + public Codec codec() { + return HazardParticleOptions.CODEC; } - return new HazardParticle(); }); public static final RegistryObject MUFFLER_PARTICLE = PARTICLE_TYPES .register("muffler", () -> new SimpleParticleType(false)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java index 19abe03fff3..30c7116a969 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java @@ -48,7 +48,6 @@ import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; @@ -256,17 +255,12 @@ public void fishingUpdate() { lootTable = getLevel().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING_FISH); } - class SimulatedFishingHook extends FishingHook { - - SimulatedFishingHook(EntityType type, Level level) { - super(type, level); - } + FishingHook simulatedHook = new FishingHook(EntityType.FISHING_BOBBER, getLevel()) { public boolean isOpenWaterFishing() { return true; } - } - FishingHook simulatedHook = new SimulatedFishingHook(EntityType.FISHING_BOBBER, getLevel()); + }; LootParams lootContext = new LootParams.Builder((ServerLevel) getLevel()) .withOptionalParameter(LootContextParams.THIS_ENTITY, simulatedHook) From 30883fac0fe59bc2c2c57dd3775bddb91c16cb99 Mon Sep 17 00:00:00 2001 From: cu6 <3077476144@qq.com> Date: Mon, 15 Jun 2026 12:38:34 +0800 Subject: [PATCH 78/78] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E5=85=A5GTM?= =?UTF-8?q?=E7=89=A9=E5=93=81json=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gtceu/api/item/IItemModelModifier.java | 12 ++++ .../registrate/CustomItemModelRegistry.java | 70 +++++++++++++++++++ .../registrate/provider/GTModelRules.java | 23 ++++++ .../gregtechceu/gtceu/client/ClientProxy.java | 2 + .../data/pack/GTDynamicResourcePack.java | 15 ++++ 5 files changed, 122 insertions(+) create mode 100644 src/main/java/com/gregtechceu/gtceu/api/item/IItemModelModifier.java create mode 100644 src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CustomItemModelRegistry.java create mode 100644 src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTModelRules.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/IItemModelModifier.java b/src/main/java/com/gregtechceu/gtceu/api/item/IItemModelModifier.java new file mode 100644 index 00000000000..fb121ab0553 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/item/IItemModelModifier.java @@ -0,0 +1,12 @@ +package com.gregtechceu.gtceu.api.item; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; + +import com.google.gson.JsonObject; + +@FunctionalInterface +public interface IItemModelModifier { + + void modify(Item item, ResourceLocation itemId, JsonObject modelJson); +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CustomItemModelRegistry.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CustomItemModelRegistry.java new file mode 100644 index 00000000000..d6a33e1ce3f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CustomItemModelRegistry.java @@ -0,0 +1,70 @@ +package com.gregtechceu.gtceu.api.registry.registrate; + +import com.gregtechceu.gtceu.api.item.IItemModelModifier; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraftforge.registries.ForgeRegistries; + +import com.google.gson.JsonObject; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; + +public class CustomItemModelRegistry { + + private static final Map> EXACT_MODIFIERS = new HashMap<>(); + private static final Map, List> PREDICATE_MODIFIERS = new HashMap<>(); + private static final Map> ID_MODIFIERS = new HashMap<>(); + + public static void register(Item item, IItemModelModifier modifier) { + EXACT_MODIFIERS.computeIfAbsent(item, k -> new ArrayList<>()).add(modifier); + } + + public static void register(Predicate condition, IItemModelModifier modifier) { + PREDICATE_MODIFIERS.computeIfAbsent(condition, k -> new ArrayList<>()).add(modifier); + } + + public static void register(ResourceLocation itemId, IItemModelModifier modifier) { + ID_MODIFIERS.computeIfAbsent(itemId, k -> new ArrayList<>()).add(modifier); + } + + public static void register(String itemIdStr, IItemModelModifier modifier) { + ResourceLocation id = ResourceLocation.tryParse(itemIdStr); + if (id != null) { + register(id, modifier); + } else { + System.err.println("Invalid ResourceLocation format: " + itemIdStr); + } + } + + public static void modifyOnTheFly(ResourceLocation id, JsonObject modelJson) { + if (ID_MODIFIERS.containsKey(id)) { + Item item = ForgeRegistries.ITEMS.getValue(id); + for (IItemModelModifier modifier : ID_MODIFIERS.get(id)) { + modifier.modify(item, id, modelJson); + } + } + + Item item = ForgeRegistries.ITEMS.getValue(id); + if (item != null && item != Items.AIR) { + + if (EXACT_MODIFIERS.containsKey(item)) { + for (IItemModelModifier modifier : EXACT_MODIFIERS.get(item)) { + modifier.modify(item, id, modelJson); + } + } + for (Map.Entry, List> predEntry : PREDICATE_MODIFIERS.entrySet()) { + if (predEntry.getKey().test(item)) { + for (IItemModelModifier modifier : predEntry.getValue()) { + modifier.modify(item, id, modelJson); + } + } + } + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTModelRules.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTModelRules.java new file mode 100644 index 00000000000..c3e1485941b --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/provider/GTModelRules.java @@ -0,0 +1,23 @@ +package com.gregtechceu.gtceu.api.registry.registrate.provider; + +public class GTModelRules { + + public static void init() { + // 演示: + // CustomItemModelRegistry.register("gtceu:copper_bolt", (item, id, json) -> { + // + // json.addProperty("loader", "avaritia:halo"); + // + // JsonObject haloJson = new JsonObject(); + // haloJson.addProperty("texture", "#halo"); + // haloJson.addProperty("color", 1308622847); + // haloJson.addProperty("size", 6); + // haloJson.addProperty("pulse", false); + // json.add("halo", haloJson); + // + // JsonObject textures = json.has("textures") ? json.getAsJsonObject("textures") : new JsonObject(); + // textures.addProperty("halo", "avaritia:misc/halo_noise"); + // json.add("textures", textures); + // }); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index c4bc0f934da..8ec6197934f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.LampBlockItem; import com.gregtechceu.gtceu.api.item.QuantumTankMachineItem; +import com.gregtechceu.gtceu.api.registry.registrate.provider.GTModelRules; import com.gregtechceu.gtceu.client.model.item.FacadeUnbakedModel; import com.gregtechceu.gtceu.client.model.machine.MachineModelLoader; import com.gregtechceu.gtceu.client.model.pipe.PipeModel; @@ -151,6 +152,7 @@ public void onRegisterParticleProviders(RegisterParticleProvidersEvent event) { @SubscribeEvent public void onClientSetup(FMLClientSetupEvent event) { MachineOwner.init(); + GTModelRules.init(); if (ConfigHolder.INSTANCE.compat.minimap.toggle.ftbChunksIntegration && GTCEu.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { FTBChunksPlugin.addEventListeners(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java index 986d7be8744..ef31e378a2a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; +import com.gregtechceu.gtceu.api.registry.registrate.CustomItemModelRegistry; import com.gregtechceu.gtceu.config.ConfigHolder; import net.minecraft.MethodsReturnNonnullByDefault; @@ -25,6 +26,7 @@ import com.google.common.collect.Sets; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.mojang.serialization.JsonOps; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectSet; @@ -50,6 +52,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault +@SuppressWarnings("removal") public class GTDynamicResourcePack implements PackResources { protected static final ObjectSet CLIENT_DOMAINS = new ObjectOpenHashSet<>(); @@ -110,6 +113,18 @@ public static void addItemModel(ResourceLocation loc, JsonElement obj) { if (!loc.getPath().startsWith("item/")) { loc = loc.withPrefix("item/"); } + + if (obj != null && obj.isJsonObject()) { + JsonObject modelJson = obj.getAsJsonObject(); + + ResourceLocation registryId = loc; + if (registryId.getPath().startsWith("item/")) { + registryId = new ResourceLocation(registryId.getNamespace(), registryId.getPath().substring(5)); + } + + CustomItemModelRegistry.modifyOnTheFly(registryId, modelJson); + } + addModel(loc, obj); }