Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying tag prefixes to ignore in material builder. #2627

Open
wants to merge 1 commit into
base: 1.20.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.gregtechceu.gtceu.api.data.chemical.material.properties.*;
import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack;
import com.gregtechceu.gtceu.api.data.medicalcondition.MedicalCondition;
import com.gregtechceu.gtceu.api.data.tag.TagPrefix;
import com.gregtechceu.gtceu.api.data.tag.TagUtil;
import com.gregtechceu.gtceu.api.fluids.FluidBuilder;
import com.gregtechceu.gtceu.api.fluids.FluidState;
Expand Down Expand Up @@ -531,6 +532,7 @@ public static class Builder extends BuilderBase<Material> {
private final MaterialInfo materialInfo;
private final MaterialProperties properties;
private final MaterialFlags flags;
private Set<TagPrefix> ignoredTagPrefixes = null;

/*
* The temporary list of components for this Material.
Expand Down Expand Up @@ -1010,6 +1012,17 @@ public Builder appendFlags(Collection<MaterialFlag> f1, MaterialFlag... f2) {
return this;
}

/**
* Add {@link TagPrefixes} to be ignored by this Material.<br>
*/
public Builder ignoredTagPrefixes(TagPrefix... prefixes) {
if (this.ignoredTagPrefixes == null) {
this.ignoredTagPrefixes = new HashSet<>();
}
this.ignoredTagPrefixes.addAll(Arrays.asList(prefixes));
return this;
}

public Builder element(Element element) {
this.materialInfo.element = element;
return this;
Expand Down Expand Up @@ -1239,6 +1252,9 @@ public Material buildAndRegister() {
var mat = new Material(materialInfo, properties, flags);
materialInfo.verifyInfo(properties, averageRGB);
mat.registerMaterial();
if (ignoredTagPrefixes != null) {
ignoredTagPrefixes.forEach(p -> p.setIgnored(mat));
}
return mat;
}

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 @@ -11,6 +11,7 @@

import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*;
import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet.*;
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*;
import static com.gregtechceu.gtceu.common.data.GTMaterials.*;

public class UnknownCompositionMaterials {
Expand Down Expand Up @@ -542,6 +543,7 @@ public static void register() {
.gem()
.color(0x7497ea).secondaryColor(0x1c0b39).iconSet(DIAMOND)
.flags(NO_UNIFICATION)
.ignoredTagPrefixes(dustTiny, dustSmall)
.buildAndRegister();

TreatedWood = new Material.Builder(GTCEu.id("treated_wood"))
Expand Down
Loading