Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Oct 23, 2024
1 parent d32f774 commit 0974328
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 0 additions & 2 deletions Fabric/src/main/java/vazkii/neat/NeatFiberConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package vazkii.neat;

import net.minecraft.world.entity.MobCategory;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down
3 changes: 3 additions & 0 deletions Forge/src/main/java/vazkii/neat/NeatForgeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,17 @@ public boolean disableNameTag() {
public boolean disableNameTagIfHealthbar() {
return disableNameTagIfHealthbar.get();
}

@Override
public double iconOffsetX() {
return iconOffsetX.get();
}

@Override
public double iconOffsetY() {
return iconOffsetY.get();
}

@Override
public String decimalFormat() {
return decimalFormat.get();
Expand Down
6 changes: 2 additions & 4 deletions Xplat/src/main/java/vazkii/neat/HealthBarRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.Team;

import org.joml.Quaternionf;

import java.text.DecimalFormat;
import java.util.*;

Expand Down Expand Up @@ -214,8 +212,8 @@ private static boolean shouldShowPlate(LivingEntity living, Entity cameraEntity)
}

public static void hookRender(Entity entity, PoseStack poseStack, MultiBufferSource buffers,
Camera camera, EntityRenderer<? super Entity> entityRenderer,
float partialTicks, double x, double y, double z) {
Camera camera, EntityRenderer<? super Entity> entityRenderer,
float partialTicks, double x, double y, double z) {
final Minecraft mc = Minecraft.getInstance();

if (!(entity instanceof LivingEntity living)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.Entity;

import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
39 changes: 23 additions & 16 deletions Xplat/src/main/java/vazkii/neat/mixin/LevelRendererMixin.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
package vazkii.neat.mixin;

import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import vazkii.neat.HealthBarRenderer;

@Mixin(LevelRenderer.class)
public class LevelRendererMixin {

@Shadow
@Final
private EntityRenderDispatcher entityRenderDispatcher;
@Shadow
@Final
private EntityRenderDispatcher entityRenderDispatcher;

/**
* This hooks right after the EntityRenderDispatcher
*
*/
@Inject(method = "renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;render(Lnet/minecraft/world/entity/Entity;DDDFFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
shift = At.Shift.AFTER))
private void neat_renderHealthBar(Entity entity, double camX, double camY, double camZ, float partialTick, PoseStack poseStack, MultiBufferSource buffers, CallbackInfo ci) {
double d0 = Mth.lerp(partialTick, entity.xOld, entity.getX());
double d1 = Mth.lerp(partialTick, entity.yOld, entity.getY());
double d2 = Mth.lerp(partialTick, entity.zOld, entity.getZ());
HealthBarRenderer.hookRender(entity, poseStack, buffers, entityRenderDispatcher.camera, entityRenderDispatcher.getRenderer(entity), partialTick, d0 - camX, d1 - camY, d2 - camZ);
}
/**
* This hooks right after the EntityRenderDispatcher
*
*/
@Inject(
method = "renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V",
at = @At(
value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;render(Lnet/minecraft/world/entity/Entity;DDDFFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
shift = At.Shift.AFTER
)
)
private void neat_renderHealthBar(Entity entity, double camX, double camY, double camZ, float partialTick, PoseStack poseStack, MultiBufferSource buffers, CallbackInfo ci) {
double d0 = Mth.lerp(partialTick, entity.xOld, entity.getX());
double d1 = Mth.lerp(partialTick, entity.yOld, entity.getY());
double d2 = Mth.lerp(partialTick, entity.zOld, entity.getZ());
HealthBarRenderer.hookRender(entity, poseStack, buffers, entityRenderDispatcher.camera, entityRenderDispatcher.getRenderer(entity), partialTick, d0 - camX, d1 - camY, d2 - camZ);
}
}

0 comments on commit 0974328

Please sign in to comment.