Rendering for 1.21.6
This commit is contained in:
+2
-2
@@ -1,13 +1,13 @@
|
||||
package org.saturnclient.impl.features.mixins.render;
|
||||
|
||||
import net.minecraft.client.render.BackgroundRenderer;
|
||||
import net.minecraft.client.render.fog.FogRenderer;
|
||||
|
||||
import org.saturnclient.mod.mods.NoFogMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
@Mixin(BackgroundRenderer.class)
|
||||
@Mixin(FogRenderer.class)
|
||||
public class BackgroundRendererMixin {
|
||||
// fog
|
||||
@ModifyVariable(method = "applyFog", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
|
||||
+1
-4
@@ -12,7 +12,6 @@ import org.saturnclient.mod.Mod;
|
||||
import org.saturnclient.mod.ModLayout;
|
||||
import org.saturnclient.mod.ModManager;
|
||||
import org.saturnclient.saturnclient.SaturnClient;
|
||||
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.screens.HudEditor;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -53,9 +52,7 @@ public class RenderMixin {
|
||||
&& f.screen instanceof HudEditor)
|
||||
return;
|
||||
|
||||
RenderScope scope = new RenderScopeImpl(
|
||||
context.getMatrices(),
|
||||
((DrawContextAccessor) context).getVertexConsumers());
|
||||
RenderScope scope = new RenderScopeImpl(context);
|
||||
|
||||
for (Mod feature : ModManager.ENABLED_MODS) {
|
||||
if (!feature.isEnabled())
|
||||
|
||||
@@ -57,21 +57,21 @@ public class EntityDrawerImpl implements EntityDrawer {
|
||||
renderScope.getMatrixStack().translate(vector3f.x, vector3f.y, vector3f.z);
|
||||
renderScope.getMatrixStack().multiply((QuaternionfRef) quaternionf);
|
||||
renderScope.draw();
|
||||
DiffuseLighting.disableGuiDepthLighting();
|
||||
// DiffuseLighting.disableGuiDepthLighting();
|
||||
EntityRenderDispatcher entityRenderDispatcher = SaturnClient.client.getEntityRenderDispatcher();
|
||||
|
||||
entityRenderDispatcher.setRenderShadows(false);
|
||||
if (renderScope instanceof RenderScopeImpl r) {
|
||||
r.draw((vertexConsumers) -> {
|
||||
entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 1.0F,
|
||||
r.matrices, vertexConsumers,
|
||||
15728880);
|
||||
});
|
||||
// r.draw((vertexConsumers) -> {
|
||||
// entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 1.0F,
|
||||
// r.matrices, vertexConsumers,
|
||||
// 15728880);
|
||||
// });
|
||||
}
|
||||
renderScope.draw();
|
||||
entityRenderDispatcher.setRenderShadows(true);
|
||||
renderScope.getMatrixStack().pop();
|
||||
DiffuseLighting.enableGuiDepthLighting();
|
||||
// DiffuseLighting.enableGuiDepthLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,9 +6,13 @@ import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Matrix3x2f;
|
||||
import org.joml.Matrix3x2fStack;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||
|
||||
import org.saturnclient.common.provider.Providers;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
@@ -21,19 +25,18 @@ import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
import org.saturnclient.ui.resources.SvgTexture;
|
||||
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.font.TextRenderer.TextLayerType;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.ScreenRect;
|
||||
import net.minecraft.client.render.DiffuseLighting;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.gui.render.state.ColoredQuadGuiElementRenderState;
|
||||
import net.minecraft.client.gui.render.state.GuiRenderState;
|
||||
import net.minecraft.client.gui.render.state.ItemGuiElementRenderState;
|
||||
import net.minecraft.client.gui.render.state.TextGuiElementRenderState;
|
||||
import net.minecraft.client.gui.render.state.TexturedQuadGuiElementRenderState;
|
||||
import net.minecraft.client.render.item.ItemRenderState;
|
||||
import net.minecraft.client.texture.GuiAtlasManager;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.Window;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.texture.TextureSetup;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemDisplayContext;
|
||||
@@ -42,23 +45,25 @@ import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RenderScopeImpl implements RenderScope {
|
||||
public MatrixStack matrices;
|
||||
public VertexConsumerProvider.Immediate vertexConsumers;
|
||||
private ScissorStack scissorStack = new ScissorStack();
|
||||
private final Matrix3x2fStack matrices;
|
||||
private final GuiAtlasManager guiAtlasManager;
|
||||
public final GuiRenderState state;
|
||||
|
||||
private ScissorStack scissorStack;
|
||||
private int opacity = 255 << 24;
|
||||
private final ItemRenderState itemRenderState;
|
||||
|
||||
public RenderScopeImpl(DrawContext context) {
|
||||
this(context.getMatrices(), ((DrawContextAccessor) context).getVertexConsumers());
|
||||
this(context.getMatrices(), ((DrawContextAccessor) (Object) context).getState());
|
||||
}
|
||||
|
||||
public RenderScopeImpl(MatrixStack matrices, VertexConsumerProvider.Immediate vertexConsumers) {
|
||||
public RenderScopeImpl(Matrix3x2fStack matrices, GuiRenderState state) {
|
||||
this.state = state;
|
||||
this.matrices = matrices;
|
||||
this.vertexConsumers = vertexConsumers;
|
||||
this.guiAtlasManager = SaturnClient.client.getGuiAtlasManager();
|
||||
this.scissorStack = new ScissorStack();
|
||||
this.itemRenderState = new ItemRenderState();
|
||||
}
|
||||
@@ -81,13 +86,25 @@ public class RenderScopeImpl implements RenderScope {
|
||||
return (mixedAlpha << 24) | (color & 0x00FFFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fill(int x1, int y1, int x2, int y2, int color) {
|
||||
this.state.addSimpleElement(
|
||||
new ColoredQuadGuiElementRenderState(RenderPipelines.GUI, TextureSetup.empty(),
|
||||
new Matrix3x2f(this.matrices),
|
||||
x1, y1, x2,
|
||||
y2, color, color, this.scissorStack.peekLast()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fill(int x1, int y1, int x2, int y2, int z, int color) {
|
||||
this.fill(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRect(int x, int y, int width, int height, int color) {
|
||||
if (color == 0)
|
||||
return;
|
||||
color = getColor(color);
|
||||
Matrix4f matrix4f = this.matrices.peek().getPositionMatrix();
|
||||
|
||||
int x1 = x;
|
||||
int x2 = x + width;
|
||||
int y1 = y;
|
||||
@@ -106,11 +123,7 @@ public class RenderScopeImpl implements RenderScope {
|
||||
y2 = i;
|
||||
}
|
||||
|
||||
VertexConsumer vertexConsumer = this.vertexConsumers.getBuffer(RenderLayer.getGui());
|
||||
vertexConsumer.vertex(matrix4f, (float) x1, (float) y1, 0).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x1, (float) y2, 0).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x2, (float) y2, 0).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x2, (float) y1, 0).color(color);
|
||||
this.fill(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,15 +141,13 @@ public class RenderScopeImpl implements RenderScope {
|
||||
int i = 0;
|
||||
for (String line : text.split("\n")) {
|
||||
color = getColor(color);
|
||||
matrices.push();
|
||||
matrices.translate(x, y + (i * Fonts.getHeight()), 0);
|
||||
matrices.scale(scale, scale, 1.0f);
|
||||
TextRenderer textRenderer = SaturnClient.client.textRenderer;
|
||||
textRenderer.draw((Text) Fonts.setFont(line, font), 0,
|
||||
font == 0 ? 1 : 7, color, false,
|
||||
this.matrices.peek().getPositionMatrix(),
|
||||
this.vertexConsumers, TextLayerType.NORMAL, 0, 15728880);
|
||||
matrices.pop();
|
||||
this.state.addText(new TextGuiElementRenderState(SaturnClient.client.textRenderer,
|
||||
((Text) Fonts.setFont(line, font)).asOrderedText(), new Matrix3x2f(this.matrices), x, y,
|
||||
color, 0, false, this.scissorStack.peekLast()));
|
||||
|
||||
matrices.pushMatrix();
|
||||
matrices.translate(x, y + (i * Fonts.getHeight()));
|
||||
matrices.scale(scale, scale);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -160,28 +171,28 @@ public class RenderScopeImpl implements RenderScope {
|
||||
|
||||
private void drawRoundedSide(int cornerWidth, int cornerHeight, int radius, int color) {
|
||||
// Top
|
||||
this.matrices.push();
|
||||
this.matrices.pushMatrix();
|
||||
|
||||
this.matrices.scale(0.05f, 0.05f, 1.0f);
|
||||
this.matrices.scale(0.05f, 0.05f);
|
||||
|
||||
this.drawRoundedCorner(cornerWidth, cornerHeight, radius * 10, color);
|
||||
|
||||
this.matrices.pop();
|
||||
this.matrices.popMatrix();
|
||||
|
||||
// Bottom
|
||||
this.matrices.push();
|
||||
this.matrices.pushMatrix();
|
||||
|
||||
this.matrices.translate(cornerWidth, cornerHeight * 2, 0);
|
||||
this.matrices.translate(cornerWidth, cornerHeight * 2);
|
||||
|
||||
this.matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(90));
|
||||
this.matrices.rotate((float) Math.toRadians(90));
|
||||
|
||||
this.matrices.translate(0, -cornerWidth, 0);
|
||||
this.matrices.translate(0, -cornerWidth);
|
||||
|
||||
this.matrices.scale(0.05f, 0.05f, 1.0f);
|
||||
this.matrices.scale(0.05f, 0.05f);
|
||||
|
||||
this.drawRoundedCorner(cornerHeight, cornerWidth, radius * 10, color);
|
||||
|
||||
this.matrices.pop();
|
||||
this.matrices.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,21 +203,21 @@ public class RenderScopeImpl implements RenderScope {
|
||||
int cornerWidth = width / 2;
|
||||
int cornerHeight = height / 2;
|
||||
|
||||
this.matrices.push();
|
||||
this.matrices.pushMatrix();
|
||||
|
||||
this.matrices.translate(x, y, 0);
|
||||
this.matrices.translate(x, y);
|
||||
|
||||
this.drawRoundedSide(cornerWidth, cornerHeight, radius, color);
|
||||
|
||||
this.matrices.translate(cornerWidth * 2, cornerHeight * 2, 0);
|
||||
this.matrices.translate(cornerWidth * 2, cornerHeight * 2);
|
||||
|
||||
this.matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(180));
|
||||
this.matrices.rotate((float) Math.toRadians(90));
|
||||
|
||||
this.matrices.translate(0, 0, 0);
|
||||
this.matrices.translate(0, 0);
|
||||
|
||||
this.drawRoundedSide(cornerWidth, cornerHeight, radius, color);
|
||||
|
||||
this.matrices.pop();
|
||||
this.matrices.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,6 +281,16 @@ public class RenderScopeImpl implements RenderScope {
|
||||
|
||||
private void drawTexturedQuad(Identifier sprite, int x1, int x2, int y1, int y2, float u1, float u2, float v1,
|
||||
float v2, int color) {
|
||||
GpuTextureView gpuTextureView = SaturnClient.client.getTextureManager().getTexture(sprite).getGlTextureView();
|
||||
|
||||
if (color == 0)
|
||||
return;
|
||||
|
||||
x1 *= 4;
|
||||
x2 *= 4;
|
||||
y1 *= 4;
|
||||
y2 *= 4;
|
||||
color = getColor(color);
|
||||
|
||||
if (sprite.toString().endsWith(".svg")) {
|
||||
sprite = (Identifier) (Object) SvgTexture.getSvg(Providers.saturn.getClient(),
|
||||
@@ -277,83 +298,44 @@ public class RenderScopeImpl implements RenderScope {
|
||||
(x2 - x1) * 2, (y2 - y1) * 2);
|
||||
}
|
||||
|
||||
if (color == 0)
|
||||
return;
|
||||
x1 *= 4;
|
||||
x2 *= 4;
|
||||
y1 *= 4;
|
||||
y2 *= 4;
|
||||
color = getColor(color);
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(0.25f, 0.25f, 1.0f);
|
||||
RenderLayer renderLayer = (RenderLayer) RenderLayer.getGuiTextured(sprite);
|
||||
Matrix4f matrix4f = this.matrices.peek().getPositionMatrix();
|
||||
VertexConsumer vertexConsumer = this.vertexConsumers.getBuffer(renderLayer);
|
||||
vertexConsumer.vertex(matrix4f, (float) x1, (float) y1, 0.0F).texture(u1, v1).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x1, (float) y2, 0.0F).texture(u1, v2).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x2, (float) y2, 0.0F).texture(u2, v2).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x2, (float) y1, 0.0F).texture(u2, v1).color(color);
|
||||
matrices.pop();
|
||||
this.state.addSimpleElement(new TexturedQuadGuiElementRenderState(RenderPipelines.GUI,
|
||||
TextureSetup.withoutGlTexture(gpuTextureView), new Matrix3x2f(this.matrices), x1, y1, x2, y2, u1, u2,
|
||||
v1, v2,
|
||||
color, this.scissorStack.peekLast()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableScissor(int x1, int y1, int x2, int y2) {
|
||||
ScreenRect screenRect = (new ScreenRect(x1, y1, x2 - x1, y2 - y1))
|
||||
.transform(this.matrices.peek().getPositionMatrix());
|
||||
this.setScissor(this.scissorStack.push(screenRect));
|
||||
ScreenRect screenRect = (new ScreenRect(x1, y1, x2 - x1, y2 - y1)).transform(this.matrices);
|
||||
this.scissorStack.push(screenRect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableScissor() {
|
||||
this.setScissor(this.scissorStack.pop());
|
||||
this.scissorStack.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scissorContains(int x, int y) {
|
||||
return this.scissorStack.containsPoint(x, y);
|
||||
return this.scissorStack.contains(x, y);
|
||||
}
|
||||
|
||||
private void setScissor(@Nullable ScreenRect rect) {
|
||||
this.draw();
|
||||
if (rect != null) {
|
||||
Window window = SaturnClient.client.getWindow();
|
||||
int i = window.getFramebufferHeight();
|
||||
double d = window.getScaleFactor();
|
||||
double e = (double) rect.getLeft() * d;
|
||||
double f = (double) i - (double) rect.getBottom() * d;
|
||||
double g = (double) rect.width() * d;
|
||||
double h = (double) rect.height() * d;
|
||||
RenderSystem.enableScissor((int) e, (int) f, Math.max(0, (int) g), Math.max(0, (int) h));
|
||||
} else {
|
||||
RenderSystem.disableScissor();
|
||||
public static class ScissorStack {
|
||||
private final Deque<ScreenRect> stack = new ArrayDeque();
|
||||
|
||||
ScissorStack() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
this.vertexConsumers.draw();
|
||||
}
|
||||
|
||||
public void draw(Consumer<VertexConsumerProvider> drawer) {
|
||||
drawer.accept(this.vertexConsumers);
|
||||
this.vertexConsumers.draw();
|
||||
}
|
||||
|
||||
static class ScissorStack {
|
||||
private final Deque<ScreenRect> stack = new ArrayDeque<>();
|
||||
|
||||
public ScreenRect push(ScreenRect p_281812_) {
|
||||
ScreenRect screenrectangle = this.stack.peekLast();
|
||||
if (screenrectangle != null) {
|
||||
ScreenRect screenrectangle1 = Objects.requireNonNullElse(p_281812_.intersection(screenrectangle),
|
||||
public ScreenRect push(ScreenRect rect) {
|
||||
ScreenRect screenRect = (ScreenRect) this.stack.peekLast();
|
||||
if (screenRect != null) {
|
||||
ScreenRect screenRect2 = (ScreenRect) Objects.requireNonNullElse(rect.intersection(screenRect),
|
||||
ScreenRect.empty());
|
||||
this.stack.addLast(screenrectangle1);
|
||||
return screenrectangle1;
|
||||
this.stack.addLast(screenRect2);
|
||||
return screenRect2;
|
||||
} else {
|
||||
this.stack.addLast(p_281812_);
|
||||
return p_281812_;
|
||||
this.stack.addLast(rect);
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,12 +345,17 @@ public class RenderScopeImpl implements RenderScope {
|
||||
throw new IllegalStateException("Scissor stack underflow");
|
||||
} else {
|
||||
this.stack.removeLast();
|
||||
return this.stack.peekLast();
|
||||
return (ScreenRect) this.stack.peekLast();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsPoint(int p_329411_, int p_333404_) {
|
||||
return this.stack.isEmpty() ? true : this.stack.peek().contains(p_329411_, p_333404_);
|
||||
@Nullable
|
||||
public ScreenRect peekLast() {
|
||||
return (ScreenRect) this.stack.peekLast();
|
||||
}
|
||||
|
||||
public boolean contains(int x, int y) {
|
||||
return this.stack.isEmpty() ? true : ((ScreenRect) this.stack.peek()).contains(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,43 +392,29 @@ public class RenderScopeImpl implements RenderScope {
|
||||
private void drawItem(@Nullable LivingEntity entity, @Nullable World world, ItemStack stack, int x, int y, int seed,
|
||||
int z) {
|
||||
if (!stack.isEmpty()) {
|
||||
SaturnClient.client.getItemModelManager().update(this.itemRenderState, stack, ItemDisplayContext.GUI, world, entity, seed);
|
||||
this.matrices.push();
|
||||
this.matrices.translate((float) (x + 8), (float) (y + 8),
|
||||
(float) (150 + z)); //always has depth
|
||||
ItemRenderState itemRenderState = new ItemRenderState();
|
||||
SaturnClient.client.getItemModelManager().clearAndUpdate(itemRenderState, stack, ItemDisplayContext.GUI,
|
||||
world,
|
||||
entity, seed);
|
||||
|
||||
try {
|
||||
this.matrices.scale(16.0F, -16.0F, 16.0F);
|
||||
boolean bl = !this.itemRenderState.isSideLit();
|
||||
if (bl) {
|
||||
this.draw();
|
||||
DiffuseLighting.disableGuiDepthLighting();
|
||||
}
|
||||
|
||||
this.itemRenderState.render(this.matrices, this.vertexConsumers, 15728880, OverlayTexture.DEFAULT_UV);
|
||||
this.draw();
|
||||
if (bl) {
|
||||
DiffuseLighting.enableGuiDepthLighting();
|
||||
}
|
||||
} catch (Throwable var11) {
|
||||
CrashReport crashReport = CrashReport.create(var11, "Rendering item");
|
||||
this.state.addItem(new ItemGuiElementRenderState(stack.getItem().getName().toString(),
|
||||
new Matrix3x2f(this.matrices), itemRenderState, x, y, this.scissorStack.peekLast()));
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashReport = CrashReport.create(throwable, "Rendering item");
|
||||
CrashReportSection crashReportSection = crashReport.addElement("Item being rendered");
|
||||
crashReportSection.add("Item Type", () -> {
|
||||
return String.valueOf(stack.getItem());
|
||||
});
|
||||
crashReportSection.add("Item Components", () -> {
|
||||
return String.valueOf(stack.getComponents());
|
||||
});
|
||||
crashReportSection.add("Item Foil", () -> {
|
||||
return String.valueOf(stack.hasGlint());
|
||||
});
|
||||
crashReportSection.add("Item Type", () -> String.valueOf(stack.getItem()));
|
||||
crashReportSection.add("Item Components", () -> String.valueOf(stack.getComponents()));
|
||||
crashReportSection.add("Item Foil", () -> String.valueOf(stack.hasGlint()));
|
||||
throw new CrashException(crashReport);
|
||||
}
|
||||
|
||||
this.matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height) {
|
||||
this.drawSpriteStretched(sprite, x, y, width, height, -1);
|
||||
@@ -458,40 +431,6 @@ public class RenderScopeImpl implements RenderScope {
|
||||
}
|
||||
}
|
||||
|
||||
public void fill(int x1, int y1, int x2, int y2, int color) {
|
||||
this.fill(x1, y1, x2, y2, 0, color);
|
||||
}
|
||||
|
||||
public void fill(int x1, int y1, int x2, int y2, int z, int color) {
|
||||
this.fill(RenderLayer.getGui(), x1, y1, x2, y2, z, color);
|
||||
}
|
||||
|
||||
public void fill(RenderLayer layer, int x1, int y1, int x2, int y2, int color) {
|
||||
this.fill(layer, x1, y1, x2, y2, 0, color);
|
||||
}
|
||||
|
||||
public void fill(RenderLayer layer, int x1, int y1, int x2, int y2, int z, int color) {
|
||||
Matrix4f matrix4f = this.matrices.peek().getPositionMatrix();
|
||||
int i;
|
||||
if (x1 < x2) {
|
||||
i = x1;
|
||||
x1 = x2;
|
||||
x2 = i;
|
||||
}
|
||||
|
||||
if (y1 < y2) {
|
||||
i = y1;
|
||||
y1 = y2;
|
||||
y2 = i;
|
||||
}
|
||||
|
||||
VertexConsumer vertexConsumer = this.vertexConsumers.getBuffer(layer);
|
||||
vertexConsumer.vertex(matrix4f, (float) x1, (float) y1, (float) z).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x1, (float) y2, (float) z).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x2, (float) y2, (float) z).color(color);
|
||||
vertexConsumer.vertex(matrix4f, (float) x2, (float) y1, (float) z).color(color);
|
||||
}
|
||||
|
||||
public void drawBorder(int x, int y, int width, int height, int color) {
|
||||
this.fill(x, y, x + width, y + 1, color);
|
||||
this.fill(x, y + height - 1, x + width, y + height, color);
|
||||
|
||||
+9
-5
@@ -1,12 +1,16 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.gui.render.state.GuiRenderState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(DrawContext.class)
|
||||
public interface DrawContextAccessor {
|
||||
@Accessor("vertexConsumers")
|
||||
VertexConsumerProvider.Immediate getVertexConsumers();
|
||||
public abstract class DrawContextAccessor {
|
||||
@Shadow
|
||||
public GuiRenderState state;
|
||||
|
||||
public GuiRenderState getState() {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user