Skip to content

Commit

Permalink
Increase shadow size of wider mobs
Browse files Browse the repository at this point in the history
  • Loading branch information
WenXin20 committed Dec 30, 2024
1 parent 54e87ed commit 9ddab6e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.wenxin2.marioverse.mixin;

import com.wenxin2.marioverse.init.AttributesRegistry;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeMap;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EntityRenderer.class)
public abstract class EntityRendererMixin<T extends Entity> {
@Inject(method = "getShadowRadius(Lnet/minecraft/world/entity/Entity;)F", at = @At("RETURN"), cancellable = true)
public void getShadowRadius(T entity, CallbackInfoReturnable<Float> cir) {
if (entity instanceof LivingEntity livingEntity) {
AttributeMap attributemap = livingEntity.getAttributes();
float widthScale = (float) attributemap.getValue(AttributesRegistry.WIDTH_SCALE);

if (widthScale != 1)
cir.setReturnValue(cir.getReturnValue() * widthScale / 1.25F);
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/marioverse.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"TrapDoorBlockMixin"
],
"client": [
"EntityRendererMixin",
"GeoEntityRendererMixin",
"HumanoidArmorLayerMixin",
"LivingEntityClientMixin",
Expand Down

0 comments on commit 9ddab6e

Please sign in to comment.