Merge remote-tracking branch 'origin/1.20' into 1.20.4

This commit is contained in:
embeddedt 2024-03-17 15:56:32 -04:00
commit 72845d8952
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -11,7 +11,6 @@ import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModList; import net.neoforged.fml.ModList;
@ -41,11 +40,13 @@ public class ModelBakeEventHelper {
public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) { public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) {
this.modelRegistry = modelRegistry; this.modelRegistry = modelRegistry;
this.topLevelModelLocations = new HashSet<>(modelRegistry.keySet()); this.topLevelModelLocations = new HashSet<>(modelRegistry.keySet());
for(Block block : BuiltInRegistries.BLOCK) { // Skip going through ModelLocationCache because most of the accesses will be misses
for(BlockState state : block.getStateDefinition().getPossibleStates()) { BuiltInRegistries.BLOCK.entrySet().forEach(entry -> {
topLevelModelLocations.add(BlockModelShaper.stateToModelLocation(state)); var location = entry.getKey().location();
for(BlockState state : entry.getValue().getStateDefinition().getPossibleStates()) {
topLevelModelLocations.add(BlockModelShaper.stateToModelLocation(location, state));
} }
} });
BuiltInRegistries.ITEM.keySet().forEach(location -> topLevelModelLocations.add(new ModelResourceLocation(location, "inventory"))); BuiltInRegistries.ITEM.keySet().forEach(location -> topLevelModelLocations.add(new ModelResourceLocation(location, "inventory")));
this.dependencyGraph = GraphBuilder.undirected().build(); this.dependencyGraph = GraphBuilder.undirected().build();
ModList.get().forEachModContainer((id, mc) -> { ModList.get().forEachModContainer((id, mc) -> {