Fix @SafeVarargs warnings in Resource Conditions and ColorProviderRegistry (#2547)

This commit is contained in:
Technici4n 2022-09-25 15:47:00 +02:00 committed by GitHub
parent c6af733cfb
commit a29562c81b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View file

@ -36,6 +36,7 @@ public interface ColorProviderRegistry<T, Provider> {
* @param provider The color provider to register.
* @param objects The objects which should be colored using this provider.
*/
@SuppressWarnings("unchecked") // @SafeVarargs is not allowed on interface methods.
void register(Provider provider, T... objects);
/**

View file

@ -90,6 +90,7 @@ public final class DefaultResourceConditions {
/**
* Create a condition that returns true if each of the passed block tags exists and has at least one element.
*/
@SafeVarargs
public static ConditionJsonProvider blockTagsPopulated(TagKey<Block>... tags) {
return ResourceConditionsImpl.tagsPopulated(BLOCK_TAGS_POPULATED, tags);
}
@ -97,6 +98,7 @@ public final class DefaultResourceConditions {
/**
* Create a condition that returns true if each of the passed fluid tags exists and has at least one element.
*/
@SafeVarargs
public static ConditionJsonProvider fluidTagsPopulated(TagKey<Fluid>... tags) {
return ResourceConditionsImpl.tagsPopulated(FLUID_TAGS_POPULATED, tags);
}
@ -104,6 +106,7 @@ public final class DefaultResourceConditions {
/**
* Create a condition that returns true if each of the passed item tags exists and has at least one element.
*/
@SafeVarargs
public static ConditionJsonProvider itemTagsPopulated(TagKey<Item>... tags) {
return ResourceConditionsImpl.tagsPopulated(ITEM_TAGS_POPULATED, tags);
}

View file

@ -92,6 +92,7 @@ public class ResourceConditionsImpl {
};
}
@SafeVarargs
public static <T> ConditionJsonProvider tagsPopulated(Identifier id, TagKey<T>... tags) {
Preconditions.checkArgument(tags.length > 0, "Must register at least one tag.");