Merge remote-tracking branch 'origin/mc1.16/dev' into mc1.16/dev

This commit is contained in:
grimmauld 2021-03-27 08:32:32 +01:00
commit 5dad567766
8 changed files with 86 additions and 69 deletions

View file

@ -8,6 +8,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft;
@ -79,8 +80,11 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
int posY = this.height / 2 + offsetY;
renderTooltip(ms, tooltip, posX, posY);
//UIRenderHelper.breadcrumbArrow(ms, 50, 50, 100, 50, 20, 10, 0x80aa9999, 0x10aa9999);
//UIRenderHelper.breadcrumbArrow(ms, 100, 80, 0, -50, 20, -10, 0x80aa9999, 0x10aa9999);
ItemStack item = AllItems.GOGGLES.asStack();
GuiGameElement.of(item).at(posX + 10, posY - 16, 450).render(ms);
GuiGameElement.of(item).at(0, 0, 450).render(ms);
//GuiGameElement.of(item).at(0, 0, 450).render(ms);
}
}

View file

@ -103,16 +103,16 @@ public class UIRenderHelper {
}
//draws a wide chevron-style breadcrumb arrow pointing left
public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int width, int height, int indent, int startColor, int endColor) {
public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int z, int width, int height, int indent, int startColor, int endColor) {
matrixStack.push();
matrixStack.translate(x - indent, y, 0);
matrixStack.translate(x - indent, y, z);
breadcrumbArrow(width, height, indent, startColor, endColor);
breadcrumbArrow(matrixStack, width, height, indent, startColor, endColor);
matrixStack.pop();
}
private static void breadcrumbArrow(int width, int height, int indent, int c1, int c2) {
private static void breadcrumbArrow(MatrixStack ms, int width, int height, int indent, int c1, int c2) {
/*
* 0,0 x1,y1 ********************* x4,y4 ***** x7,y7
@ -125,16 +125,18 @@ public class UIRenderHelper {
*
* */
double x0 = 0, y0 = height / 2d;
double x1 = indent, y1 = 0;
double x2 = indent, y2 = height / 2d;
double x3 = indent, y3 = height;
double x4 = width, y4 = 0;
double x5 = width, y5 = height / 2d;
double x6 = width, y6 = height;
double x7 = indent + width, y7 = 0;
double x8 = indent + width, y8 = height;
float x0 = 0, y0 = height / 2f;
float x1 = indent, y1 = 0;
float x2 = indent, y2 = height / 2f;
float x3 = indent, y3 = height;
float x4 = width, y4 = 0;
float x5 = width, y5 = height / 2f;
float x6 = width, y6 = height;
float x7 = indent + width, y7 = 0;
float x8 = indent + width, y8 = height;
indent = Math.abs(indent);
width = Math.abs(width);
int fc1 = ColorHelper.mixAlphaColors(c1, c2, 0);
int fc2 = ColorHelper.mixAlphaColors(c1, c2, (indent)/(width + 2f * indent));
int fc3 = ColorHelper.mixAlphaColors(c1, c2, (indent + width)/(width + 2f * indent));
@ -142,41 +144,44 @@ public class UIRenderHelper {
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.disableCull();
RenderSystem.disableAlphaTest();
RenderSystem.defaultBlendFunc();
RenderSystem.shadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
Matrix4f model = ms.peek().getModel();
bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.vertex(x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x7, y7, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x7, y7, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(x8, y8, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();
bufferbuilder.vertex(model, x8, y8, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();
tessellator.draw();
RenderSystem.shadeModel(GL11.GL_FLAT);
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.enableAlphaTest();
RenderSystem.enableTexture();
}

View file

@ -1,7 +1,6 @@
package com.simibubi.create.foundation.ponder;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.IScreenRenderable;
import com.simibubi.create.foundation.gui.ScreenOpener;
@ -115,7 +114,7 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
Screen lastScreen = ScreenOpener.getPreviouslyRenderedScreen();
float transitionValue = transition.getValue(partialTicks);
double scale = 1 + 0.5 * transitionValue;
float scale = 1 + 0.5f * transitionValue;
// draw last screen into buffer
if (lastScreen != null && lastScreen != this) {
@ -152,7 +151,7 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
}
// modify current screen as well
scale = transitionValue > 0 ? 1 - 0.5 * (1 - transitionValue) : 1 + .5 * (1 + transitionValue);
scale = transitionValue > 0 ? 1 - 0.5f * (1 - transitionValue) : 1 + .5f * (1 + transitionValue);
ms.translate(depthPointX, depthPointY, 0);
ms.scale((float) scale, (float) scale, 1);
ms.translate(-depthPointX, -depthPointY, 0);
@ -162,10 +161,10 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
int maxX = backTrack.x + backTrack.getWidth();
if (x + 30 < backTrack.x)
UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, maxX - (x + 30), 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, 0, maxX - (x + 30), 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, x, height - 51, 30, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, x - 30, height - 51, 30, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, x, height - 51, 0, 30, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, x - 30, height - 51, 0, 30, 20, 5, 0x40aa9999, 0x10aa9999);
}
}
@ -223,7 +222,7 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
ms.translate(0, 0, 600);
names.forEach(s -> {
int sWidth = textRenderer.getStringWidth(s);
UIRenderHelper.breadcrumbArrow(ms, x.getValue(), y.getValue(), sWidth + spacing, 14, spacing / 2, 0xdd101010,
UIRenderHelper.breadcrumbArrow(ms, x.getValue(), y.getValue(), 0, sWidth + spacing, 14, spacing / 2, 0xdd101010,
0x44101010);
textRenderer.draw(ms, s, x.getValue() + 5, y.getValue() + 3, first.getValue() ? 0xffeeffee : 0xffddeeff);
first.setFalse();

View file

@ -108,7 +108,13 @@ public class PonderProgressBar extends AbstractSimiWidget {
hovered = clicked(mouseX, mouseY);
ms.push();
ms.translate(0, 0, 400);
ms.translate(0, 0, 150);
/* ponderButtons are at z+400
* renderBox is at z+100
* gradients have to be in front of the box so z>+100
* */
ms.push();
PonderUI.renderBox(ms, x, y, width, height, false);
ms.pop();
@ -117,13 +123,15 @@ public class PonderProgressBar extends AbstractSimiWidget {
ms.push();
ms.scale((width + 4) * progress.getValue(partialTicks), 1, 1);
GuiUtils.drawGradientRect(ms.peek().getModel(), 500, 0, 3, 1, 4, 0x80ffeedd, 0x80ffeedd);
GuiUtils.drawGradientRect(ms.peek().getModel(), 500, 0, 4, 1, 5, 0x50ffeedd, 0x50ffeedd);
GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 3, 1, 4, 0x80ffeedd, 0x80ffeedd);
GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 4, 1, 5, 0x50ffeedd, 0x50ffeedd);
ms.pop();
renderKeyframes(ms, mouseX, partialTicks);
ms.pop();
ms.pop();
}
private void renderKeyframes(MatrixStack ms, int mouseX, float partialTicks) {

View file

@ -386,7 +386,7 @@ public class PonderUI extends NavigatableSimiScreen {
MutableBoundingBox bounds = story.getBounds();
ms.push();
ms.peek().getModel().multiply(ms.peek().getModel());
//ms.peek().getModel().multiply(ms.peek().getModel());
// kool shadow fx
{
@ -394,7 +394,7 @@ public class PonderUI extends NavigatableSimiScreen {
RenderSystem.enableDepthTest();
ms.push();
ms.translate(story.basePlateOffsetX, 0, story.basePlateOffsetZ);
ms.translate(1, -1, 1);
ms.scale(1, -1, 1);
float flash = finishingFlash.getValue(partialTicks) * .9f;
float alpha = flash;
@ -531,10 +531,10 @@ public class PonderUI extends NavigatableSimiScreen {
ms.pop();
}
UIRenderHelper.breadcrumbArrow(ms, width / 2 - 20, height - 51, 20, 20, 5, 0x40aa9999, 0x20aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 + 20, height - 51, -20, 20, -5, 0x40aa9999, 0x20aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 - 90, height - 51, 70, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 + 90, height - 51, -70, 20, -5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 - 20, height - 51, 0, 20, 20, 5, 0x40aa9999, 0x20aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 + 20, height - 51, 0, -20, 20, -5, 0x40aa9999, 0x20aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 - 90, height - 51, 0, 70, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(ms, width / 2 + 90, height - 51, 0, -70, 20, -5, 0x40aa9999, 0x10aa9999);
}
if (identifyMode) {

View file

@ -62,12 +62,6 @@ public class PonderTagScreen extends NavigatableSimiScreen {
items.clear();
PonderRegistry.tags.getItems(tag)
.stream()
.filter(rl -> tag.getMainItem()
.isEmpty()
|| !tag.getMainItem()
.getItem()
.getRegistryName()
.equals(rl))
.map(key -> {
Item item = ForgeRegistries.ITEMS.getValue(key);
if (item == null) {
@ -80,6 +74,9 @@ public class PonderTagScreen extends NavigatableSimiScreen {
.filter(Objects::nonNull)
.forEach(items::add);
if (!tag.getMainItem().isEmpty())
items.remove(tag.getMainItem().getItem());
int rowCount = MathHelper.clamp((int) Math.ceil(items.size() / 11d), 1, 3);
LayoutHelper layout = LayoutHelper.centeredHorizontal(items.size(), rowCount, 28, 28, 8);
itemArea = layout.getArea();
@ -108,22 +105,21 @@ public class PonderTagScreen extends NavigatableSimiScreen {
layout.next();
}
if (!tag.getMainItem()
.isEmpty()) {
if (!tag.getMainItem().isEmpty()) {
ResourceLocation registryName = tag.getMainItem()
.getItem()
.getRegistryName();
.getItem()
.getRegistryName();
final boolean canClick = PonderRegistry.all.containsKey(registryName);
PonderButton button =
new PonderButton(itemCenterX - layout.getTotalWidth() / 2 - 42, itemCenterY - 10, (mouseX, mouseY) -> {
if (!canClick)
return;
centerScalingOn(mouseX, mouseY);
ScreenOpener.transitionTo(PonderUI.of(tag.getMainItem(), tag));
}).showing(tag.getMainItem());
new PonderButton(itemCenterX - layout.getTotalWidth() / 2 - 42, itemCenterY - 10, (mouseX, mouseY) -> {
if (!canClick)
return;
centerScalingOn(mouseX, mouseY);
ScreenOpener.transitionTo(PonderUI.of(tag.getMainItem(), tag));
}).showing(tag.getMainItem());
if (!canClick)
if (registryName.getNamespace()
.equals(Create.ID))
.equals(Create.ID))
button.customColors(0x70984500, 0x70692400);
else
button.customColors(0x505000FF, 0x50300077);
@ -184,14 +180,14 @@ public class PonderTagScreen extends NavigatableSimiScreen {
ms.translate(width / 2 - 120, height * mainYmult - 40, 0);
ms.push();
ms.translate(0, 0, 800);
//ms.translate(0, 0, 800);
int x = 31 + 20 + 8;
int y = 31;
String title = tag.getTitle();
int streakHeight = 35;
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (240), 0x101010);
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, 240, 0x101010);
PonderUI.renderBox(ms, 21, 21, 30, 30, false);
textRenderer.draw(ms, Lang.translate(PonderUI.PONDERING), x, y - 6, 0xffa3a3a3);
@ -203,7 +199,7 @@ public class PonderTagScreen extends NavigatableSimiScreen {
ms.pop();
ms.push();
ms.translate(23, 23, 0);
ms.translate(23, 23, 10);
ms.scale(1.66f, 1.66f, 1.66f);
tag.draw(ms, this, 0, 0);
ms.pop();
@ -242,6 +238,8 @@ public class PonderTagScreen extends NavigatableSimiScreen {
// UIRenderHelper.streak(0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 180, 0x101010);
drawCenteredString(ms, textRenderer, relatedTitle, sWidth / 2, itemArea.getY() - 20, 0xeeeeee);
ms.translate(0,0, -200);
UIRenderHelper.streak(ms, 0, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75, 0x101010);
UIRenderHelper.streak(ms, 180, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75, 0x101010);

View file

@ -115,6 +115,8 @@ public class InputWindowElement extends AnimatedOverlayElement {
PonderUI.renderSpeechBox(ms, 0, 0, width, height, false, direction, true);
ms.translate(0, 0, 100);
if (hasText)
font.draw(ms, text, 2, (height - font.FONT_HEIGHT) / 2f + 2,
ColorHelper.applyAlpha(PonderPalette.WHITE.getColor(), fade));
@ -123,7 +125,7 @@ public class InputWindowElement extends AnimatedOverlayElement {
ms.push();
ms.translate(keyWidth, 0, 0);
ms.scale(1.5f, 1.5f, 1.5f);
icon.draw(ms, 0, 0);
icon.draw(ms, screen, 0, 0);
ms.pop();
}

View file

@ -110,6 +110,7 @@ public class PonderButton extends AbstractSimiWidget {
borderColorStart = ColorHelper.applyAlpha(borderColorStart, fade);
borderColorEnd = ColorHelper.applyAlpha(borderColorEnd, fade);
ms.translate(0, 0, 300);
PonderUI.renderBox(ms, x, y, width, height, backgroundColor, borderColorStart, borderColorEnd);
ms.translate(0, 0, 100);