Исходник MainScreen 2.0|Expensive 3.1

Начинающий
Статус
Оффлайн
Регистрация
2 Май 2024
Сообщения
3
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Етот код меняет mainscreen по таймингу на разние фото, можно зделать по кадревую анимацию и тд


ss:

kod:package fun.ellant.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import fun.ellant.utils.client.ClientUtil;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.client.Vec2i;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.math.StopWatch;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.KawaseBlur;
import fun.ellant.utils.render.Stencil;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.Ellant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

public class MainScreen extends Screen implements IMinecraft {
public MainScreen() {
super(ITextComponent.getTextComponentOrEmpty(""));
}

private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
private final ResourceLocation backmenu2 = new ResourceLocation("expensive/images/backmenu2.png");
private final ResourceLocation backmenu3 = new ResourceLocation("expensive/images/backmenu3.png");

private final List<Button> buttons = new ArrayList<>();

private int timer = 0; // Инициализация таймера
private int phase = 1;

@Override
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
float widthButton = 285 / 2f;

for (Particle particle : particles) {
particle.y = ThreadLocalRandom.current().nextInt(-5, height);
}

float x = ClientUtil.calc(width) / 2f - widthButton / 2f;
float y = Math.round(ClientUtil.calc(height) / 2f + 1);
buttons.clear();

buttons.add(new Button(x, y, widthButton, 34, "Одиночная игра", () -> {
mc.displayGuiScreen(new WorldSelectionScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Мультиплеер", () -> {
mc.displayGuiScreen(new MultiplayerScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Настройки", () -> {
mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Выйти", mc::shutdownMinecraftApplet));
}

private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

private final StopWatch stopWatch = new StopWatch();
static boolean start = false;

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
Ellant.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
return super.mouseScrolled(mouseX, mouseY, delta);
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);

if (stopWatch.isReached(100)) {
particles.add(new Particle());
stopWatch.reset();
}


MainWindow mainWindow = mc.getMainWindow();
int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());


if (timer < 90) {
DisplayUtils.drawImage(backmenu2, 0, 0, width, height, -1);
} else if (timer < 210) {
DisplayUtils.drawImage(backmenu3, 0, 0, width, height, -1);
} else {
DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
}


timer++;


if (timer >= 300) {
timer = 0;
}


mc.gameRenderer.setupOverlayRendering(2);
KawaseBlur.blur.updateBlur(3, 4);
drawButtons(matrixStack, mouseX, mouseY, partialTicks);
Ellant.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
mc.gameRenderer.setupOverlayRendering();
}

@Override
public boolean charTyped(char codePoint, int modifiers) {
Ellant.getInstance().getAltWidget().onChar(codePoint);
return super.charTyped(codePoint, modifiers);
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
Ellant.getInstance().getAltWidget().onKey(keyCode);
return false;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
Ellant.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
return super.mouseClicked(mouseX, mouseY, button);
}

private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
buttons.forEach(b -> b.render(stack, mX, mY, pt));
}

public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

@AllArgsConstructor
private class Button {
Getter
private final float x, y, width, height;
private String text;
private Runnable action;

public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
Stencil.initStencilToWrite();
DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
Stencil.readStencilBuffer(1);
KawaseBlur.blur.BLURRED.draw();
Stencil.uninitStencilBuffer();

DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
int color = ColorUtils.rgb(161, 164, 177);
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
color = ColorUtils.rgb(255, 255, 255);
}
Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
}

public void click(int mouseX, int mouseY, int button) {
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
action.run();
}
}
}

private class Particle {
private final float x;
private float y;
private float size;

public Particle() {
x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
y = 0;
size = 0;
}

public void update() {
y += 1f;
}

public void render(MatrixStack stack) {
size += 0.1f;
GlStateManager.pushMatrix();
GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
GlStateManager.rotatef(size * 20, 0, 0, 1);
GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
y += 1;
Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, -1, MathHelper.clamp(size * multi, 0, 9));
GlStateManager.popMatrix();
if (y >= mc.getMainWindow().getScaledHeight()) {
particles.remove(this);
}
}
}
}
 
Начинающий
Статус
Оффлайн
Регистрация
1 Авг 2024
Сообщения
40
Реакции[?]
0
Поинты[?]
0
Етот код меняет mainscreen по таймингу на разние фото, можно зделать по кадревую анимацию и тд


ss:

kod:package fun.ellant.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import fun.ellant.utils.client.ClientUtil;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.client.Vec2i;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.math.StopWatch;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.KawaseBlur;
import fun.ellant.utils.render.Stencil;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.Ellant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

public class MainScreen extends Screen implements IMinecraft {
public MainScreen() {
super(ITextComponent.getTextComponentOrEmpty(""));
}

private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
private final ResourceLocation backmenu2 = new ResourceLocation("expensive/images/backmenu2.png");
private final ResourceLocation backmenu3 = new ResourceLocation("expensive/images/backmenu3.png");

private final List<Button> buttons = new ArrayList<>();

private int timer = 0; // Инициализация таймера
private int phase = 1;

@Override
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
float widthButton = 285 / 2f;

for (Particle particle : particles) {
particle.y = ThreadLocalRandom.current().nextInt(-5, height);
}

float x = ClientUtil.calc(width) / 2f - widthButton / 2f;
float y = Math.round(ClientUtil.calc(height) / 2f + 1);
buttons.clear();

buttons.add(new Button(x, y, widthButton, 34, "Одиночная игра", () -> {
mc.displayGuiScreen(new WorldSelectionScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Мультиплеер", () -> {
mc.displayGuiScreen(new MultiplayerScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Настройки", () -> {
mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Выйти", mc::shutdownMinecraftApplet));
}

private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

private final StopWatch stopWatch = new StopWatch();
static boolean start = false;

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
Ellant.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
return super.mouseScrolled(mouseX, mouseY, delta);
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);

if (stopWatch.isReached(100)) {
particles.add(new Particle());
stopWatch.reset();
}


MainWindow mainWindow = mc.getMainWindow();
int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());


if (timer < 90) {
DisplayUtils.drawImage(backmenu2, 0, 0, width, height, -1);
} else if (timer < 210) {
DisplayUtils.drawImage(backmenu3, 0, 0, width, height, -1);
} else {
DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
}


timer++;


if (timer >= 300) {
timer = 0;
}


mc.gameRenderer.setupOverlayRendering(2);
KawaseBlur.blur.updateBlur(3, 4);
drawButtons(matrixStack, mouseX, mouseY, partialTicks);
Ellant.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
mc.gameRenderer.setupOverlayRendering();
}

@Override
public boolean charTyped(char codePoint, int modifiers) {
Ellant.getInstance().getAltWidget().onChar(codePoint);
return super.charTyped(codePoint, modifiers);
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
Ellant.getInstance().getAltWidget().onKey(keyCode);
return false;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
Ellant.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
return super.mouseClicked(mouseX, mouseY, button);
}

private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
buttons.forEach(b -> b.render(stack, mX, mY, pt));
}

public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

@AllArgsConstructor
private class Button {
Getter
private final float x, y, width, height;
private String text;
private Runnable action;

public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
Stencil.initStencilToWrite();
DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
Stencil.readStencilBuffer(1);
KawaseBlur.blur.BLURRED.draw();
Stencil.uninitStencilBuffer();

DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
int color = ColorUtils.rgb(161, 164, 177);
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
color = ColorUtils.rgb(255, 255, 255);
}
Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
}

public void click(int mouseX, int mouseY, int button) {
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
action.run();
}
}
}

private class Particle {
private final float x;
private float y;
private float size;

public Particle() {
x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
y = 0;
size = 0;
}

public void update() {
y += 1f;
}

public void render(MatrixStack stack) {
size += 0.1f;
GlStateManager.pushMatrix();
GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
GlStateManager.rotatef(size * 20, 0, 0, 1);
GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
y += 1;
Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, -1, MathHelper.clamp(size * multi, 0, 9));
GlStateManager.popMatrix();
if (y >= mc.getMainWindow().getScaledHeight()) {
particles.remove(this);
}
}
}
}
зачем
 
Начинающий
Статус
Оффлайн
Регистрация
26 Дек 2023
Сообщения
24
Реакции[?]
0
Поинты[?]
0
Етот код меняет mainscreen по таймингу на разние фото, можно зделать по кадревую анимацию и тд


ss:

kod:package fun.ellant.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import fun.ellant.utils.client.ClientUtil;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.client.Vec2i;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.math.StopWatch;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.KawaseBlur;
import fun.ellant.utils.render.Stencil;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.Ellant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

public class MainScreen extends Screen implements IMinecraft {
public MainScreen() {
super(ITextComponent.getTextComponentOrEmpty(""));
}

private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
private final ResourceLocation backmenu2 = new ResourceLocation("expensive/images/backmenu2.png");
private final ResourceLocation backmenu3 = new ResourceLocation("expensive/images/backmenu3.png");

private final List<Button> buttons = new ArrayList<>();

private int timer = 0; // Инициализация таймера
private int phase = 1;

@Override
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
float widthButton = 285 / 2f;

for (Particle particle : particles) {
particle.y = ThreadLocalRandom.current().nextInt(-5, height);
}

float x = ClientUtil.calc(width) / 2f - widthButton / 2f;
float y = Math.round(ClientUtil.calc(height) / 2f + 1);
buttons.clear();

buttons.add(new Button(x, y, widthButton, 34, "Одиночная игра", () -> {
mc.displayGuiScreen(new WorldSelectionScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Мультиплеер", () -> {
mc.displayGuiScreen(new MultiplayerScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Настройки", () -> {
mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Выйти", mc::shutdownMinecraftApplet));
}

private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

private final StopWatch stopWatch = new StopWatch();
static boolean start = false;

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
Ellant.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
return super.mouseScrolled(mouseX, mouseY, delta);
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);

if (stopWatch.isReached(100)) {
particles.add(new Particle());
stopWatch.reset();
}


MainWindow mainWindow = mc.getMainWindow();
int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());


if (timer < 90) {
DisplayUtils.drawImage(backmenu2, 0, 0, width, height, -1);
} else if (timer < 210) {
DisplayUtils.drawImage(backmenu3, 0, 0, width, height, -1);
} else {
DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
}


timer++;


if (timer >= 300) {
timer = 0;
}


mc.gameRenderer.setupOverlayRendering(2);
KawaseBlur.blur.updateBlur(3, 4);
drawButtons(matrixStack, mouseX, mouseY, partialTicks);
Ellant.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
mc.gameRenderer.setupOverlayRendering();
}

@Override
public boolean charTyped(char codePoint, int modifiers) {
Ellant.getInstance().getAltWidget().onChar(codePoint);
return super.charTyped(codePoint, modifiers);
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
Ellant.getInstance().getAltWidget().onKey(keyCode);
return false;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
Ellant.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
return super.mouseClicked(mouseX, mouseY, button);
}

private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
buttons.forEach(b -> b.render(stack, mX, mY, pt));
}

public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

@AllArgsConstructor
private class Button {
Getter
private final float x, y, width, height;
private String text;
private Runnable action;

public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
Stencil.initStencilToWrite();
DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
Stencil.readStencilBuffer(1);
KawaseBlur.blur.BLURRED.draw();
Stencil.uninitStencilBuffer();

DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
int color = ColorUtils.rgb(161, 164, 177);
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
color = ColorUtils.rgb(255, 255, 255);
}
Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
}

public void click(int mouseX, int mouseY, int button) {
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
action.run();
}
}
}

private class Particle {
private final float x;
private float y;
private float size;

public Particle() {
x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
y = 0;
size = 0;
}

public void update() {
y += 1f;
}

public void render(MatrixStack stack) {
size += 0.1f;
GlStateManager.pushMatrix();
GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
GlStateManager.rotatef(size * 20, 0, 0, 1);
GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
y += 1;
Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, -1, MathHelper.clamp(size * multi, 0, 9));
GlStateManager.popMatrix();
if (y >= mc.getMainWindow().getScaledHeight()) {
particles.remove(this);
}
}
}
}
Код:
kod:package fun.ellant.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import fun.ellant.utils.client.ClientUtil;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.client.Vec2i;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.math.StopWatch;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.KawaseBlur;
import fun.ellant.utils.render.Stencil;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.Ellant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

public class MainScreen extends Screen implements IMinecraft {
public MainScreen() {
super(ITextComponent.getTextComponentOrEmpty(""));
}

private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
private final ResourceLocation backmenu2 = new ResourceLocation("expensive/images/backmenu2.png");
private final ResourceLocation backmenu3 = new ResourceLocation("expensive/images/backmenu3.png");

private final List<Button> buttons = new ArrayList<>();

private int timer = 0; // Инициализация таймера
private int phase = 1;

@Override
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
float widthButton = 285 / 2f;

for (Particle particle : particles) {
particle.y = ThreadLocalRandom.current().nextInt(-5, height);
}

float x = ClientUtil.calc(width) / 2f - widthButton / 2f;
float y = Math.round(ClientUtil.calc(height) / 2f + 1);
buttons.clear();

buttons.add(new Button(x, y, widthButton, 34, "Одиночная игра", () -> {
mc.displayGuiScreen(new WorldSelectionScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Мультиплеер", () -> {
mc.displayGuiScreen(new MultiplayerScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Настройки", () -> {
mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Выйти", mc::shutdownMinecraftApplet));
}

private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

private final StopWatch stopWatch = new StopWatch();
static boolean start = false;

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
Ellant.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
return super.mouseScrolled(mouseX, mouseY, delta);
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);

if (stopWatch.isReached(100)) {
particles.add(new Particle());
stopWatch.reset();
}


MainWindow mainWindow = mc.getMainWindow();
int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());


if (timer < 90) {
DisplayUtils.drawImage(backmenu2, 0, 0, width, height, -1);
} else if (timer < 210) {
DisplayUtils.drawImage(backmenu3, 0, 0, width, height, -1);
} else {
DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
}


timer++;


if (timer >= 300) {
timer = 0;
}


mc.gameRenderer.setupOverlayRendering(2);
KawaseBlur.blur.updateBlur(3, 4);
drawButtons(matrixStack, mouseX, mouseY, partialTicks);
Ellant.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
mc.gameRenderer.setupOverlayRendering();
}

@Override
public boolean charTyped(char codePoint, int modifiers) {
Ellant.getInstance().getAltWidget().onChar(codePoint);
return super.charTyped(codePoint, modifiers);
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
Ellant.getInstance().getAltWidget().onKey(keyCode);
return false;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
Ellant.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
return super.mouseClicked(mouseX, mouseY, button);
}

private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
buttons.forEach(b -> b.render(stack, mX, mY, pt));
}

public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

@AllArgsConstructor
private class Button {
Getter
private final float x, y, width, height;
private String text;
private Runnable action;

public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
Stencil.initStencilToWrite();
DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
Stencil.readStencilBuffer(1);
KawaseBlur.blur.BLURRED.draw();
Stencil.uninitStencilBuffer();

DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
int color = ColorUtils.rgb(161, 164, 177);
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
color = ColorUtils.rgb(255, 255, 255);
}
Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
}

public void click(int mouseX, int mouseY, int button) {
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
action.run();
}
}
}

private class Particle {
private final float x;
private float y;
private float size;

public Particle() {
x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
y = 0;
size = 0;
}

public void update() {
y += 1f;
}

public void render(MatrixStack stack) {
size += 0.1f;
GlStateManager.pushMatrix();
GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
GlStateManager.rotatef(size * 20, 0, 0, 1);
GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
y += 1;
Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, -1, MathHelper.clamp(size * multi, 0, 9));
GlStateManager.popMatrix();
if (y >= mc.getMainWindow().getScaledHeight()) {
particles.remove(this);
}
}
}
}
 
Начинающий
Статус
Оффлайн
Регистрация
19 Июл 2024
Сообщения
201
Реакции[?]
0
Поинты[?]
0
Етот код меняет mainscreen по таймингу на разние фото, можно зделать по кадревую анимацию и тд


ss:

kod:package fun.ellant.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import fun.ellant.utils.client.ClientUtil;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.client.Vec2i;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.math.StopWatch;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.KawaseBlur;
import fun.ellant.utils.render.Stencil;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.Ellant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

public class MainScreen extends Screen implements IMinecraft {
public MainScreen() {
super(ITextComponent.getTextComponentOrEmpty(""));
}

private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
private final ResourceLocation backmenu2 = new ResourceLocation("expensive/images/backmenu2.png");
private final ResourceLocation backmenu3 = new ResourceLocation("expensive/images/backmenu3.png");

private final List<Button> buttons = new ArrayList<>();

private int timer = 0; // Инициализация таймера
private int phase = 1;

@Override
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
float widthButton = 285 / 2f;

for (Particle particle : particles) {
particle.y = ThreadLocalRandom.current().nextInt(-5, height);
}

float x = ClientUtil.calc(width) / 2f - widthButton / 2f;
float y = Math.round(ClientUtil.calc(height) / 2f + 1);
buttons.clear();

buttons.add(new Button(x, y, widthButton, 34, "Одиночная игра", () -> {
mc.displayGuiScreen(new WorldSelectionScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Мультиплеер", () -> {
mc.displayGuiScreen(new MultiplayerScreen(this));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Настройки", () -> {
mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
}));
y += 34 + 5;
buttons.add(new Button(x, y, widthButton, 34, "Выйти", mc::shutdownMinecraftApplet));
}

private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

private final StopWatch stopWatch = new StopWatch();
static boolean start = false;

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
Ellant.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
return super.mouseScrolled(mouseX, mouseY, delta);
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);

if (stopWatch.isReached(100)) {
particles.add(new Particle());
stopWatch.reset();
}


MainWindow mainWindow = mc.getMainWindow();
int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());


if (timer < 90) {
DisplayUtils.drawImage(backmenu2, 0, 0, width, height, -1);
} else if (timer < 210) {
DisplayUtils.drawImage(backmenu3, 0, 0, width, height, -1);
} else {
DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
}


timer++;


if (timer >= 300) {
timer = 0;
}


mc.gameRenderer.setupOverlayRendering(2);
KawaseBlur.blur.updateBlur(3, 4);
drawButtons(matrixStack, mouseX, mouseY, partialTicks);
Ellant.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
mc.gameRenderer.setupOverlayRendering();
}

@Override
public boolean charTyped(char codePoint, int modifiers) {
Ellant.getInstance().getAltWidget().onChar(codePoint);
return super.charTyped(codePoint, modifiers);
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
Ellant.getInstance().getAltWidget().onKey(keyCode);
return false;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
Ellant.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
return super.mouseClicked(mouseX, mouseY, button);
}

private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
buttons.forEach(b -> b.render(stack, mX, mY, pt));
}

public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

@AllArgsConstructor
private class Button {
Getter
private final float x, y, width, height;
private String text;
private Runnable action;

public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
Stencil.initStencilToWrite();
DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
Stencil.readStencilBuffer(1);
KawaseBlur.blur.BLURRED.draw();
Stencil.uninitStencilBuffer();

DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
int color = ColorUtils.rgb(161, 164, 177);
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
color = ColorUtils.rgb(255, 255, 255);
}
Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
}

public void click(int mouseX, int mouseY, int button) {
if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
action.run();
}
}
}

private class Particle {
private final float x;
private float y;
private float size;

public Particle() {
x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
y = 0;
size = 0;
}

public void update() {
y += 1f;
}

public void render(MatrixStack stack) {
size += 0.1f;
GlStateManager.pushMatrix();
GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
GlStateManager.rotatef(size * 20, 0, 0, 1);
GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
y += 1;
Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, -1, MathHelper.clamp(size * multi, 0, 9));
GlStateManager.popMatrix();
if (y >= mc.getMainWindow().getScaledHeight()) {
particles.remove(this);
}
}
}
}
ГОЙДА!!!!!!!ZZZZZZZZOVZZZZZZZZZOVZOV
 
Начинающий
Статус
Оффлайн
Регистрация
16 Окт 2024
Сообщения
44
Реакции[?]
0
Поинты[?]
0
Сука эллант, предупреждай, что это 18+ и код в рамочку вставляй пж, а так ваще люблю тя
какой эллант блять, он на моей базе просто, а пока я солью билд 1.0.7, пусть попкорном закормят
 
Начинающий
Статус
Оффлайн
Регистрация
2 Май 2024
Сообщения
3
Реакции[?]
0
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
15 Июн 2024
Сообщения
455
Реакции[?]
3
Поинты[?]
1K
какой эллант блять, он на моей базе просто, а пока я солью билд 1.0.7, пусть попкорном закормят
ааа, тогда прости пж я правда не хотел, миру - мир <3

ты уже давно же слить 1.0.7 хочешь, так что действуй
 
Начинающий
Статус
Оффлайн
Регистрация
16 Окт 2024
Сообщения
44
Реакции[?]
0
Поинты[?]
0
Похожие темы
Сверху Снизу