diff --git a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREICategory.java b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREICategory.java index ee326eca1d..58290c5f21 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREICategory.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/integration/rei/ElvenTradeREICategory.java @@ -97,10 +97,10 @@ void drawPortal(PoseStack matrices, Point point) { int stopY = startY + 48; Matrix4f mat = matrices.last().pose(); Matrix3f n = matrices.last().normal(); - v.vertex(mat, startX, startY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU0(), sprite.getV0()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, startX, stopY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU0(), sprite.getV1()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, stopX, stopY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU1(), sprite.getV1()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, stopX, startY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU1(), sprite.getV0()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); + v.addVertex(mat, startX, startY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU0(), sprite.getV0()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, startX, stopY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU0(), sprite.getV1()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, stopX, stopY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU1(), sprite.getV1()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, stopX, startY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU1(), sprite.getV0()).uv2(0xF000F0).setNormal(n, 1, 0, 0); immediate.endBatch(); } } diff --git a/Xplat/src/main/java/vazkii/botania/client/core/handler/BossBarHandler.java b/Xplat/src/main/java/vazkii/botania/client/core/handler/BossBarHandler.java index 7d2ce643f8..a669dc177a 100644 --- a/Xplat/src/main/java/vazkii/botania/client/core/handler/BossBarHandler.java +++ b/Xplat/src/main/java/vazkii/botania/client/core/handler/BossBarHandler.java @@ -100,10 +100,10 @@ private static void drawHealthBar(GuiGraphics gui, GaiaGuardianEntity currentBos RenderSystem.setShader(CoreShaders::dopplegangerBar); BufferBuilder builder = Tesselator.getInstance().getBuilder(); builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - builder.vertex(matrix, x, y + h, 0).uv(minU, maxV).endVertex(); - builder.vertex(matrix, x + w, y + h, 0).uv(maxU, maxV).endVertex(); - builder.vertex(matrix, x + w, y, 0).uv(maxU, minV).endVertex(); - builder.vertex(matrix, x, y, 0).uv(minU, minV).endVertex(); + builder.addVertex(matrix, x, y + h, 0).setUv(minU, maxV); + builder.addVertex(matrix, x + w, y + h, 0).setUv(maxU, maxV); + builder.addVertex(matrix, x + w, y, 0).setUv(maxU, minV); + builder.addVertex(matrix, x, y, 0).setUv(minU, minV); Tesselator.getInstance().end(); } diff --git a/Xplat/src/main/java/vazkii/botania/client/core/helper/DelegatedVertexConsumer.java b/Xplat/src/main/java/vazkii/botania/client/core/helper/DelegatedVertexConsumer.java index e0a92b018e..acab9a9dc4 100644 --- a/Xplat/src/main/java/vazkii/botania/client/core/helper/DelegatedVertexConsumer.java +++ b/Xplat/src/main/java/vazkii/botania/client/core/helper/DelegatedVertexConsumer.java @@ -9,6 +9,7 @@ package vazkii.botania.client.core.helper; import com.mojang.blaze3d.vertex.VertexConsumer; +import org.jetbrains.annotations.NotNull; /** * Dirty hack to override some vertex data in {@link RenderHelper}. @@ -21,18 +22,23 @@ class DelegatedVertexConsumer implements VertexConsumer { } @Override - public VertexConsumer vertex(double x, double y, double z) { - return delegate.vertex(x, y, z); + public @NotNull VertexConsumer addVertex(float x, float y, float z) { + return delegate.addVertex(x, y, z); } @Override - public VertexConsumer color(int red, int green, int blue, int alpha) { - return delegate.color(red, green, blue, alpha); + public @NotNull VertexConsumer setColor(int red, int green, int blue, int alpha) { + return delegate.setColor(red, green, blue, alpha); } @Override - public VertexConsumer uv(float u, float v) { - return delegate.uv(u, v); + public @NotNull VertexConsumer setUv(float u, float v) { + return delegate.setUv(u, v); + } + + @Override + public @NotNull VertexConsumer setUv1(int u, int v) { + return delegate.setUv1(u, v); } @Override @@ -41,13 +47,13 @@ public VertexConsumer overlayCoords(int u, int v) { } @Override - public VertexConsumer uv2(int u, int v) { - return delegate.uv2(u, v); + public @NotNull VertexConsumer setUv2(int u, int v) { + return delegate.setUv2(u, v); } @Override - public VertexConsumer normal(float x, float y, float z) { - return delegate.normal(x, y, z); + public @NotNull VertexConsumer setNormal(float x, float y, float z) { + return delegate.setNormal(x, y, z); } @Override diff --git a/Xplat/src/main/java/vazkii/botania/client/core/helper/RenderHelper.java b/Xplat/src/main/java/vazkii/botania/client/core/helper/RenderHelper.java index f06470fb2d..f4ef6e1f51 100644 --- a/Xplat/src/main/java/vazkii/botania/client/core/helper/RenderHelper.java +++ b/Xplat/src/main/java/vazkii/botania/client/core/helper/RenderHelper.java @@ -38,6 +38,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; @@ -312,12 +313,12 @@ public static void renderStar(PoseStack ms, MultiBufferSource buffers, int color float g = ((color & 0xFF00) >> 8) / 255F; float b = (color & 0xFF) / 255F; Matrix4f mat = ms.last().pose(); - Runnable center = () -> buffer.vertex(mat, 0, 0, 0).color(r, g, b, f1).endVertex(); + Runnable center = () -> buffer.addVertex(mat, 0, 0, 0).setColor(r, g, b, f1); Runnable[] vertices = { - () -> buffer.vertex(mat, -0.866F * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex(), - () -> buffer.vertex(mat, 0.866F * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex(), - () -> buffer.vertex(mat, 0, f3, 1F * f4).color(0, 0, 0, 0).endVertex(), - () -> buffer.vertex(mat, -0.866F * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex() + () -> buffer.addVertex(mat, -0.866F * f4, f3, -0.5F * f4).setColor(0, 0, 0, 0), + () -> buffer.addVertex(mat, 0.866F * f4, f3, -0.5F * f4).setColor(0, 0, 0, 0), + () -> buffer.addVertex(mat, 0, f3, 1F * f4).setColor(0, 0, 0, 0), + () -> buffer.addVertex(mat, -0.866F * f4, f3, -0.5F * f4).setColor(0, 0, 0, 0) }; triangleFan(center, vertices); } @@ -344,10 +345,10 @@ public static void triangleFan(Runnable center, List vertices) { public static void flatRectangle(VertexConsumer buffer, Matrix4f mat, float xMin, float xMax, float y, float zMin, float zMax, int r, int g, int b, int a) { - buffer.vertex(mat, xMax, y, zMin).color(r, g, b, a).endVertex(); - buffer.vertex(mat, xMin, y, zMin).color(r, g, b, a).endVertex(); - buffer.vertex(mat, xMin, y, zMax).color(r, g, b, a).endVertex(); - buffer.vertex(mat, xMax, y, zMax).color(r, g, b, a).endVertex(); + buffer.addVertex(mat, xMax, y, zMin).setColor(r, g, b, a); + buffer.addVertex(mat, xMin, y, zMin).setColor(r, g, b, a); + buffer.addVertex(mat, xMin, y, zMax).setColor(r, g, b, a); + buffer.addVertex(mat, xMax, y, zMax).setColor(r, g, b, a); } public static void renderProgressPie(GuiGraphics gui, int x, int y, float progress, ItemStack stack) { @@ -381,14 +382,14 @@ public static void renderProgressPie(GuiGraphics gui, int x, int y, float progre BufferBuilder buf = Tesselator.getInstance().getBuilder(); RenderSystem.setShader(GameRenderer::getPositionColorShader); buf.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); - buf.vertex(mat, centerX, centerY, 0).color(0, 0.5F, 0.5F, a).endVertex(); + buf.addVertex(mat, centerX, centerY, 0).setColor(0, 0.5F, 0.5F, a); for (int i = degs; i >= 0; i--) { float rad = (i - 90) / 180F * (float) Math.PI; - buf.vertex(mat, centerX + Mth.cos(rad) * r, centerY + Mth.sin(rad) * r, 0).color(0F, 1F, 0.5F, a).endVertex(); + buf.addVertex(mat, centerX + Mth.cos(rad) * r, centerY + Mth.sin(rad) * r, 0).setColor(0F, 1F, 0.5F, a); } - buf.vertex(mat, centerX, centerY, 0).color(0F, 1F, 0.5F, a).endVertex(); + buf.addVertex(mat, centerX, centerY, 0).setColor(0F, 1F, 0.5F, a); Tesselator.getInstance().end(); RenderSystem.disableBlend(); @@ -445,8 +446,8 @@ private static void renderBakedItemQuads(PoseStack ms, VertexConsumer buffer, in buffer = new DelegatedVertexConsumer(buffer) { @Override - public VertexConsumer color(float red, float green, float blue, float alpha) { - return super.color(r, g, b, a); + public @NotNull VertexConsumer setColor(float red, float green, float blue, float alpha) { + return super.setColor(r, g, b, a); } }; ((ItemRendererAccessor) Minecraft.getInstance().getItemRenderer()) @@ -476,10 +477,10 @@ public static void renderIconFullBright( float green = ((color >> 8) & 0xFF) / 255F; float blue = (color & 0xFF) / 255F; - buffer.vertex(mat, startX, endY, 0).color(red, green, blue, alpha).uv(icon.getU(uvStartX), icon.getV(uvEndY)).uv2(light).endVertex(); - buffer.vertex(mat, endX, endY, 0).color(red, green, blue, alpha).uv(icon.getU(uvEndX), icon.getV(uvEndY)).uv2(light).endVertex(); - buffer.vertex(mat, endX, startY, 0).color(red, green, blue, alpha).uv(icon.getU(uvEndX), icon.getV(uvStartY)).uv2(light).endVertex(); - buffer.vertex(mat, startX, startY, 0).color(red, green, blue, alpha).uv(icon.getU(uvStartX), icon.getV(uvStartY)).uv2(light).endVertex(); + buffer.addVertex(mat, startX, endY, 0).setColor(red, green, blue, alpha).setUv(icon.getU(uvStartX), icon.getV(uvEndY)).uv2(light); + buffer.addVertex(mat, endX, endY, 0).setColor(red, green, blue, alpha).setUv(icon.getU(uvEndX), icon.getV(uvEndY)).uv2(light); + buffer.addVertex(mat, endX, startY, 0).setColor(red, green, blue, alpha).setUv(icon.getU(uvEndX), icon.getV(uvStartY)).uv2(light); + buffer.addVertex(mat, startX, startY, 0).setColor(red, green, blue, alpha).setUv(icon.getU(uvStartX), icon.getV(uvStartY)).uv2(light); } /** @@ -644,18 +645,23 @@ public static int itemWithNameWidth(Minecraft mc, ItemStack itemStack) { // Borrowed with permission from https://github.com/XFactHD/FramedBlocks/blob/14f468810fc416b39447512810f0aa86e1012335/src/main/java/xfacthd/framedblocks/client/util/GhostVertexConsumer.java public record GhostVertexConsumer(VertexConsumer wrapped, int alpha) implements VertexConsumer { @Override - public VertexConsumer vertex(double x, double y, double z) { - return wrapped.vertex(x, y, z); + public @NotNull VertexConsumer addVertex(float x, float y, float z) { + return wrapped.addVertex(x, y, z); } @Override - public VertexConsumer color(int red, int green, int blue, int alpha) { - return wrapped.color(red, green, blue, (alpha * this.alpha) / 0xFF); + public @NotNull VertexConsumer setColor(int red, int green, int blue, int alpha) { + return wrapped.setColor(red, green, blue, (alpha * this.alpha) / 0xFF); } @Override - public VertexConsumer uv(float u, float v) { - return wrapped.uv(u, v); + public @NotNull VertexConsumer setUv(float u, float v) { + return wrapped.setUv(u, v); + } + + @Override + public @NotNull VertexConsumer setUv1(int u, int v) { + return wrapped.setUv1(u, v); } @Override @@ -664,13 +670,13 @@ public VertexConsumer overlayCoords(int u, int v) { } @Override - public VertexConsumer uv2(int u, int v) { - return wrapped.uv2(u, v); + public @NotNull VertexConsumer setUv2(int u, int v) { + return wrapped.setUv2(u, v); } @Override - public VertexConsumer normal(float x, float y, float z) { - return wrapped.normal(x, y, z); + public @NotNull VertexConsumer setNormal(float x, float y, float z) { + return wrapped.setNormal(x, y, z); } @Override diff --git a/Xplat/src/main/java/vazkii/botania/client/fx/BoltRenderer.java b/Xplat/src/main/java/vazkii/botania/client/fx/BoltRenderer.java index 05e0db5289..79c968b509 100644 --- a/Xplat/src/main/java/vazkii/botania/client/fx/BoltRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/fx/BoltRenderer.java @@ -143,9 +143,8 @@ public void render(Matrix4f matrix, VertexConsumer buffer, Timestamp timestamp) float lifeScale = timestamp.subtract(createdTimestamp).value() / options.getLifespan(); Pair bounds = options.getFadeFunction().getRenderBounds(renderQuads.size(), lifeScale); for (int i = bounds.getLeft(); i < bounds.getRight(); i++) { - renderQuads.get(i).getVecs().forEach(v -> buffer.vertex(matrix, (float) v.x, (float) v.y, (float) v.z) - .color(options.getColor().x(), options.getColor().y(), options.getColor().z(), options.getColor().w()) - .endVertex()); + renderQuads.get(i).getVecs().forEach(v -> buffer.addVertex(matrix, (float) v.x, (float) v.y, (float) v.z) + .setColor(options.getColor().x(), options.getColor().y(), options.getColor().z(), options.getColor().w())); } } diff --git a/Xplat/src/main/java/vazkii/botania/client/integration/emi/ElvenTradeEmiRecipe.java b/Xplat/src/main/java/vazkii/botania/client/integration/emi/ElvenTradeEmiRecipe.java index 690e852065..81add64a43 100644 --- a/Xplat/src/main/java/vazkii/botania/client/integration/emi/ElvenTradeEmiRecipe.java +++ b/Xplat/src/main/java/vazkii/botania/client/integration/emi/ElvenTradeEmiRecipe.java @@ -86,10 +86,10 @@ public void render(GuiGraphics gui, int mouseX, int mouseY, float delta) { int stopY = y + 48; Matrix4f mat = matrices.last().pose(); Matrix3f n = matrices.last().normal(); - v.vertex(mat, startX, startY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU0(), sprite.getV0()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, startX, stopY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU0(), sprite.getV1()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, stopX, stopY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU1(), sprite.getV1()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, stopX, startY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU1(), sprite.getV0()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); + v.addVertex(mat, startX, startY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU0(), sprite.getV0()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, startX, stopY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU0(), sprite.getV1()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, stopX, stopY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU1(), sprite.getV1()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, stopX, startY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU1(), sprite.getV0()).uv2(0xF000F0).setNormal(n, 1, 0, 0); immediate.endBatch(); } diff --git a/Xplat/src/main/java/vazkii/botania/client/integration/jei/ElvenTradeRecipeCategory.java b/Xplat/src/main/java/vazkii/botania/client/integration/jei/ElvenTradeRecipeCategory.java index 166fc4d280..9f829adce4 100644 --- a/Xplat/src/main/java/vazkii/botania/client/integration/jei/ElvenTradeRecipeCategory.java +++ b/Xplat/src/main/java/vazkii/botania/client/integration/jei/ElvenTradeRecipeCategory.java @@ -98,10 +98,10 @@ public void draw(@NotNull ElvenTradeRecipe recipe, @NotNull IRecipeSlotsView slo int stopY = 73; Matrix4f mat = matrices.last().pose(); Matrix3f n = matrices.last().normal(); - v.vertex(mat, startX, startY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU0(), sprite.getV0()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, startX, stopY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU0(), sprite.getV1()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, stopX, stopY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU1(), sprite.getV1()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); - v.vertex(mat, stopX, startY, 0).color(1f, 1f, 1f, 1f).uv(sprite.getU1(), sprite.getV0()).uv2(0xF000F0).normal(n, 1, 0, 0).endVertex(); + v.addVertex(mat, startX, startY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU0(), sprite.getV0()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, startX, stopY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU0(), sprite.getV1()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, stopX, stopY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU1(), sprite.getV1()).uv2(0xF000F0).setNormal(n, 1, 0, 0); + v.addVertex(mat, stopX, startY, 0).setColor(1f, 1f, 1f, 1f).setUv(sprite.getU1(), sprite.getV0()).uv2(0xF000F0).setNormal(n, 1, 0, 0); immediate.endBatch(); } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/AlfheimPortalBlockEntityRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/AlfheimPortalBlockEntityRenderer.java index f501797599..e052db6d83 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/AlfheimPortalBlockEntityRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/AlfheimPortalBlockEntityRenderer.java @@ -78,10 +78,10 @@ public void renderIcon(PoseStack ms, MultiBufferSource buffers, TextureAtlasSpri VertexConsumer buffer = buffers.getBuffer(Sheets.translucentItemSheet()); Matrix4f model = ms.last().pose(); Matrix3f normal = ms.last().normal(); - buffer.vertex(model, x, y + height, 0).color(1, 1, 1, alpha).uv(icon.getU0(), icon.getV1()).overlayCoords(overlay).uv2(0xF000F0).normal(normal, 1, 0, 0).endVertex(); - buffer.vertex(model, x + width, y + height, 0).color(1, 1, 1, alpha).uv(icon.getU1(), icon.getV1()).overlayCoords(overlay).uv2(0xF000F0).normal(normal, 1, 0, 0).endVertex(); - buffer.vertex(model, x + width, y, 0).color(1, 1, 1, alpha).uv(icon.getU1(), icon.getV0()).overlayCoords(overlay).uv2(0xF000F0).normal(normal, 1, 0, 0).endVertex(); - buffer.vertex(model, x, y, 0).color(1, 1, 1, alpha).uv(icon.getU0(), icon.getV0()).overlayCoords(overlay).uv2(0xF000F0).normal(normal, 1, 0, 0).endVertex(); + buffer.addVertex(model, x, y + height, 0).setColor(1, 1, 1, alpha).setUv(icon.getU0(), icon.getV1()).setOverlay(overlay).uv2(0xF000F0).setNormal(normal, 1, 0, 0); + buffer.addVertex(model, x + width, y + height, 0).setColor(1, 1, 1, alpha).setUv(icon.getU1(), icon.getV1()).setOverlay(overlay).uv2(0xF000F0).setNormal(normal, 1, 0, 0); + buffer.addVertex(model, x + width, y, 0).setColor(1, 1, 1, alpha).setUv(icon.getU1(), icon.getV0()).setOverlay(overlay).uv2(0xF000F0).setNormal(normal, 1, 0, 0); + buffer.addVertex(model, x, y, 0).setColor(1, 1, 1, alpha).setUv(icon.getU0(), icon.getV0()).setOverlay(overlay).uv2(0xF000F0).setNormal(normal, 1, 0, 0); } } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/LuminizerBlockEntityRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/LuminizerBlockEntityRenderer.java index 9945050a54..2c7fe44a44 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/LuminizerBlockEntityRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/LuminizerBlockEntityRenderer.java @@ -103,10 +103,10 @@ private void renderIcon(PoseStack ms, VertexConsumer buffer, TextureAtlasSprite float f6 = 0.25F; Matrix4f mat = ms.last().pose(); - buffer.vertex(mat, 0.0F - f5, 0.0F - f6, 0.0F).color(1F, 1F, 1F, 1F).uv(f, f3).endVertex(); - buffer.vertex(mat, f4 - f5, 0.0F - f6, 0.0F).color(1F, 1F, 1F, 1F).uv(f1, f3).endVertex(); - buffer.vertex(mat, f4 - f5, f4 - f6, 0.0F).color(1F, 1F, 1F, 1F).uv(f1, f2).endVertex(); - buffer.vertex(mat, 0.0F - f5, f4 - f6, 0.0F).color(1F, 1F, 1F, 1F).uv(f, f2).endVertex(); + buffer.addVertex(mat, 0.0F - f5, 0.0F - f6, 0.0F).setColor(1F, 1F, 1F, 1F).setUv(f, f3); + buffer.addVertex(mat, f4 - f5, 0.0F - f6, 0.0F).setColor(1F, 1F, 1F, 1F).setUv(f1, f3); + buffer.addVertex(mat, f4 - f5, f4 - f6, 0.0F).setColor(1F, 1F, 1F, 1F).setUv(f1, f2); + buffer.addVertex(mat, 0.0F - f5, f4 - f6, 0.0F).setColor(1F, 1F, 1F, 1F).setUv(f, f2); } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/PetalApothecaryBlockEntityRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/PetalApothecaryBlockEntityRenderer.java index 6b9e5c51d8..9f1ee45d06 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/PetalApothecaryBlockEntityRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/PetalApothecaryBlockEntityRenderer.java @@ -128,14 +128,14 @@ private void renderIcon(PoseStack ms, VertexConsumer builder, TextureAtlasSprite Matrix4f mat = ms.last().pose(); int start = 3; int end = 13; - builder.vertex(mat, start, end, 0).color(red, green, blue, (int) (alpha * 255F)) - .uv(sprite.getU(start), sprite.getV(end)).overlayCoords(overlay).uv2(light).normal(0, 0, 1).endVertex(); - builder.vertex(mat, end, end, 0).color(red, green, blue, (int) (alpha * 255F)) - .uv(sprite.getU(end), sprite.getV(end)).overlayCoords(overlay).uv2(light).normal(0, 0, 1).endVertex(); - builder.vertex(mat, end, start, 0).color(red, green, blue, (int) (alpha * 255F)) - .uv(sprite.getU(end), sprite.getV(start)).overlayCoords(overlay).uv2(light).normal(0, 0, 1).endVertex(); - builder.vertex(mat, start, start, 0).color(red, green, blue, (int) (alpha * 255F)) - .uv(sprite.getU(start), sprite.getV(start)).overlayCoords(overlay).uv2(light).normal(0, 0, 1).endVertex(); + builder.addVertex(mat, start, end, 0).setColor(red, green, blue, (int) (alpha * 255F)) + .setUv(sprite.getU(start), sprite.getV(end)).setOverlay(overlay).uv2(light).setNormal(0, 0, 1); + builder.addVertex(mat, end, end, 0).setColor(red, green, blue, (int) (alpha * 255F)) + .setUv(sprite.getU(end), sprite.getV(end)).setOverlay(overlay).uv2(light).setNormal(0, 0, 1); + builder.addVertex(mat, end, start, 0).setColor(red, green, blue, (int) (alpha * 255F)) + .setUv(sprite.getU(end), sprite.getV(start)).setOverlay(overlay).uv2(light).setNormal(0, 0, 1); + builder.addVertex(mat, start, start, 0).setColor(red, green, blue, (int) (alpha * 255F)) + .setUv(sprite.getU(start), sprite.getV(start)).setOverlay(overlay).uv2(light).setNormal(0, 0, 1); } } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/RedStringBlockEntityRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/RedStringBlockEntityRenderer.java index 0f259a744b..ca9c6780e7 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/RedStringBlockEntityRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/RedStringBlockEntityRenderer.java @@ -110,12 +110,11 @@ private static void vertex(PoseStack ms, VertexConsumer buffer, int color, Direc int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; - buffer.vertex(ms.last().pose(), x, y, z).color(r, g, b, a); + buffer.addVertex(ms.last().pose(), x, y, z).setColor(r, g, b, a); switch (dir.getAxis().getPlane()) { - case HORIZONTAL -> buffer.normal(ms.last().normal(), 0, 1, 0); - case VERTICAL -> buffer.normal(ms.last().normal(), 1, 0, 0); + case HORIZONTAL -> buffer.setNormal(ms.last(), 0, 1, 0); + case VERTICAL -> buffer.setNormal(ms.last(), 1, 0, 0); } - buffer.endVertex(); } private static int killNonZero(int diff) { diff --git a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/SpecialFlowerBlockEntityRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/SpecialFlowerBlockEntityRenderer.java index 686180fa03..37e0538c4c 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/SpecialFlowerBlockEntityRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/SpecialFlowerBlockEntityRenderer.java @@ -115,8 +115,8 @@ public static void renderCircle(PoseStack ms, MultiBufferSource buffers, BlockPo Matrix4f mat = ms.last().pose(); double innerRadius = radius - FRAME_WIDTH; - Runnable centerFuncInner = () -> buffer.vertex(mat, 0, Y_OFFSET_INNER, 0).color(r, g, b, INNER_ALPHA).endVertex(); - Runnable centerFuncOuter = () -> buffer.vertex(mat, 0, Y_OFFSET_OUTER, 0).color(r, g, b, OUTER_ALPHA).endVertex(); + Runnable centerFuncInner = () -> buffer.addVertex(mat, 0, Y_OFFSET_INNER, 0).setColor(r, g, b, INNER_ALPHA); + Runnable centerFuncOuter = () -> buffer.addVertex(mat, 0, Y_OFFSET_OUTER, 0).setColor(r, g, b, OUTER_ALPHA); Runnable[] vertexFuncsInner = new Runnable[TOTAL_ANGLES + 1]; Runnable[] vertexFuncsOuter = new Runnable[TOTAL_ANGLES + 1]; @@ -127,11 +127,11 @@ public static void renderCircle(PoseStack ms, MultiBufferSource buffers, BlockPo float xpInner = (float) (cos * innerRadius); float zpInner = (float) (sin * innerRadius); - vertexFuncsInner[i] = (() -> buffer.vertex(mat, xpInner, Y_OFFSET_INNER, zpInner).color(r, g, b, INNER_ALPHA).endVertex()); + vertexFuncsInner[i] = (() -> buffer.addVertex(mat, xpInner, Y_OFFSET_INNER, zpInner).setColor(r, g, b, INNER_ALPHA)); float xpOuter = (float) (Math.cos(rad) * radius); float zpOuter = (float) (Math.sin(rad) * radius); - vertexFuncsOuter[i] = (() -> buffer.vertex(mat, xpOuter, Y_OFFSET_OUTER, zpOuter).color(r, g, b, OUTER_ALPHA).endVertex()); + vertexFuncsOuter[i] = (() -> buffer.addVertex(mat, xpOuter, Y_OFFSET_OUTER, zpOuter).setColor(r, g, b, OUTER_ALPHA)); } vertexFuncsInner[TOTAL_ANGLES] = vertexFuncsInner[0]; vertexFuncsOuter[TOTAL_ANGLES] = vertexFuncsOuter[0]; diff --git a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/StarfieldCreatorBlockEntityRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/StarfieldCreatorBlockEntityRenderer.java index 5b613faac2..e6114f38e0 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/block_entity/StarfieldCreatorBlockEntityRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/block_entity/StarfieldCreatorBlockEntityRenderer.java @@ -33,9 +33,9 @@ public void render(StarfieldCreatorBlockEntity tile, float partialTicsk, PoseSta } private void renderFace(VertexConsumer vertexConsumer, Matrix4f matrix4f, float f, float g, float h, float i, float j, float k, float l, float m) { - vertexConsumer.vertex(matrix4f, f, h, j).endVertex(); - vertexConsumer.vertex(matrix4f, g, h, k).endVertex(); - vertexConsumer.vertex(matrix4f, g, i, l).endVertex(); - vertexConsumer.vertex(matrix4f, f, i, m).endVertex(); + vertexConsumer.addVertex(matrix4f, f, h, j); + vertexConsumer.addVertex(matrix4f, g, h, k); + vertexConsumer.addVertex(matrix4f, g, i, l); + vertexConsumer.addVertex(matrix4f, f, i, m); } } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/entity/BabylonWeaponRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/entity/BabylonWeaponRenderer.java index 9625313def..d3157d88b6 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/entity/BabylonWeaponRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/entity/BabylonWeaponRenderer.java @@ -73,10 +73,10 @@ public void render(@NotNull BabylonWeaponEntity weapon, float yaw, float partial VertexConsumer buffer = buffers.getBuffer(RenderHelper.BABYLON_ICON); Matrix4f mat = ms.last().pose(); - buffer.vertex(mat, -1, 0, -1).color(1, 1, 1, chargeMul).uv(0, 0).endVertex(); - buffer.vertex(mat, -1, 0, 1).color(1, 1, 1, chargeMul).uv(0, 1).endVertex(); - buffer.vertex(mat, 1, 0, 1).color(1, 1, 1, chargeMul).uv(1, 1).endVertex(); - buffer.vertex(mat, 1, 0, -1).color(1, 1, 1, chargeMul).uv(1, 0).endVertex(); + buffer.addVertex(mat, -1, 0, -1).setColor(1, 1, 1, chargeMul).setUv(0, 0); + buffer.addVertex(mat, -1, 0, 1).setColor(1, 1, 1, chargeMul).setUv(0, 1); + buffer.addVertex(mat, 1, 0, 1).setColor(1, 1, 1, chargeMul).setUv(1, 1); + buffer.addVertex(mat, 1, 0, -1).setColor(1, 1, 1, chargeMul).setUv(1, 0); ms.popPose(); } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/entity/BaseSparkRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/entity/BaseSparkRenderer.java index 089bbb453f..d398a98b22 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/entity/BaseSparkRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/entity/BaseSparkRenderer.java @@ -117,10 +117,10 @@ private void renderIcon(PoseStack ms, VertexConsumer buffer, TextureAtlasSprite int g = (color >> 8) & 0xFF; int b = color & 0xFF; Matrix4f mat = ms.last().pose(); - buffer.vertex(mat, 0.0F - f5, 0.0F - f6, 0.0F).color(r, g, b, a).uv(f, f3).uv2(fullbright).endVertex(); - buffer.vertex(mat, f4 - f5, 0.0F - f6, 0.0F).color(r, g, b, a).uv(f1, f3).uv2(fullbright).endVertex(); - buffer.vertex(mat, f4 - f5, f4 - f6, 0.0F).color(r, g, b, a).uv(f1, f2).uv2(fullbright).endVertex(); - buffer.vertex(mat, 0.0F - f5, f4 - f6, 0.0F).color(r, g, b, a).uv(f, f2).uv2(fullbright).endVertex(); + buffer.addVertex(mat, 0.0F - f5, 0.0F - f6, 0.0F).setColor(r, g, b, a).setUv(f, f3).uv2(fullbright); + buffer.addVertex(mat, f4 - f5, 0.0F - f6, 0.0F).setColor(r, g, b, a).setUv(f1, f3).uv2(fullbright); + buffer.addVertex(mat, f4 - f5, f4 - f6, 0.0F).setColor(r, g, b, a).setUv(f1, f2).uv2(fullbright); + buffer.addVertex(mat, 0.0F - f5, f4 - f6, 0.0F).setColor(r, g, b, a).setUv(f, f2).uv2(fullbright); } } diff --git a/Xplat/src/main/java/vazkii/botania/client/render/world/SkyblockSkyRenderer.java b/Xplat/src/main/java/vazkii/botania/client/render/world/SkyblockSkyRenderer.java index 3b3693c35e..77edbf901c 100644 --- a/Xplat/src/main/java/vazkii/botania/client/render/world/SkyblockSkyRenderer.java +++ b/Xplat/src/main/java/vazkii/botania/client/render/world/SkyblockSkyRenderer.java @@ -68,11 +68,11 @@ public static void renderExtra(PoseStack ms, ClientLevel world, float partialTic RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, planetTextures[p]); Matrix4f mat = ms.last().pose(); - tessellator.getBuilder().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - tessellator.getBuilder().vertex(mat, -scale, 100, -scale).uv(0.0F, 0.0F).endVertex(); - tessellator.getBuilder().vertex(mat, scale, 100, -scale).uv(1.0F, 0.0F).endVertex(); - tessellator.getBuilder().vertex(mat, scale, 100, scale).uv(1.0F, 1.0F).endVertex(); - tessellator.getBuilder().vertex(mat, -scale, 100, scale).uv(0.0F, 1.0F).endVertex(); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, -scale, 100, -scale).setUv(0.0F, 0.0F); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, scale, 100, -scale).setUv(1.0F, 0.0F); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, scale, 100, scale).setUv(1.0F, 1.0F); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, -scale, 100, scale).setUv(0.0F, 1.0F); tessellator.end(); switch (p) { @@ -125,7 +125,7 @@ public static void renderExtra(PoseStack ms, ClientLevel world, float partialTic ms.mulPose(VecHelper.rotateY((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.25F * rotSpeed * rotSpeedMod)); Matrix4f mat = ms.last().pose(); - tessellator.getBuilder().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); for (int i = 0; i < angles; i++) { int j = i; if (i % 2 == 0) { @@ -139,11 +139,11 @@ public static void renderExtra(PoseStack ms, ClientLevel world, float partialTic float ut = ang * uPer; if (i % 2 == 0) { - tessellator.getBuilder().vertex(mat, xp, yo + y0 + y, zp).uv(ut, 1F).endVertex(); - tessellator.getBuilder().vertex(mat, xp, yo + y0, zp).uv(ut, 0).endVertex(); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0 + y, zp).setUv(ut, 1F); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0, zp).setUv(ut, 0); } else { - tessellator.getBuilder().vertex(mat, xp, yo + y0, zp).uv(ut, 0).endVertex(); - tessellator.getBuilder().vertex(mat, xp, yo + y0 + y, zp).uv(ut, 1F).endVertex(); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0, zp).setUv(ut, 0); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0 + y, zp).setUv(ut, 1F); } } @@ -187,7 +187,7 @@ public static void renderExtra(PoseStack ms, ClientLevel world, float partialTic ms.mulPose(VecHelper.rotateZ(angle2)); Matrix4f mat = ms.last().pose(); - tessellator.getBuilder().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); for (int i = 0; i < angles; i++) { int j = i; if (i % 2 == 0) { @@ -201,11 +201,11 @@ public static void renderExtra(PoseStack ms, ClientLevel world, float partialTic float ut = ang * uPer; if (i % 2 == 0) { - tessellator.getBuilder().vertex(mat, xp, yo + y0 + y, zp).uv(ut, 1F).endVertex(); - tessellator.getBuilder().vertex(mat, xp, yo + y0, zp).uv(ut, 0).endVertex(); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0 + y, zp).setUv(ut, 1F); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0, zp).setUv(ut, 0); } else { - tessellator.getBuilder().vertex(mat, xp, yo + y0, zp).uv(ut, 0).endVertex(); - tessellator.getBuilder().vertex(mat, xp, yo + y0 + y, zp).uv(ut, 1F).endVertex(); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0, zp).setUv(ut, 0); + tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX).addVertex(mat, xp, yo + y0 + y, zp).setUv(ut, 1F); } } diff --git a/Xplat/src/main/java/vazkii/botania/common/item/AssemblyHaloItem.java b/Xplat/src/main/java/vazkii/botania/common/item/AssemblyHaloItem.java index 3a2ac22f69..b7ee216696 100644 --- a/Xplat/src/main/java/vazkii/botania/common/item/AssemblyHaloItem.java +++ b/Xplat/src/main/java/vazkii/botania/common/item/AssemblyHaloItem.java @@ -428,14 +428,14 @@ public static void onRenderWorldLast(Camera camera, float partialTicks, PoseStac float xp = (float) Math.cos(ang * Math.PI / 180F) * s; float zp = (float) Math.sin(ang * Math.PI / 180F) * s; - buffer.vertex(mat, xp * m, y, zp * m).color(r, g, b, a).uv(u, v).endVertex(); - buffer.vertex(mat, xp, y0, zp).color(r, g, b, a).uv(u, 0).endVertex(); + buffer.addVertex(mat, xp * m, y, zp * m).setColor(r, g, b, a).setUv(u, v); + buffer.addVertex(mat, xp, y0, zp).setColor(r, g, b, a).setUv(u, 0); xp = (float) Math.cos((ang + 1) * Math.PI / 180F) * s; zp = (float) Math.sin((ang + 1) * Math.PI / 180F) * s; - buffer.vertex(mat, xp, y0, zp).color(r, g, b, a).uv(0, 0).endVertex(); - buffer.vertex(mat, xp * m, y, zp * m).color(r, g, b, a).uv(0, v).endVertex(); + buffer.addVertex(mat, xp, y0, zp).setColor(r, g, b, a).setUv(0, 0); + buffer.addVertex(mat, xp * m, y, zp * m).setColor(r, g, b, a).setUv(0, v); } y0 = 0; ms.popPose(); diff --git a/Xplat/src/main/java/vazkii/botania/common/item/WorldshaperssSextantItem.java b/Xplat/src/main/java/vazkii/botania/common/item/WorldshaperssSextantItem.java index 4eac71015b..6dc5e86f05 100644 --- a/Xplat/src/main/java/vazkii/botania/common/item/WorldshaperssSextantItem.java +++ b/Xplat/src/main/java/vazkii/botania/common/item/WorldshaperssSextantItem.java @@ -320,13 +320,13 @@ public static void render(GuiGraphics gui, Player player, ItemStack stack) { if (inRange) { radius += 4; RenderSystem.lineWidth(3F); - Tesselator.getInstance().getBuilder().begin(VertexFormat.Mode.LINE_STRIP, DefaultVertexFormat.POSITION); + Tesselator.getInstance().begin(VertexFormat.Mode.LINE_STRIP, DefaultVertexFormat.POSITION); RenderSystem.setShaderColor(0F, 1F, 1F, 1F); for (int i = 0; i < 361; i++) { float radian = (float) (i * Math.PI / 180); float xp = x + net.minecraft.util.Mth.cos(radian) * (float) radius; float yp = y + net.minecraft.util.Mth.sin(radian) * (float) radius; - Tesselator.getInstance().getBuilder().vertex(ms.last().pose(), xp, yp, 0).endVertex(); + Tesselator.getInstance().begin(VertexFormat.Mode.LINE_STRIP, DefaultVertexFormat.POSITION).addVertex(ms.last().pose(), xp, yp, 0); } Tesselator.getInstance().end(); } diff --git a/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/FlugelTiaraItem.java b/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/FlugelTiaraItem.java index d825cc6ee1..a32cee89e8 100644 --- a/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/FlugelTiaraItem.java +++ b/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/FlugelTiaraItem.java @@ -471,10 +471,10 @@ public static void renderHalo(@Nullable HumanoidModel model, @Nullable Living ms.scale(0.75F, -0.75F, -0.75F); VertexConsumer buffer = buffers.getBuffer(RenderHelper.HALO); Matrix4f mat = ms.last().pose(); - buffer.vertex(mat, -1F, 0, -1F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(0, 0).endVertex(); - buffer.vertex(mat, 1F, 0, -1F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(1, 0).endVertex(); - buffer.vertex(mat, 1F, 0, 1F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(1, 1).endVertex(); - buffer.vertex(mat, -1F, 0, 1F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(0, 1).endVertex(); + buffer.addVertex(mat, -1F, 0, -1F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(0, 0); + buffer.addVertex(mat, 1F, 0, -1F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(1, 0); + buffer.addVertex(mat, 1F, 0, 1F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(1, 1); + buffer.addVertex(mat, -1F, 0, 1F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(0, 1); } private static int estimateAdditionalNumRowsRendered(Player player) {