Fixed trigger pixels legend

This commit is contained in:
Sollace 2023-07-24 20:53:38 +01:00
parent ab84884677
commit be474aa579
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 10 additions and 5 deletions

View file

@ -16,6 +16,12 @@ import java.util.stream.Collectors;
class LegendOverlayWidget implements Carousel.Element, ITextContext { class LegendOverlayWidget implements Carousel.Element, ITextContext {
private static final Bounds LEGEND_BLOCK_BOUNDS = new Bounds(0, 0, 10, 10); private static final Bounds LEGEND_BLOCK_BOUNDS = new Bounds(0, 0, 10, 10);
private final Bounds frame;
public LegendOverlayWidget(Bounds frame) {
this.frame = frame;
}
@Override @Override
public void render(DummyPlayer player, DrawContext context, int mouseX, int mouseY) { public void render(DummyPlayer player, DrawContext context, int mouseX, int mouseY) {
IPonyData data = IPony.getManager().getPony(player).metadata(); IPonyData data = IPony.getManager().getPony(player).metadata();
@ -23,13 +29,12 @@ class LegendOverlayWidget implements Carousel.Element, ITextContext {
data.getTriggerPixels().forEach((key, value) -> { data.getTriggerPixels().forEach((key, value) -> {
context.getMatrices().push(); context.getMatrices().push();
int i = index[0]++; int i = index[0]++;
int x = 0;//frame.left; int x = frame.left;
int y = 0/*frame.top*/ + (i * 10 + 20); int y = frame.top + (i * 10 + 20);
context.getMatrices().translate(x, y, 1); context.getMatrices().translate(x, y, 1);
drawLegendBlock(context, 0, 0, 0, mouseX - x, mouseY - y, key, value); drawLegendBlock(context, 0, 0, 0, mouseX - x, mouseY - y, key, value);
context.getMatrices().pop(); context.getMatrices().pop();
}); });
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().draw();
} }
private void drawLegendBlock(DrawContext context, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType<?> value) { private void drawLegendBlock(DrawContext context, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType<?> value) {

View file

@ -17,8 +17,8 @@ class PonifiedDualCarouselWidget extends DualCarouselWidget {
public PonifiedDualCarouselWidget(GuiSkins screen) { public PonifiedDualCarouselWidget(GuiSkins screen) {
super(screen); super(screen);
local.addElement(new LegendOverlayWidget()); local.addElement(new LegendOverlayWidget(local.bounds));
remote.addElement(new LegendOverlayWidget()); remote.addElement(new LegendOverlayWidget(remote.bounds));
} }
@Override @Override