test(annotations): New @RequireAnnotation

New annotation @RequireAnnotation can be used on annotations so that all
classes with that specific annotation must also have another annotation.
If this is not true, test will not pass. This annotation takes array of
annotations.
This commit is contained in:
2025-03-16 20:37:24 +01:00
parent e1190f7e6a
commit 53a3ae43f3
15 changed files with 72 additions and 42 deletions

View File

@ -7,6 +7,7 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RequireAnnotation(BlockRegistry.class)
public @interface BlockDropPercentage {
int value();
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@RequireAnnotation(BlockRegistry.class)
public @interface BreakableByWater {
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RequireAnnotation(BlockRegistry.class)
public @interface BreaksByPlace {
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RequireAnnotation(BlockRegistry.class)
public @interface BreaksFalling {
}

View File

@ -5,6 +5,7 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Repeatable(CustomDrops.class)
@RequireAnnotation(BlockRegistry.class)
public @interface CustomDrop {
String tool();
String drops();

View File

@ -7,6 +7,7 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RequireAnnotation(ItemRegistry.class)
public @interface Fuel {
double value();
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@RequireAnnotation(BlockRegistry.class)
public @interface PlaceOnSolid {
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@RequireAnnotation(BlockRegistry.class)
public @interface PlaceOnSolidNoHandler {
}

View File

@ -0,0 +1,9 @@
package cz.jzitnik.game.annotations;
import java.lang.annotation.*;
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface RequireAnnotation {
Class<? extends Annotation>[] value();
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@RequireAnnotation(BlockRegistry.class)
public @interface ResetDataOnMine {
}

View File

@ -7,5 +7,6 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RequireAnnotation(BlockRegistry.class)
public @interface Sapling {
}

View File

@ -7,6 +7,7 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RequireAnnotation(ItemRegistry.class)
public @interface Smeltable {
String value();
}

View File

@ -4,7 +4,7 @@ import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
@CraftingRecipeRegistry(
recipe = {
"Allium", "_", "_",
"allium", "_", "_",
"_", "_", "_",
"_", "_", "_"
},