top.hendrixshen.magiclib.mixin.minecraft.event.render.EntityRendererMixin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magiclib-minecraft-api-1.19.3-fabric Show documentation
Show all versions of magiclib-minecraft-api-1.19.3-fabric Show documentation
Unleash magic into Minecraft, infuse souls, ascend to heaven!
package top.hendrixshen.magiclib.mixin.minecraft.event.render;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_1297;
import net.minecraft.class_4587;
import net.minecraft.class_4597;
import net.minecraft.class_897;
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.CallbackInfo;
import top.hendrixshen.magiclib.impl.event.EventManager;
import top.hendrixshen.magiclib.impl.event.minecraft.render.RenderEntityEvent;
@Environment(EnvType.CLIENT)
@Mixin(class_897.class)
public class EntityRendererMixin {
@Inject(
method = "render",
at = @At(
value = "HEAD"
)
)
private void preRenderEntity(
T entity,
//#if MC < 11500
//$$ double x,
//$$ double y,
//$$ double z,
//#endif
float yaw,
float tickDelta,
//#if MC > 11404
class_4587 poseStack,
class_4597 source,
int light,
//#endif
CallbackInfo ci
) {
EventManager.dispatch(new RenderEntityEvent.PreRender(RenderEntityEvent.EntityRenderContext.of(
entity,
//#if MC > 11502
poseStack,
//#endif
tickDelta
)));
}
@Inject(
method = "render",
at = @At(
value = "RETURN"
)
)
private void postRenderEntity(
T entity,
//#if MC < 11500
//$$ double x,
//$$ double y,
//$$ double z,
//#endif
float yaw,
float tickDelta,
//#if MC > 11404
class_4587 poseStack,
class_4597 source,
int light,
//#endif
CallbackInfo ci
) {
EventManager.dispatch(new RenderEntityEvent.PostRender(RenderEntityEvent.EntityRenderContext.of(
entity,
//#if MC > 11502
poseStack,
//#endif
tickDelta
)));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy