mirror of
https://github.com/MinecraftForge/MinecraftForge
synced 2026-08-22 04:26:10 -04:00
Fix ModelDiscovery using Item components early (#10418)
This commit is contained in:
parent
0749f49b6c
commit
ef224bd2b8
2 changed files with 23 additions and 1 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue