Skip to content

Commit 0160791

Browse files
authored
Add methods to change a material's composition (#2630)
1 parent 0911bbf commit 0160791

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

src/main/java/gregtech/api/unification/material/Material.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,22 @@
1010
import gregtech.api.unification.material.info.MaterialFlag;
1111
import gregtech.api.unification.material.info.MaterialFlags;
1212
import gregtech.api.unification.material.info.MaterialIconSet;
13-
import gregtech.api.unification.material.properties.*;
13+
import gregtech.api.unification.material.properties.BlastProperty;
14+
import gregtech.api.unification.material.properties.DustProperty;
15+
import gregtech.api.unification.material.properties.FluidPipeProperties;
16+
import gregtech.api.unification.material.properties.FluidProperty;
17+
import gregtech.api.unification.material.properties.GemProperty;
18+
import gregtech.api.unification.material.properties.IMaterialProperty;
19+
import gregtech.api.unification.material.properties.IngotProperty;
20+
import gregtech.api.unification.material.properties.ItemPipeProperties;
21+
import gregtech.api.unification.material.properties.MaterialProperties;
22+
import gregtech.api.unification.material.properties.OreProperty;
23+
import gregtech.api.unification.material.properties.PolymerProperty;
24+
import gregtech.api.unification.material.properties.PropertyKey;
25+
import gregtech.api.unification.material.properties.RotorProperty;
26+
import gregtech.api.unification.material.properties.ToolProperty;
27+
import gregtech.api.unification.material.properties.WireProperties;
28+
import gregtech.api.unification.material.properties.WoodProperty;
1429
import gregtech.api.unification.material.registry.MaterialRegistry;
1530
import gregtech.api.unification.stack.MaterialStack;
1631
import gregtech.api.util.FluidTooltipUtil;
@@ -35,7 +50,11 @@
3550
import stanhebben.zenscript.annotations.ZenMethod;
3651
import stanhebben.zenscript.annotations.ZenOperator;
3752

38-
import java.util.*;
53+
import java.util.ArrayList;
54+
import java.util.Arrays;
55+
import java.util.Collection;
56+
import java.util.List;
57+
import java.util.Objects;
3958
import java.util.function.Consumer;
4059
import java.util.function.UnaryOperator;
4160

@@ -110,6 +129,14 @@ public Material setFormula(String formula, boolean withFormatting) {
110129
return this;
111130
}
112131

132+
@ZenMethod
133+
public Material setComponents(MaterialStack... components) {
134+
this.materialInfo.setComponents(components);
135+
this.chemicalFormula = null;
136+
this.chemicalFormula = calculateChemicalFormula();
137+
return this;
138+
}
139+
113140
public ImmutableList<MaterialStack> getMaterialComponents() {
114141
return materialInfo.componentList;
115142
}
@@ -1172,5 +1199,10 @@ private void verifyInfo(MaterialProperties p, boolean averageRGB) {
11721199
}
11731200
}
11741201
}
1202+
1203+
public MaterialInfo setComponents(MaterialStack... components) {
1204+
this.componentList = ImmutableList.copyOf(Arrays.asList(components));
1205+
return this;
1206+
}
11751207
}
11761208
}

0 commit comments

Comments
 (0)