From 35e3ce98ca8d1732388093dc0361989b169cf040 Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Thu, 19 Dec 2024 16:52:42 -0800 Subject: [PATCH 1/2] Allow disabling small/tiny piles of dust via material flags. --- .../Modpacks/Materials-and-Elements/Material-Flags.md | 3 ++- .../api/data/chemical/material/info/MaterialFlags.java | 8 ++++++++ .../com/gregtechceu/gtceu/api/data/tag/TagPrefix.java | 4 ++-- .../com/gregtechceu/gtceu/common/data/GTMaterials.java | 3 --- .../data/materials/UnknownCompositionMaterials.java | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/content/Modpacks/Materials-and-Elements/Material-Flags.md b/docs/content/Modpacks/Materials-and-Elements/Material-Flags.md index b64387b405..1b1e63f9ec 100644 --- a/docs/content/Modpacks/Materials-and-Elements/Material-Flags.md +++ b/docs/content/Modpacks/Materials-and-Elements/Material-Flags.md @@ -37,6 +37,7 @@ can influence how the material behaves, as well as which items are generated for - `GENERATE_SMALL_GEAR` - `GENERATE_SPRING` - `GENERATE_SPRING_SMALL` +- `NO_GENERATE_DUST_PILES` ## Other Flags @@ -64,4 +65,4 @@ can influence how the material behaves, as well as which items are generated for - `SOLDER_MATERIAL` - `SOLDER_MATERIAL_BAD` - `SOLDER_MATERIAL_GOOD` -- `STICKY` \ No newline at end of file +- `STICKY` diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java index f984562ecf..32aa4e9e5c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java @@ -129,6 +129,14 @@ public String toString() { .requireProps(PropertyKey.DUST) .build(); + /** + * Prevent generating small/tiny piles of dust for this material. + */ + public static final MaterialFlag NO_GENERATE_DUST_PILES = new MaterialFlag.Builder( + "no_generate_dust_piles") + .requireProps(PropertyKey.DUST) + .build(); + /** * This will prevent material from creating Shapeless recipes for dust to block and vice versa * Also preventing extruding and alloy smelting recipes via SHAPE_EXTRUDING/MOLD_BLOCK 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 39cdf1d166..926b4c2906 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 @@ -339,7 +339,7 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.dustSmall) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasDustProperty); + .generationCondition(mat -> mat.hasProperty(PropertyKey.DUST) && !mat.hasFlag(MaterialFlags.NO_GENERATE_DUST_PILES)); // 1/9th of a Dust. public static final TagPrefix dustTiny = new TagPrefix("tinyDust") @@ -351,7 +351,7 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.dustTiny) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasDustProperty); + .generationCondition(mat -> mat.hasProperty(PropertyKey.DUST) && !mat.hasFlag(MaterialFlags.NO_GENERATE_DUST_PILES)); // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material public static final TagPrefix dustImpure = new TagPrefix("impureDust") diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java index b6ff2a27c3..025b71cd24 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java @@ -225,9 +225,6 @@ public static void init() { plate.setIgnored(BorosilicateGlass); foil.setIgnored(BorosilicateGlass); - dustSmall.setIgnored(Lapotron); - dustTiny.setIgnored(Lapotron); - dye.setIgnored(DyeBlack, Items.BLACK_DYE); dye.setIgnored(DyeRed, Items.RED_DYE); dye.setIgnored(DyeGreen, Items.GREEN_DYE); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java index 062ef31404..2c616c6576 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java @@ -538,7 +538,7 @@ public static void register() { Lapotron = new Material.Builder(GTCEu.id("lapotron")) .gem() .color(0x7497ea).secondaryColor(0x1c0b39).iconSet(DIAMOND) - .flags(NO_UNIFICATION) + .flags(NO_UNIFICATION, NO_GENERATE_DUST_PILES) .buildAndRegister(); TreatedWood = new Material.Builder(GTCEu.id("treated_wood")) From 792ebfb30a053587f6c1f77d3e558d79e5c44ade Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Thu, 19 Dec 2024 17:44:22 -0800 Subject: [PATCH 2/2] formatting --- .../java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java index 926b4c2906..6c3faa66ea 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 @@ -339,7 +339,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.dustSmall) .unificationEnabled(true) .generateItem(true) - .generationCondition(mat -> mat.hasProperty(PropertyKey.DUST) && !mat.hasFlag(MaterialFlags.NO_GENERATE_DUST_PILES)); + .generationCondition( + mat -> mat.hasProperty(PropertyKey.DUST) && !mat.hasFlag(MaterialFlags.NO_GENERATE_DUST_PILES)); // 1/9th of a Dust. public static final TagPrefix dustTiny = new TagPrefix("tinyDust") @@ -351,7 +352,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.dustTiny) .unificationEnabled(true) .generateItem(true) - .generationCondition(mat -> mat.hasProperty(PropertyKey.DUST) && !mat.hasFlag(MaterialFlags.NO_GENERATE_DUST_PILES)); + .generationCondition( + mat -> mat.hasProperty(PropertyKey.DUST) && !mat.hasFlag(MaterialFlags.NO_GENERATE_DUST_PILES)); // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material public static final TagPrefix dustImpure = new TagPrefix("impureDust")