Skip to content

Commit

Permalink
Allow disabling small/tiny piles of dust via material flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince committed Dec 20, 2024
1 parent 8899ada commit 35e3ce9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`
- `STICKY`
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 35e3ce9

Please sign in to comment.