diff --git a/src/main/java/gregtech/api/unification/material/Material.java b/src/main/java/gregtech/api/unification/material/Material.java index dbcee3e6a8b..d5706e8e810 100644 --- a/src/main/java/gregtech/api/unification/material/Material.java +++ b/src/main/java/gregtech/api/unification/material/Material.java @@ -8,6 +8,7 @@ import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.Element; import gregtech.api.unification.Elements; +import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.info.MaterialFlag; import gregtech.api.unification.material.info.MaterialFlags; import gregtech.api.unification.material.info.MaterialIconSet; @@ -29,6 +30,7 @@ import gregtech.api.unification.material.properties.WireProperties; import gregtech.api.unification.material.properties.WoodProperty; import gregtech.api.unification.material.registry.MaterialRegistry; +import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; @@ -36,6 +38,7 @@ import gregtech.api.util.SmallDigits; import net.minecraft.enchantment.Enchantment; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -278,6 +281,27 @@ public FluidStack getFluid(@NotNull FluidStorageKey key, int amount) { return new FluidStack(getFluid(key), amount); } + /** + * Gets the item form of this material in the form of an {@link OrePrefix} + * + * @param prefix the ore prefix to use + * @return an item stack of the ore prefix using this material + */ + public @NotNull ItemStack getItemForm(@NotNull OrePrefix prefix) { + return OreDictUnifier.get(prefix, this); + } + + /** + * Gets the item form of this material in the form of an {@link OrePrefix} + * + * @param prefix the ore prefix to use + * @param count the amount the ItemStack will have + * @return an item stack of the ore prefix using this material + */ + public @NotNull ItemStack getItemForm(@NotNull OrePrefix prefix, int count) { + return OreDictUnifier.get(prefix, this, count); + } + public int getBlockHarvestLevel() { if (!hasProperty(PropertyKey.DUST)) { throw new IllegalArgumentException( diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java index 0a159028f1d..ad05ae197ae 100644 --- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java +++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java @@ -1,5 +1,6 @@ package gregtech.api.unification.ore; +import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.MarkerMaterials; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; @@ -12,6 +13,7 @@ import gregtech.common.ConfigHolder; import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; import com.google.common.base.Preconditions; import crafttweaker.annotations.ZenRegister; @@ -703,6 +705,27 @@ public boolean isMarkerPrefix() { return isMarkerPrefix; } + /** + * Gets the item form of this ore prefix using a {@link Material} + * + * @param material the Material to use + * @return an ItemStack of the Material using this ore prefix + */ + public @NotNull ItemStack getItemForm(@NotNull Material material) { + return OreDictUnifier.get(this, material); + } + + /** + * Gets the item form of this ore prefix using a {@link Material} + * + * @param material the Material to use + * @param count the amount the ItemStack will have + * @return an ItemStack of the Material using this ore prefix + */ + public @NotNull ItemStack getItemForm(@NotNull Material material, int count) { + return OreDictUnifier.get(this, material, count); + } + @Override public boolean equals(Object o) { if (this == o) return true;