-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/com/wenxin2/marioverse/mixin/EntityRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters