Skip to content

Commit abb8645

Browse files
authored
Add a static method to Material to create a new material builder (#2831)
1 parent 81aba54 commit abb8645

File tree

9 files changed

+654
-641
lines changed

9 files changed

+654
-641
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.google.common.base.Preconditions;
4747
import com.google.common.collect.ImmutableList;
4848
import crafttweaker.annotations.ZenRegister;
49+
import org.jetbrains.annotations.Contract;
4950
import org.jetbrains.annotations.NotNull;
5051
import org.jetbrains.annotations.Nullable;
5152
import org.jetbrains.annotations.Range;
@@ -520,6 +521,18 @@ public MaterialRegistry getRegistry() {
520521
return GregTechAPI.materialManager.getRegistry(getModid());
521522
}
522523

524+
/**
525+
* Create a new {@link Material.Builder}.
526+
*
527+
* @param id The MetaItemSubID for this Material. Must be unique to your mods material registry.
528+
* @param resourceLocation The ModId and Name of this Material. Will be formatted as "<modid>.material.<name>" for
529+
* the Translation Key.
530+
*/
531+
@Contract("_, _ -> new")
532+
public static @NotNull Builder builder(int id, @NotNull ResourceLocation resourceLocation) {
533+
return new Builder(id, resourceLocation);
534+
}
535+
523536
/**
524537
* @since GTCEu 2.0.0
525538
*/

0 commit comments

Comments
 (0)