From f5a4e5cb0f7a04160b51e6a837cf7a4826ce9d73 Mon Sep 17 00:00:00 2001 From: jurrejelle Date: Mon, 29 Jun 2026 19:20:29 +0200 Subject: [PATCH] Add nullability checks with proper errors in TagPrefix BlockProperties --- .../gtceu/api/data/tag/TagPrefix.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java index 1a31777c85c..40d53b30d47 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java @@ -981,8 +981,8 @@ public record OreType(Supplier stoneType, Supplier materia Supplier template, ResourceLocation baseModelLocation, boolean isDoubleDrops, boolean isSand, boolean shouldDropAsItem) {} - public record BlockProperties(Supplier> renderType, - UnaryOperator properties) {} + public record BlockProperties(@NotNull Supplier> renderType, + @NotNull UnaryOperator properties) {} @Getter public final ResourceLocation id; @@ -1024,7 +1024,6 @@ public record BlockProperties(Supplier> renderType, @Setter private BlockItemConstructor blockItemConstructor = MaterialBlockItem::new; @Getter - @Setter private BlockProperties blockProperties = new BlockProperties(() -> RenderType::translucent, UnaryOperator.identity()); @@ -1180,6 +1179,19 @@ public TagPrefix miningToolTag(TagKey tag) { return this; } + public TagPrefix blockProperties(BlockProperties blockProperties) { + if (blockProperties.renderType() == null) { + throw new IllegalArgumentException( + "Could not set blockProperties with null renderType in TagPrefix " + this.id()); + } + if (blockProperties.properties() == null) { + throw new IllegalArgumentException( + "Could not set blockProperties with null properties in TagPrefix " + this.id()); + } + this.blockProperties = blockProperties; + return this; + } + public TagPrefix blockProperties(Supplier> renderType, UnaryOperator properties) { return this.blockProperties(new BlockProperties(renderType, properties));