diff --git a/patches/net/minecraft/data/models/ModelProvider.java.patch b/patches/net/minecraft/data/models/ModelProvider.java.patch index 16a7ee9b06..edb7645dda 100644 --- a/patches/net/minecraft/data/models/ModelProvider.java.patch +++ b/patches/net/minecraft/data/models/ModelProvider.java.patch @@ -28,26 +28,39 @@ } @Override -@@ -52,19 +_,18 @@ +@@ -52,19 +_,14 @@ } }; Consumer consumer1 = set::add; - new BlockModelGenerators(consumer, biconsumer, consumer1).run(); - new ItemModelGenerators(biconsumer).run(); -+ registerModels(new BlockModelGenerators(consumer, biconsumer, consumer1, this.modId), new ItemModelGenerators(biconsumer, this.modId)); - List list = BuiltInRegistries.BLOCK - .entrySet() - .stream() +- List list = BuiltInRegistries.BLOCK +- .entrySet() +- .stream() - .filter(p_300706_ -> true) -+ .filter(p_300706_ -> p_300706_.getKey().location().getNamespace().equals(modId)) - .map(Entry::getValue) +- .map(Entry::getValue) ++ registerModels(new BlockModelGenerators(consumer, biconsumer, consumer1, this.modId), new ItemModelGenerators(biconsumer, this.modId)); ++ List list = getKnownBlocks() .filter(p_125117_ -> !map.containsKey(p_125117_)) .toList(); if (!list.isEmpty()) { throw new IllegalStateException("Missing blockstate definitions for: " + list); } else { - BuiltInRegistries.BLOCK.forEach(p_125128_ -> { -+ BuiltInRegistries.BLOCK.stream().filter(block -> BuiltInRegistries.BLOCK.getKey(block).getNamespace().equals(modId)).forEach(p_125128_ -> { ++ getKnownBlocks().forEach(p_125128_ -> { Item item = Item.BY_BLOCK.get(p_125128_); if (item != null) { if (set.contains(item)) { +@@ -95,5 +_,12 @@ + @Override + public String getName() { + return "Model Definitions"; ++ } ++ ++ protected java.util.stream.Stream getKnownBlocks() { ++ return BuiltInRegistries.BLOCK.entrySet() ++ .stream() ++ .filter(block -> block.getKey().location().getNamespace().equals(modId)) ++ .map(Entry::getValue); + } + } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 8a5349efc4..5734c2fa21 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -515,4 +515,5 @@ public net.minecraft.data.models.model.ModelTemplate * public net.minecraft.data.models.model.TexturedModel (Lnet/minecraft/data/models/model/TextureMapping;Lnet/minecraft/data/models/model/ModelTemplate;)V public net.minecraft.data.models.model.TexturedModel createDefault(Ljava/util/function/Function;Lnet/minecraft/data/models/model/ModelTemplate;)Lnet/minecraft/data/models/model/TexturedModel$Provider; public net.minecraft.data.models.model.TextureSlot create(Ljava/lang/String;)Lnet/minecraft/data/models/model/TextureSlot; -public net.minecraft.data.models.model.TextureSlot create(Ljava/lang/String;Lnet/minecraft/data/models/model/TextureSlot;)Lnet/minecraft/data/models/model/TextureSlot; \ No newline at end of file +public net.minecraft.data.models.model.TextureSlot create(Ljava/lang/String;Lnet/minecraft/data/models/model/TextureSlot;)Lnet/minecraft/data/models/model/TextureSlot; +public-f net.minecraft.data.models.ModelProvider getName()Ljava/lang/String;