mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Fix ModelDiscovery using Item components early (#10418)
This commit is contained in:
1 parent
0749f49b6c
commit
ef224bd2b8
2 files changed
+23
-1
No files matched your search
@@ -0,0 +1,12 @@
|
||||
--- a/net/minecraft/client/resources/model/ModelDiscovery.java
|
||||
+++ b/net/minecraft/client/resources/model/ModelDiscovery.java
|
||||
@@ -37,7 +_,8 @@
|
||||
private static Set<ModelResourceLocation> listMandatoryModels() {
|
||||
Set<ModelResourceLocation> set = new HashSet<>();
|
||||
BuiltInRegistries.ITEM.listElements().forEach(p_368638_ -> {
|
||||
- ResourceLocation resourcelocation = p_368638_.value().components().get(DataComponents.ITEM_MODEL);
|
||||
+ // Forge: Force use vanilla components without gathering mod components in the event
|
||||
+ ResourceLocation resourcelocation = p_368638_.value().vanillaComponents().get(DataComponents.ITEM_MODEL);
|
||||
if (resourcelocation != null) {
|
||||
set.add(ModelResourceLocation.inventory(resourcelocation));
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -123,17 +_,25 @@
|
||||
@@ -123,17 +_,35 @@
|
||||
return this.builtInRegistryHolder;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,16 @@
|
||||
+ }
|
||||
+
|
||||
+ return builtComponents;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Forge: Hack fix used in
|
||||
+ * {@link net.minecraft.client.resources.model.ModelDiscovery#listMandatoryModels ModelBakery.listMandatoryModels},
|
||||
+ * during mod loading, before the Forge event bus is ready.
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal
|
||||
+ public DataComponentMap vanillaComponents() {
|
||||
+ return components;
|
||||
}
|
||||
|
||||
public int getDefaultMaxStackSize() {
|
||||
|
||||
Reference in new issue
Block a user