Skip to content

Commit

Permalink
Fix version differences
Browse files Browse the repository at this point in the history
  • Loading branch information
fonnymunkey committed Jul 23, 2024
1 parent 41714dc commit d5cc721
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/main/java/fonnymunkey/simplehats/SimpleHats.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.minecraft.item.ItemGroup;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/fonnymunkey/simplehats/client/hat/HatLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.ModelWithHead;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.ZombieVillagerEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.math.Vec3f;

public class HatLayer<T extends LivingEntity, M extends EntityModel<T> & ModelWithHead> extends FeatureRenderer<T, M> {

Expand Down Expand Up @@ -57,7 +57,7 @@ private void render(ItemStack itemStack, MatrixStack poseStack, VertexConsumerPr

this.getContextModel().getHead().rotate(poseStack);
translateToHead(poseStack, flag);
MinecraftClient.getInstance().getEntityRenderDispatcher().getHeldItemRenderer().renderItem(livingEntity, itemStack, ModelTransformationMode.HEAD, false, poseStack, buffer, packedLight);
MinecraftClient.getInstance().getEntityRenderDispatcher().getHeldItemRenderer().renderItem(livingEntity, itemStack, ModelTransformation.Mode.HEAD, false, poseStack, buffer, packedLight);

poseStack.pop();
}
Expand All @@ -79,7 +79,7 @@ private void render(ItemStack itemStack, MatrixStack poseStack, VertexConsumerPr

private static void translateToHead(MatrixStack pPoseStack, boolean pIsVillager) {
pPoseStack.translate(0.0F, -0.25F, 0.0F);
pPoseStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F));
pPoseStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180.0F));
pPoseStack.scale(0.625F, -0.625F, -0.625F);
if(pIsVillager) {
pPoseStack.translate(0.0F, 0.1875F, 0.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.math.Vec3f;

public class HatDisplayLayer<T extends LivingEntity, M extends EntityModel<T>> extends FeatureRenderer<T, M> {

Expand All @@ -33,10 +33,10 @@ public void render(MatrixStack matrixStack, VertexConsumerProvider renderTypeBuf
matrixStack.translate(0D, 0.97D, 0.0D);

matrixStack.scale(0.66F, 0.66F, 0.66F);
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180.0F));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F));
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(180.0F));
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180.0F));

MinecraftClient.getInstance().getEntityRenderDispatcher().getHeldItemRenderer().renderItem(livingEntity, stack, ModelTransformationMode.HEAD, false, matrixStack, renderTypeBuffer, light);
MinecraftClient.getInstance().getEntityRenderDispatcher().getHeldItemRenderer().renderItem(livingEntity, stack, ModelTransformation.Mode.HEAD, false, matrixStack, renderTypeBuffer, light);

matrixStack.pop();
}
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/fonnymunkey/simplehats/common/item/HatItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,19 @@
import dev.emi.trinkets.api.TrinketItem;
import dev.emi.trinkets.api.client.TrinketRenderer;
import fonnymunkey.simplehats.SimpleHats;
import fonnymunkey.simplehats.common.entity.HatDisplay;
import fonnymunkey.simplehats.common.init.ModRegistry;
import fonnymunkey.simplehats.util.HatEntry;
import fonnymunkey.simplehats.util.HatEntry.HatParticleSettings;
import fonnymunkey.simplehats.util.UUIDHandler;
import net.minecraft.client.MinecraftClient;
import fonnymunkey.simplehats.util.HatEntry;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text;
import net.minecraft.util.math.Vec3f;
import net.minecraft.world.World;

import java.util.List;
Expand Down

0 comments on commit d5cc721

Please sign in to comment.