Skip to content

Commit

Permalink
fix models sus
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Jun 28, 2024
1 parent 22c810f commit 7a3ff37
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TwoModelsItemRegistry {
public static void register(Item... items) {
for(Item item : items) {
Identifier id = Registries.ITEM.getId(item);
ENTRIES.put(id, item);
ENTRIES.put(Identifier.of(id.getNamespace(), "item/" + id.getPath() + "_in_hand"), item);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.util.Identifier;
import ru.theone_ss.vanilla_claws.item.ClawsItem;
import ru.theone_ss.vanilla_claws.registry.VanillaClawsItems;

Expand All @@ -16,8 +14,7 @@ public void onInitializeClient() {
if (item instanceof ClawsItem) TwoModelsItemRegistry.register(item);
});

ModelLoadingPlugin.register(pluginContext -> TwoModelsItemRegistry.ENTRIES.forEach((identifier, item) ->
pluginContext.addModels(new ModelIdentifier(Identifier.of(identifier + "_in_hand"), ModelIdentifier.INVENTORY_VARIANT).id())));
ModelLoadingPlugin.register(pluginContext -> TwoModelsItemRegistry.ENTRIES.forEach((identifier, item) -> pluginContext.addModels(identifier)));
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ru.theone_ss.vanilla_claws.mixin.client;

import net.fabricmc.fabric.api.client.model.loading.v1.FabricBakedModelManager;
import net.minecraft.block.Block;
import net.minecraft.block.StainedGlassPaneBlock;
import net.minecraft.block.TranslucentBlock;
Expand All @@ -17,6 +18,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MatrixUtil;
import net.minecraft.world.World;
Expand Down Expand Up @@ -67,7 +69,7 @@ public static VertexConsumer getItemGlintConsumer(VertexConsumerProvider vertexC
void getModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
TwoModelsItemRegistry.ENTRIES.forEach((id, item) -> {
if (!stack.isEmpty() && stack.isOf(item) && entity != null) {
BakedModel model = models.getModelManager().getModel(new ModelIdentifier(Identifier.of(id + "_in_hand"), "inventory"));
BakedModel model = ((FabricBakedModelManager)models.getModelManager()).getModel(id);
cir.setReturnValue(model);
}
});
Expand Down Expand Up @@ -137,7 +139,7 @@ void renderItem(ItemStack stack, ModelTransformationMode renderMode, boolean lef
if (bl) {

matrices.push();
BakedModel bakedModel = models.getModelManager().getModel(new ModelIdentifier(identifier, "inventory"));
BakedModel bakedModel = models.getModel(item);
bakedModel.getTransformation().getTransformation(renderMode).apply(leftHanded, matrices);
matrices.translate(-0.5F, -0.5F, -0.5F);

Expand Down

0 comments on commit 7a3ff37

Please sign in to comment.