diff --git a/Xplat/src/main/java/vazkii/neat/HealthBarRenderer.java b/Xplat/src/main/java/vazkii/neat/HealthBarRenderer.java index 833741a..13ed8e4 100644 --- a/Xplat/src/main/java/vazkii/neat/HealthBarRenderer.java +++ b/Xplat/src/main/java/vazkii/neat/HealthBarRenderer.java @@ -220,17 +220,7 @@ public static void hookRender(Entity entity, PoseStack poseStack, MultiBufferSou poseStack.pushPose(); poseStack.scale(-globalScale, -globalScale, globalScale); - // Background - if (NeatConfig.instance.drawBackground()) { - float padding = NeatConfig.instance.backgroundPadding(); - int bgHeight = NeatConfig.instance.backgroundHeight(); - VertexConsumer builder = buffers.getBuffer(NeatRenderType.BAR_TEXTURE_TYPE); - //VertexConsumer builder = buffers.getBuffer(RenderType.LINES); - builder.addVertex(poseStack.last().pose(), -halfSize - padding, -bgHeight, 0.01F).setColor(0, 0, 0, 64).setUv(0.0F, 0.0F).setLight(light); - builder.addVertex(poseStack.last().pose(), -halfSize - padding, barHeight + padding, 0.01F).setColor(0, 0, 0, 64).setUv(0.0F, 0.5F).setLight(light); - builder.addVertex(poseStack.last().pose(), halfSize + padding, barHeight + padding, 0.01F).setColor(0, 0, 0, 64).setUv(1.0F, 0.5F).setLight(light); - builder.addVertex(poseStack.last().pose(), halfSize + padding, -bgHeight, 0.01F).setColor(0, 0, 0, 64).setUv(1.0F, 0.0F).setLight(light); - } + VertexConsumer builder = buffers.getBuffer(NeatRenderType.BAR_TEXTURE_TYPE); // Health Bar { @@ -242,25 +232,34 @@ public static void hookRender(Entity entity, PoseStack poseStack, MultiBufferSou // can temporarily exceed the max health. float maxHealth = Math.max(living.getHealth(), living.getMaxHealth()); float healthHalfSize = halfSize * (living.getHealth() / maxHealth); - - VertexConsumer builder = buffers.getBuffer(NeatRenderType.BAR_TEXTURE_TYPE); - //VertexConsumer builder = buffers.getBuffer(RenderType.LINES); - builder.addVertex(poseStack.last().pose(), -halfSize, 0, 0.001F).setColor(r, g, b, 127).setUv(0.0F, 0.75F).setLight(light); - builder.addVertex(poseStack.last().pose(), -halfSize, barHeight, 0.001F).setColor(r, g, b, 127).setUv(0.0F, 1.0F).setLight(light); - builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, barHeight, 0.001F).setColor(r, g, b, 127).setUv(1.0F, 1.0F).setLight(light); - builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, 0, 0.001F).setColor(r, g, b, 127).setUv(1.0F, 0.75F).setLight(light); + //TODO fix health bar reducing from left to right instead of right to left + builder.addVertex(poseStack.last().pose(), -halfSize, 0, 0.001F).setColor(r, g, b, 160).setUv(0.0F, 0.75F).setLight(light); + builder.addVertex(poseStack.last().pose(), -halfSize, barHeight, 0.001F).setColor(r, g, b, 160).setUv(0.0F, 1.0F).setLight(light); + builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, barHeight, 0.001F).setColor(r, g, b, 160).setUv(1.0F, 1.0F).setLight(light); + builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, 0, 0.001F).setColor(r, g, b, 160).setUv(1.0F, 0.75F).setLight(light); // Blank part of the bar if (healthHalfSize < halfSize) { - builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, 0, 0.001F).setColor(0, 0, 0, 127).setUv(0.0F, 0.5F).setLight(light); - builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, barHeight, 0.001F).setColor(0, 0, 0, 127).setUv(0.0F, 0.75F).setLight(light); - builder.addVertex(poseStack.last().pose(), halfSize, barHeight, 0.001F).setColor(0, 0, 0, 127).setUv(1.0F, 0.75F).setLight(light); - builder.addVertex(poseStack.last().pose(), halfSize, 0, 0.001F).setColor(0, 0, 0, 127).setUv(1.0F, 0.5F).setLight(light); + builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, 0, 0.001F).setColor(0, 0, 0, 64).setUv(0.0F, 0.5F).setLight(light); + builder.addVertex(poseStack.last().pose(), -halfSize + 2 * healthHalfSize, barHeight, 0.001F).setColor(0, 0, 0, 64).setUv(0.0F, 0.75F).setLight(light); + builder.addVertex(poseStack.last().pose(), halfSize, barHeight, 0.001F).setColor(0, 0, 0, 64).setUv(1.0F, 0.75F).setLight(light); + builder.addVertex(poseStack.last().pose(), halfSize, 0, 0.001F).setColor(0, 0, 0, 64).setUv(1.0F, 0.5F).setLight(light); } } + // Background + if (NeatConfig.instance.drawBackground()) { + float padding = NeatConfig.instance.backgroundPadding(); + int bgHeight = NeatConfig.instance.backgroundHeight(); + + builder.addVertex(poseStack.last().pose(), -halfSize - padding, -bgHeight, 0.01F).setColor(0, 0, 0, 60).setUv(0.0F, 0.0F).setLight(light); + builder.addVertex(poseStack.last().pose(), -halfSize - padding, barHeight + padding, 0.01F).setColor(0, 0, 0, 60).setUv(0.0F, 0.5F).setLight(light); + builder.addVertex(poseStack.last().pose(), halfSize + padding, barHeight + padding, 0.01F).setColor(0, 0, 0, 60).setUv(1.0F, 0.5F).setLight(light); + builder.addVertex(poseStack.last().pose(), halfSize + padding, -bgHeight, 0.01F).setColor(0, 0, 0, 60).setUv(1.0F, 0.0F).setLight(light); + } + // Text - { + {//TODO fix text not rendering final int white = 0xFFFFFF; final int black = 0; diff --git a/Xplat/src/main/java/vazkii/neat/NeatRenderType.java b/Xplat/src/main/java/vazkii/neat/NeatRenderType.java index 19aaac5..2c5b7bc 100644 --- a/Xplat/src/main/java/vazkii/neat/NeatRenderType.java +++ b/Xplat/src/main/java/vazkii/neat/NeatRenderType.java @@ -20,7 +20,6 @@ private NeatRenderType(String string, Runnable r, Runnable r1) { super(string, r, r1); } - //TODO fix rendering private static RenderType getHealthBarType() { RenderType.CompositeState renderTypeState = RenderType.CompositeState.builder() .setShaderState(POSITION_COLOR_TEX_LIGHTMAP_SHADER) @@ -29,6 +28,6 @@ private static RenderType getHealthBarType() { .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) .createCompositeState(false); - return AccessorRenderType.neat_create("neat_health_bar", POSITION_COLOR_TEX_LIGHTMAP, VertexFormat.Mode.QUADS, 256, true, true, renderTypeState); + return AccessorRenderType.neat_create("neat_health_bar", POSITION_COLOR_TEX_LIGHTMAP, VertexFormat.Mode.QUADS, 256, true, false, renderTypeState); } } diff --git a/gradle.properties b/gradle.properties index 44bd199..c86bb86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # Done to increase the memory available to gradle. # add-exports are needed for spotless to work on new Javas -org.gradle.jvmargs=-Xmx1G \ +org.gradle.jvmargs=-Xmx2G \ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \