use of com.simibubi.create.foundation.utility.Color in project Create by Creators-of-Create.
the class UIRenderHelper method streak.
public static void streak(PoseStack ms, float angle, int x, int y, int breadth, int length, Color c) {
Color color = c.copy().setImmutable();
int c1 = color.scaleAlpha(0.625f).getRGB();
int c2 = color.scaleAlpha(0.5f).getRGB();
int c3 = color.scaleAlpha(0.0625f).getRGB();
int c4 = color.scaleAlpha(0f).getRGB();
ms.pushPose();
ms.translate(x, y, 0);
ms.mulPose(Vector3f.ZP.rotationDegrees(angle - 90));
streak(ms, breadth / 2, length, c1, c2, c3, c4);
ms.popPose();
}
use of com.simibubi.create.foundation.utility.Color in project Create by Creators-of-Create.
the class NavigatableSimiScreen method renderZeloBreadcrumbs.
protected void renderZeloBreadcrumbs(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
List<Screen> history = ScreenOpener.getScreenHistory();
if (history.isEmpty())
return;
history.add(0, minecraft.screen);
int spacing = 20;
List<String> names = history.stream().map(NavigatableSimiScreen::screenTitle).collect(Collectors.toList());
int bWidth = names.stream().mapToInt(s -> font.width(s) + spacing).sum();
MutableInt x = new MutableInt(width - bWidth);
MutableInt y = new MutableInt(height - 18);
MutableBoolean first = new MutableBoolean(true);
if (x.getValue() < 25)
x.setValue(25);
ms.pushPose();
ms.translate(0, 0, 600);
names.forEach(s -> {
int sWidth = font.width(s);
UIRenderHelper.breadcrumbArrow(ms, x.getValue(), y.getValue(), 0, sWidth + spacing, 14, spacing / 2, new Color(0xdd101010), new Color(0x44101010));
font.draw(ms, s, x.getValue() + 5, y.getValue() + 3, first.getValue() ? 0xffeeffee : 0xffddeeff);
first.setFalse();
x.add(sWidth + spacing);
});
ms.popPose();
}
use of com.simibubi.create.foundation.utility.Color in project Create by Creators-of-Create.
the class EjectorTargetHandler method drawArc.
protected static void drawArc() {
Minecraft mc = Minecraft.getInstance();
boolean wrench = AllItems.WRENCH.isIn(mc.player.getMainHandItem());
if (currentSelection == null)
return;
if (currentItem == null && !wrench)
return;
HitResult objectMouseOver = mc.hitResult;
if (!(objectMouseOver instanceof BlockHitResult))
return;
BlockHitResult blockRayTraceResult = (BlockHitResult) objectMouseOver;
if (blockRayTraceResult.getType() == Type.MISS)
return;
BlockPos pos = blockRayTraceResult.getBlockPos();
if (!wrench)
pos = pos.relative(blockRayTraceResult.getDirection());
int xDiff = currentSelection.getX() - pos.getX();
int yDiff = currentSelection.getY() - pos.getY();
int zDiff = currentSelection.getZ() - pos.getZ();
int validX = Math.abs(zDiff) > Math.abs(xDiff) ? 0 : xDiff;
int validZ = Math.abs(zDiff) < Math.abs(xDiff) ? 0 : zDiff;
BlockPos validPos = currentSelection.offset(validX, yDiff, validZ);
Direction d = getValidTargetDirection(validPos);
if (d == null)
return;
if (launcher == null || lastHoveredBlockPos != pos.asLong()) {
lastHoveredBlockPos = pos.asLong();
launcher = new EntityLauncher(Math.abs(validX + validZ), yDiff);
}
double totalFlyingTicks = launcher.getTotalFlyingTicks() + 3;
int segments = (((int) totalFlyingTicks) / 3) + 1;
double tickOffset = totalFlyingTicks / segments;
boolean valid = xDiff == validX && zDiff == validZ;
int intColor = valid ? 0x9ede73 : 0xff7171;
Vector3f color = new Color(intColor).asVectorF();
DustParticleOptions data = new DustParticleOptions(color, 1);
ClientLevel world = mc.level;
AABB bb = new AABB(0, 0, 0, 1, 0, 1).move(currentSelection.offset(-validX, -yDiff, -validZ));
CreateClient.OUTLINER.chaseAABB("valid", bb).colored(intColor).lineWidth(1 / 16f);
for (int i = 0; i < segments; i++) {
double ticks = ((AnimationTickHolder.getRenderTime() / 3) % tickOffset) + i * tickOffset;
Vec3 vec = launcher.getGlobalPos(ticks, d, pos).add(xDiff - validX, 0, zDiff - validZ);
world.addParticle(data, vec.x, vec.y, vec.z, 0, 0, 0);
}
}
use of com.simibubi.create.foundation.utility.Color in project Create by Creators-of-Create.
the class TextWindowElement method render.
@Override
protected void render(PonderScene scene, PonderUI screen, PoseStack ms, float partialTicks, float fade) {
if (bakedText == null)
bakedText = textGetter.get();
if (fade < 1 / 16f)
return;
Vec2 sceneToScreen = vec != null ? scene.getTransform().sceneToScreen(vec, partialTicks) : new Vec2(screen.width / 2, (screen.height - 200) / 2 + y - 8);
float yDiff = (screen.height / 2f - sceneToScreen.y - 10) / 100f;
int targetX = (int) (screen.width * Mth.lerp(yDiff * yDiff, 6f / 8, 5f / 8));
if (nearScene)
targetX = (int) Math.min(targetX, sceneToScreen.x + 50);
int textWidth = Math.min(screen.width - targetX, 180);
List<FormattedText> lines = screen.getFontRenderer().getSplitter().splitLines(bakedText, textWidth, Style.EMPTY);
int boxWidth = 0;
for (FormattedText line : lines) boxWidth = Math.max(boxWidth, screen.getFontRenderer().width(line));
int boxHeight = screen.getFontRenderer().wordWrapHeight(bakedText, boxWidth);
ms.pushPose();
ms.translate(0, sceneToScreen.y, 400);
new BoxElement().withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT)).gradientBorder(Theme.p(Theme.Key.TEXT_WINDOW_BORDER)).at(targetX - 10, 3, 100).withBounds(boxWidth, boxHeight - 1).render(ms);
// PonderUI.renderBox(ms, targetX - 10, 3, boxWidth, boxHeight - 1, 0xaa000000, 0x30eebb00, 0x10eebb00);
int brighterColor = Color.mixColors(color, 0xFFffffdd, 1 / 2f);
if (vec != null) {
ms.pushPose();
ms.translate(sceneToScreen.x, 0, 0);
double lineTarget = (targetX - sceneToScreen.x) * fade;
ms.scale((float) lineTarget, 1, 1);
Matrix4f model = ms.last().pose();
GuiUtils.drawGradientRect(model, -100, 0, 0, 1, 1, brighterColor, brighterColor);
GuiUtils.drawGradientRect(model, -100, 0, 1, 1, 2, 0xFF494949, 0xFF393939);
ms.popPose();
}
ms.translate(0, 0, 400);
for (int i = 0; i < lines.size(); i++) {
screen.getFontRenderer().draw(ms, lines.get(i).getString(), targetX - 10, 3 + 9 * i, new Color(brighterColor).scaleAlpha(fade).getRGB());
}
ms.popPose();
}
use of com.simibubi.create.foundation.utility.Color in project Create by Creators-of-Create.
the class ConfigScreenList method render.
@Override
public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
Color c = new Color(0x60_000000);
UIRenderHelper.angledGradient(ms, 90, x0 + width / 2, y0, width, 5, c, Color.TRANSPARENT_BLACK);
UIRenderHelper.angledGradient(ms, -90, x0 + width / 2, y1, width, 5, c, Color.TRANSPARENT_BLACK);
UIRenderHelper.angledGradient(ms, 0, x0, y0 + height / 2, height, 5, c, Color.TRANSPARENT_BLACK);
UIRenderHelper.angledGradient(ms, 180, x1, y0 + height / 2, height, 5, c, Color.TRANSPARENT_BLACK);
super.render(ms, mouseX, mouseY, partialTicks);
}
Aggregations