fix shrine because I broke it
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package net.fretux.ascend.client.screen;
|
package net.fretux.ascend.client.screen;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import net.fretux.ascend.compat.AscendMMCompat;
|
||||||
import net.fretux.ascend.network.PacketHandler;
|
import net.fretux.ascend.network.PacketHandler;
|
||||||
import net.fretux.ascend.network.ServerboundShrineChoicePacket;
|
import net.fretux.ascend.network.ServerboundShrineChoicePacket;
|
||||||
import net.fretux.ascend.player.PlayerStatsProvider;
|
import net.fretux.ascend.player.PlayerStatsProvider;
|
||||||
@@ -11,12 +12,21 @@ import net.minecraft.client.gui.screens.Screen;
|
|||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
public class ShrineScreen extends Screen {
|
public class ShrineScreen extends Screen {
|
||||||
|
private static final int WIDTH = 360;
|
||||||
|
private static final int HEIGHT = 220;
|
||||||
|
private static final int PADDING = 12;
|
||||||
|
private static final int BACKGROUND = 0xFF121316;
|
||||||
|
private static final int PANEL = 0xFF1C1E22;
|
||||||
|
private static final int CARD = 0xFF25272D;
|
||||||
|
private static final int BORDER = 0xFF45484F;
|
||||||
|
private static final int PRIMARY_TEXT = 0xFFE4E4E4;
|
||||||
|
private static final int SECONDARY_TEXT = 0xFF999DA5;
|
||||||
|
private static final int ACCENT = 0xFFAAB6C2;
|
||||||
|
private static final int PROGRESS = 0xFFD1A744;
|
||||||
|
|
||||||
private static final int WIDTH = 260;
|
private float uiScale = 1.0F;
|
||||||
private static final int HEIGHT = 200;
|
private int uiLeft;
|
||||||
|
private int uiTop;
|
||||||
private int leftPos;
|
|
||||||
private int topPos;
|
|
||||||
|
|
||||||
private int dialogueStage = 0; // 0 = intro, 1 = offer, 2 = confirm
|
private int dialogueStage = 0; // 0 = intro, 1 = offer, 2 = confirm
|
||||||
private int playerKnowledge = 0;
|
private int playerKnowledge = 0;
|
||||||
@@ -28,7 +38,7 @@ public class ShrineScreen extends Screen {
|
|||||||
: Component.literal("Shrine of Remembrance"));
|
: Component.literal("Shrine of Remembrance"));
|
||||||
this.essenceMode = essenceMode;
|
this.essenceMode = essenceMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShrineScreen() {
|
public ShrineScreen() {
|
||||||
this(false);
|
this(false);
|
||||||
}
|
}
|
||||||
@@ -36,8 +46,10 @@ public class ShrineScreen extends Screen {
|
|||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
this.leftPos = (this.width - WIDTH) / 2;
|
uiScale = Math.min(1.0F, Math.min((width - 12.0F) / WIDTH, (height - 12.0F) / HEIGHT));
|
||||||
this.topPos = (this.height - HEIGHT) / 2;
|
uiScale = Math.max(0.25F, uiScale);
|
||||||
|
uiLeft = Math.round((width - WIDTH * uiScale) / 2.0F);
|
||||||
|
uiTop = Math.round((height - HEIGHT * uiScale) / 2.0F);
|
||||||
|
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
if (mc.player != null) {
|
if (mc.player != null) {
|
||||||
@@ -50,126 +62,139 @@ public class ShrineScreen extends Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtons() {
|
private void updateButtons() {
|
||||||
this.clearWidgets();
|
clearWidgets();
|
||||||
int buttonY = topPos + 85;
|
|
||||||
|
|
||||||
// ESSENCE MODE — skip all dialogue, go straight to options
|
|
||||||
if (essenceMode) {
|
if (essenceMode) {
|
||||||
addRenderableWidget(Button.builder(Component.literal("FORGET"), (btn) -> {
|
addChoiceButton("FORGET", 84, () -> choose("forget"));
|
||||||
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket("forget"));
|
addChoiceButton("UNDERSTAND", 109, () -> choose("understand"));
|
||||||
Minecraft.getInstance().setScreen(null);
|
addChoiceButton("REST", 134, () -> choose("rest"));
|
||||||
}).bounds(leftPos + 20, buttonY, WIDTH - 40, 20).build());
|
addChoiceButton("LEAVE", 159, this::closeScreen);
|
||||||
|
|
||||||
int y = buttonY + 25;
|
|
||||||
|
|
||||||
addRenderableWidget(Button.builder(Component.literal("UNDERSTAND"), (btn) -> {
|
|
||||||
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket("understand"));
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, y, WIDTH - 40, 20).build());
|
|
||||||
y += 25;
|
|
||||||
|
|
||||||
addRenderableWidget(Button.builder(Component.literal("REST"), (btn) -> {
|
|
||||||
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket("rest"));
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, y, WIDTH - 40, 20).build());
|
|
||||||
y += 25;
|
|
||||||
|
|
||||||
addRenderableWidget(Button.builder(Component.literal("LEAVE"), (btn) -> {
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, y, WIDTH - 40, 20).build());
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dialogueStage) {
|
switch (dialogueStage) {
|
||||||
case 0 -> { // Intro
|
case 0 -> {
|
||||||
Button engageButton = Button.builder(Component.literal("I WISH TO ENGAGE IN A DEAL."), (btn) -> {
|
addChoiceButton("I WISH TO ENGAGE IN A DEAL.", 104, () -> {
|
||||||
dialogueStage = 1;
|
dialogueStage = 1;
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}).bounds(leftPos + 20, buttonY, WIDTH - 40, 20).build();
|
});
|
||||||
|
addChoiceButton("LEAVE.", 129, this::closeScreen);
|
||||||
Button leaveButton = Button.builder(Component.literal("LEAVE."), (btn) -> {
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, buttonY + 25, WIDTH - 40, 20).build();
|
|
||||||
|
|
||||||
addRenderableWidget(engageButton);
|
|
||||||
addRenderableWidget(leaveButton);
|
|
||||||
}
|
}
|
||||||
|
case 1 -> {
|
||||||
case 1 -> { // Shrine explains terms
|
addChoiceButton("I AGREE.", 104, () -> {
|
||||||
Button agreeButton = Button.builder(Component.literal("I AGREE."), (btn) -> {
|
|
||||||
dialogueStage = 2;
|
dialogueStage = 2;
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}).bounds(leftPos + 20, buttonY, WIDTH - 40, 20).build();
|
});
|
||||||
|
addChoiceButton("LEAVE.", 129, this::closeScreen);
|
||||||
Button leaveButton = Button.builder(Component.literal("LEAVE."), (btn) -> {
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, buttonY + 25, WIDTH - 40, 20).build();
|
|
||||||
|
|
||||||
addRenderableWidget(agreeButton);
|
|
||||||
addRenderableWidget(leaveButton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2 -> {
|
case 2 -> {
|
||||||
// Existing Ascend option
|
int y = 96;
|
||||||
Button forgetButton = Button.builder(Component.literal("I WISH TO FORGET."), (btn) -> {
|
addChoiceButton("I WISH TO FORGET.", y, () -> choose("forget"));
|
||||||
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket("forget"));
|
y += 25;
|
||||||
Minecraft.getInstance().setScreen(null);
|
if (AscendMMCompat.isMindMotionPresent()) {
|
||||||
}).bounds(leftPos + 20, buttonY, WIDTH - 40, 20).build();
|
addChoiceButton("I WISH TO UNDERSTAND.", y, () -> choose("understand"));
|
||||||
addRenderableWidget(forgetButton);
|
|
||||||
int y = buttonY + 25;
|
|
||||||
if (net.fretux.ascend.compat.AscendMMCompat.isMindMotionPresent()) {
|
|
||||||
Button understandButton = Button.builder(Component.literal("I WISH TO UNDERSTAND."), (btn) -> {
|
|
||||||
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket("understand"));
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, y, WIDTH - 40, 20).build();
|
|
||||||
addRenderableWidget(understandButton);
|
|
||||||
y += 25;
|
y += 25;
|
||||||
Button restButton = Button.builder(Component.literal("I WISH TO REST."), (btn) -> {
|
addChoiceButton("I WISH TO REST.", y, () -> choose("rest"));
|
||||||
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket("rest"));
|
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, y, WIDTH - 40, 20).build();
|
|
||||||
addRenderableWidget(restButton);
|
|
||||||
y += 25;
|
y += 25;
|
||||||
}
|
}
|
||||||
Button leaveButton = Button.builder(Component.literal("LEAVE."), (btn) -> {
|
addChoiceButton("LEAVE.", y, this::closeScreen);
|
||||||
Minecraft.getInstance().setScreen(null);
|
|
||||||
}).bounds(leftPos + 20, y, WIDTH - 40, 20).build();
|
|
||||||
addRenderableWidget(leaveButton);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addChoiceButton(String label, int y, Runnable action) {
|
||||||
|
addRenderableWidget(Button.builder(Component.literal(label), button -> action.run())
|
||||||
|
.bounds(20, y, WIDTH - 40, 20)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void choose(String choice) {
|
||||||
|
PacketHandler.INSTANCE.sendToServer(new ServerboundShrineChoicePacket(choice));
|
||||||
|
closeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeScreen() {
|
||||||
|
Minecraft.getInstance().setScreen(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphics gui, int mouseX, int mouseY, float partialTicks) {
|
public void render(GuiGraphics gui, int mouseX, int mouseY, float partialTicks) {
|
||||||
this.renderBackground(gui);
|
renderBackground(gui);
|
||||||
|
|
||||||
|
int uiMouseX = (int) toUiX(mouseX);
|
||||||
|
int uiMouseY = (int) toUiY(mouseY);
|
||||||
|
|
||||||
|
gui.pose().pushPose();
|
||||||
|
gui.pose().translate(uiLeft, uiTop, 0.0F);
|
||||||
|
gui.pose().scale(uiScale, uiScale, 1.0F);
|
||||||
|
|
||||||
|
drawWindow(gui);
|
||||||
|
gui.drawCenteredString(font, title, WIDTH / 2, 6, PRIMARY_TEXT);
|
||||||
|
gui.drawCenteredString(font, Component.translatable("ascend.stats.knowledge", playerKnowledge),
|
||||||
|
WIDTH / 2, 36, PROGRESS);
|
||||||
|
drawDialogue(gui);
|
||||||
|
|
||||||
|
super.render(gui, uiMouseX, uiMouseY, partialTicks);
|
||||||
|
gui.pose().popPose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawWindow(GuiGraphics gui) {
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
gui.fill(leftPos - 8, topPos - 8, leftPos + WIDTH + 8, topPos + HEIGHT + 8, 0xDD0D0B14);
|
gui.fill(-6, -6, WIDTH + 6, HEIGHT + 6, 0xCC090A0C);
|
||||||
gui.fill(leftPos - 4, topPos - 4, leftPos + WIDTH + 4, topPos + HEIGHT + 4, 0xE01A1424);
|
gui.fill(-3, -3, WIDTH + 3, HEIGHT + 3, BORDER);
|
||||||
gui.fill(leftPos - 4, topPos - 4, leftPos + WIDTH + 4, topPos + 20, 0xFF2A1F3A);
|
gui.fill(0, 0, WIDTH, HEIGHT, BACKGROUND);
|
||||||
gui.fill(leftPos - 4, topPos + 20, leftPos + WIDTH + 4, topPos + 21, 0x66FFFFFF);
|
gui.fill(0, 0, WIDTH, 24, PANEL);
|
||||||
|
gui.fill(0, 24, WIDTH, 25, BORDER);
|
||||||
|
gui.fill(PADDING, 30, WIDTH - PADDING, 54, CARD);
|
||||||
|
gui.fill(PADDING, 54, WIDTH - PADDING, 55, BORDER);
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
|
}
|
||||||
|
|
||||||
int titleColor = 0xCDA1FF;
|
private void drawDialogue(GuiGraphics gui) {
|
||||||
gui.drawCenteredString(this.font, "Shrine of Remembrance", this.width / 2, topPos + 6, 0xFFFFFF);
|
if (essenceMode) {
|
||||||
|
drawCentered(gui, "CHOOSE WHAT TO CHANGE.", 68, ACCENT);
|
||||||
gui.drawCenteredString(this.font, "Knowledge: " + playerKnowledge, this.width / 2, topPos + 28, 0x8FEBD2);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (dialogueStage) {
|
switch (dialogueStage) {
|
||||||
case 0 -> {
|
case 0 -> {
|
||||||
gui.drawCenteredString(this.font, "SPEAK, LITTLE ONE.", this.width / 2, topPos + 46, titleColor);
|
drawCentered(gui, "SPEAK, LITTLE ONE.", 66, ACCENT);
|
||||||
gui.drawCenteredString(this.font, "WHAT IS IT YOU SEEK TO UNMAKE?", this.width / 2, topPos + 62, titleColor);
|
drawCentered(gui, "WHAT IS IT YOU SEEK TO UNMAKE?", 82, SECONDARY_TEXT);
|
||||||
}
|
}
|
||||||
case 1 -> {
|
case 1 -> {
|
||||||
gui.drawCenteredString(this.font, "THE TERMS ARE AS FOLLOWS:", this.width / 2, topPos + 46, titleColor);
|
drawCentered(gui, "THE TERMS ARE AS FOLLOWS:", 64, ACCENT);
|
||||||
gui.drawCenteredString(this.font, "I WILL CONSUME YOUR KNOWLEDGE.", this.width / 2, topPos + 62, titleColor);
|
drawCentered(gui, "I WILL CONSUME YOUR KNOWLEDGE.", 78, SECONDARY_TEXT);
|
||||||
gui.drawCenteredString(this.font, "YOU WILL REAP A BENEFIT.", this.width / 2, topPos + 78, titleColor);
|
drawCentered(gui, "YOU WILL REAP A BENEFIT.", 92, SECONDARY_TEXT);
|
||||||
}
|
|
||||||
case 2 -> {
|
|
||||||
gui.drawCenteredString(this.font, "SPEAK YOUR DESIRE, FOOLISH ONE.", this.width / 2, topPos + 52, titleColor);
|
|
||||||
}
|
}
|
||||||
|
case 2 -> drawCentered(gui, "SPEAK YOUR DESIRE, FOOLISH ONE.", 68, ACCENT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.render(gui, mouseX, mouseY, partialTicks);
|
private void drawCentered(GuiGraphics gui, String text, int y, int color) {
|
||||||
|
gui.drawCenteredString(font, text, WIDTH / 2, y, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double toUiX(double mouseX) {
|
||||||
|
return (mouseX - uiLeft) / uiScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double toUiY(double mouseY) {
|
||||||
|
return (mouseY - uiTop) / uiScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
|
return super.mouseClicked(toUiX(mouseX), toUiY(mouseY), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||||
|
return super.mouseReleased(toUiX(mouseX), toUiY(mouseY), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) {
|
||||||
|
return super.mouseDragged(toUiX(mouseX), toUiY(mouseY), button, dragX / uiScale, dragY / uiScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "ascend:block/shrine_of_remembrance"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"advancements.ascend.level_5.description": "Reach Ascend level 5",
|
"advancements.ascend.level_5.description": "Reach Ascend level 5",
|
||||||
"advancements.ascend.level_10.title": "Beyond Mortal Limits",
|
"advancements.ascend.level_10.title": "Beyond Mortal Limits",
|
||||||
"advancements.ascend.level_10.description": "Reach Ascend level 10",
|
"advancements.ascend.level_10.description": "Reach Ascend level 10",
|
||||||
"advancements.ascend.max_level.title": "This is Ascend",
|
"advancements.ascend.max_level.title": "Ascendant",
|
||||||
"advancements.ascend.max_level.description": "Reach the maximum Ascend level",
|
"advancements.ascend.max_level.description": "Reach the maximum Ascend level",
|
||||||
"advancements.ascend.max_attribute.title": "Fear Not the One-Trick",
|
"advancements.ascend.max_attribute.title": "Fear Not the One-Trick",
|
||||||
"advancements.ascend.max_attribute.description": "Max out any Ascend attribute",
|
"advancements.ascend.max_attribute.description": "Max out any Ascend attribute",
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
"advancements.ascend.perfectly_balanced.title": "Perfectly Balanced",
|
"advancements.ascend.perfectly_balanced.title": "Perfectly Balanced",
|
||||||
"advancements.ascend.perfectly_balanced.description": "Invest exactly the same number of points in all eight attributes",
|
"advancements.ascend.perfectly_balanced.description": "Invest exactly the same number of points in all eight attributes",
|
||||||
"advancements.ascend.indecisive_chosen_one.title": "Indecisive Chosen One",
|
"advancements.ascend.indecisive_chosen_one.title": "Indecisive Chosen One",
|
||||||
"advancements.ascend.indecisive_chosen_one.description": "Respec ten times on the same character",
|
"advancements.ascend.indecisive_chosen_one.description": "Respec ten times in the same world",
|
||||||
"advancements.ascend.config_enjoyer.title": "Config Enjoyer",
|
"advancements.ascend.config_enjoyer.title": "Config Enjoyer",
|
||||||
"advancements.ascend.config_enjoyer.description": "Make the intended progression unrecognizable",
|
"advancements.ascend.config_enjoyer.description": "Make the intended progression unrecognizable",
|
||||||
"advancements.ascend.game_journalist_mode.title": "Game Journalist Mode",
|
"advancements.ascend.game_journalist_mode.title": "Game Journalist Mode",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "ascend:block/shrine_of_remembrance"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user