Skip to content

Commit

Permalink
Made setVariantParameter static
Browse files Browse the repository at this point in the history
  • Loading branch information
MeAlam1 committed Nov 19, 2024
1 parent 99da235 commit 2b1a999
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,25 @@ public String getJsonKey() {
* @author MeAlam
* @since 1.0.0
*/
public String getVariantParameter() {
String variantName = getParameter(variantParameterName);
public static String getVariantParameter() {
String variantName = variantParameterName;
BaseLogger.log(BaseLogLevel.INFO, "Retrieved parameter name: " + variantName, true);
return variantName;
}

/**
* A {@link String} method that retrieves the name of the variant parameter.
* <p>
* The variant name is, by default, stored under the key {@code "variantName"} in the parameters/JSON files.
* Otherwise, the key is stored in the {@link #variantParameterName} field.
* </p>
*
* @return The name of the variant, or {@code null} if the variant name is not found.
* @author MeAlam
* @since 1.0.0
*/
public String filterVariantParameter() {
String variantName = getParameter(variantParameterName); ;
BaseLogger.log(BaseLogLevel.INFO, "Retrieved parameter name: " + variantName, true);
return variantName;
}
Expand All @@ -150,7 +167,7 @@ public String getVariantParameter() {
* @author MeAlam
* @since 1.0.0
*/
public void setVariantParameter(String pCustomVariantName) {
public static void setVariantParameter(String pCustomVariantName) {
variantParameterName = pCustomVariantName;
BaseLogger.log(BaseLogLevel.INFO, "Setting parameter name: " + variantParameterName, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ default ResourceLocation getTextureLocation(String pModId, String pPath) {
default List<String> getEntityVariants(String pEntityName) {
List<VariantParameter> variants = VariantLoader.getVariantsFromEntity(pEntityName);
List<String> variantNames = variants.stream()
.map(VariantParameter::getVariantParameter)
.map(VariantParameter::filterVariantParameter)
.collect(Collectors.toList());
BaseLogger.log(BaseLogLevel.SUCCESS, "Retrieved " + variantNames.size() + " variants for entity: " + pEntityName, true);
return variantNames;
Expand Down

0 comments on commit 2b1a999

Please sign in to comment.