Skip to content

Commit

Permalink
fix(1.21.4): Fix LayerDefinition registration
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Nov 23, 2024
1 parent 23812e3 commit df49e59
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.model.geom.ModelLayerLocation;
Expand All @@ -14,30 +15,20 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
import java.util.stream.Collectors;

public class FabricBalmRenderers implements BalmRenderers {
private final Map<ModelLayerLocation, Supplier<LayerDefinition>> layerDefinitions = new HashMap<>();

@Override
public ModelLayerLocation registerModel(ResourceLocation location, Supplier<LayerDefinition> layerDefinition) {
ModelLayerLocation modelLayerLocation = new ModelLayerLocation(location, "main");
layerDefinitions.put(modelLayerLocation, layerDefinition);
final var modelLayerLocation = new ModelLayerLocation(location, "main");
EntityModelLayerRegistry.registerModelLayer(modelLayerLocation, layerDefinition::get);
return modelLayerLocation;
}

public Map<ModelLayerLocation, LayerDefinition> createRoots() {
return layerDefinitions.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, it -> it.getValue().get()));
}

@Override
public <T extends Entity> void registerEntityRenderer(Supplier<EntityType<T>> type, EntityRendererProvider<? super T> provider) {
EntityRendererRegistry.register(type.get(), provider);
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion fabric/src/main/resources/balm.fabric.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"ChatComponentMixin",
"CheckboxAccessor",
"EntityModelSetAccessor",
"LayerDefinitionsMixin",
"GuiMixin",
"ImageButtonAccessor",
"ItemInHandRendererMixin",
Expand Down

0 comments on commit df49e59

Please sign in to comment.