Skip to content

Commit

Permalink
wawawawa
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Jan 24, 2024
1 parent ae4a7b1 commit 2d37889
Show file tree
Hide file tree
Showing 26 changed files with 127 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void setupObjects() {
}
bookObjects.add(bookObject);
}
faceObject(bookObjects.get(0));
faceObject(bookObjects.get(1));
}

public abstract void openScreen(boolean ignoreNextMouseClick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public static void renderWavyIcon(ResourceLocation location, PoseStack stack, in
}

public static void renderWavyIcon(ResourceLocation location, PoseStack stack, int x, int y, int z) {
renderWavyIcon(location, stack, x, y, 0, 16, 16);
}
public static void renderWavyIcon(ResourceLocation location, PoseStack stack, int x, int y, int z, int textureWidth, int textureHeight) {
ExtendedShaderInstance shaderInstance = (ExtendedShaderInstance) LodestoneShaderRegistry.DISTORTED_TEXTURE.getInstance().get();
shaderInstance.safeGetUniform("YFrequency").set(10f);
shaderInstance.safeGetUniform("XFrequency").set(12f);
Expand All @@ -108,12 +111,12 @@ public static void renderWavyIcon(ResourceLocation location, PoseStack stack, in
RenderSystem.enableBlend();
RenderSystem.disableDepthTest();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
renderTexture(location, stack, builder, x, y, 0, 0, 16, 16, 16, 16);
renderTexture(location, stack, builder, x, y, 0, 0, textureWidth, textureHeight);
builder.setAlpha(0.1f);
renderTexture(location, stack, builder, x - 1, y, 0, 0, 16, 16, 16, 16);
renderTexture(location, stack, builder, x + 1, y, 0, 0, 16, 16, 16, 16);
renderTexture(location, stack, builder, x, y - 1, 0, 0, 16, 16, 16, 16);
renderTexture(location, stack, builder, x, y + 1, 0, 0, 16, 16, 16, 16);
renderTexture(location, stack, builder, x - 1, y, 0, 0, textureWidth, textureHeight);
renderTexture(location, stack, builder, x + 1, y, 0, 0, textureWidth, textureHeight);
renderTexture(location, stack, builder, x, y - 1, 0, 0, textureWidth, textureHeight);
renderTexture(location, stack, builder, x, y + 1, 0, 0, textureWidth, textureHeight);
shaderInstance.setUniformDefaults();
RenderSystem.enableDepthTest();
RenderSystem.defaultBlendFunc();
Expand All @@ -128,6 +131,10 @@ public static void renderTexture(ResourceLocation texture, PoseStack poseStack,
renderTexture(texture, poseStack, VFX_BUILDER, x, y, u, v, width, height, textureWidth, textureHeight);
}

public static void renderTexture(ResourceLocation texture, PoseStack poseStack, VFXBuilders.ScreenVFXBuilder builder, int x, int y, float u, float v, int width, int height) {
renderTexture(texture, poseStack, builder, x, y, u, v, width, height, width, height);
}

public static void renderTexture(ResourceLocation texture, PoseStack poseStack, VFXBuilders.ScreenVFXBuilder builder, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) {
builder.setPositionWithWidth(x, y, width, height)
.setShaderTexture(texture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,21 @@ public static void openCodexViaItem() {
screen.playSweetenedSound(SoundRegistry.ARCANA_CODEX_OPEN, 1.25f);
}

public static void openCodexViaTransition() {
getScreenInstance().openScreen(false);
screen.faceObject(screen.bookObjects.get(0));
screen.playSound(SoundRegistry.ARCANA_TRANSITION_NORMAL, 1.25f, 1f);
}

public static void setupEntries() {
ENTRIES.clear();
Item EMPTY = ItemStack.EMPTY.getItem();

ENTRIES.add(new BookEntry(
"chronicles_of_the_void", 0, -1)
.setWidgetSupplier((s, e, x, y) -> new ScreenOpenerObject(s, e, x, y, VoidProgressionScreen::openCodexViaTransition, malumPath("textures/gui/book/icons/void_button.png"), 20, 20))
.setWidgetConfig(w -> w.setStyle(BookWidgetStyle.DARK_GRAND_RUNEWOOD))
);
ENTRIES.add(new BookEntry(
"introduction", 0, 0)
.setWidgetConfig(w -> w.setIcon(ENCYCLOPEDIA_ARCANA).setStyle(BookWidgetStyle.GILDED_RUNEWOOD))
Expand All @@ -137,7 +148,7 @@ public static void setupEntries() {

ENTRIES.add(new BookEntry(
"spirit_crystals", 0, 1)
.setWidgetSupplier((s, e, x, y) -> new IconObject(s, e, malumPath("textures/gui/book/icons/soul_shard.png"), x, y))
.setWidgetSupplier((s, e, x, y) -> new IconObject(s, e, x, y, malumPath("textures/gui/book/icons/soul_shard.png")))
.setWidgetConfig(w -> w.setStyle(BookWidgetStyle.DARK_SMALL_RUNEWOOD))
.addPage(new HeadlineTextPage("spirit_crystals", "spirit_crystals.1"))
.addPage(new TextPage("spirit_crystals.2"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,60 @@

import static com.sammy.malum.MalumMod.malumPath;

public record BookWidgetStyle(ResourceLocation frameTexture, ResourceLocation fillingTexture) {
public record BookWidgetStyle(ResourceLocation frameTexture, ResourceLocation fillingTexture, int textureWidth, int textureHeight) {


public BookWidgetStyle(ResourceLocation frameTexture, ResourceLocation fillingTexture, int dimensions) {
this(frameTexture, fillingTexture, dimensions, dimensions);
}
public BookWidgetStyle(ResourceLocation frameTexture, ResourceLocation fillingTexture) {
this(frameTexture, fillingTexture, 32, 32);
}
private static final ResourceLocation RUNEWOOD_FRAME = texturePath("runewood_frame");
private static final ResourceLocation GILDED_RUNEWOOD_FRAME = texturePath("runewood_frame_gilded");
private static final ResourceLocation SMALL_RUNEWOOD_FRAME = texturePath("runewood_frame_small");
private static final ResourceLocation TOTEMIC_RUNEWOOD_FRAME = texturePath("runewood_frame_totemic");
private static final ResourceLocation GRAND_RUNEWOOD_FRAME = texturePath("runewood_frame_grand");

private static final ResourceLocation SOULWOOD_FRAME = texturePath("soulwood_frame");
private static final ResourceLocation GILDED_SOULWOOD_FRAME = texturePath("soulwood_frame_gilded");
private static final ResourceLocation SMALL_SOULWOOD_FRAME = texturePath("soulwood_frame_small");
private static final ResourceLocation TOTEMIC_SOULWOOD_FRAME = texturePath("soulwood_frame_totemic");
private static final ResourceLocation GRAND_SOULWOOD_FRAME = texturePath("soulwood_frame_grand");

private static final ResourceLocation PAPER_FILLING = texturePath("paper_filling");
private static final ResourceLocation GILDED_PAPER_FILLING = texturePath("paper_filling_gilded");
private static final ResourceLocation SMALL_PAPER_FILLING = texturePath("paper_filling_small");
private static final ResourceLocation GRAND_PAPER_FILLING = texturePath("paper_filling_grand");

private static final ResourceLocation DARK_FILLING = texturePath("dark_filling");
private static final ResourceLocation GILDED_DARK_FILLING = texturePath("dark_filling_gilded");
private static final ResourceLocation SMALL_DARK_FILLING = texturePath("dark_filling_small");
private static final ResourceLocation GRAND_DARK_FILLING = texturePath("dark_filling_grand");

public static final BookWidgetStyle RUNEWOOD = new BookWidgetStyle(RUNEWOOD_FRAME, PAPER_FILLING);
public static final BookWidgetStyle TOTEMIC_RUNEWOOD = new BookWidgetStyle(TOTEMIC_RUNEWOOD_FRAME, PAPER_FILLING);
public static final BookWidgetStyle GILDED_RUNEWOOD = new BookWidgetStyle(GILDED_RUNEWOOD_FRAME, GILDED_PAPER_FILLING);
public static final BookWidgetStyle SMALL_RUNEWOOD = new BookWidgetStyle(SMALL_RUNEWOOD_FRAME, SMALL_PAPER_FILLING);
public static final BookWidgetStyle GRAND_RUNEWOOD = new BookWidgetStyle(GRAND_RUNEWOOD_FRAME, GRAND_PAPER_FILLING, 40);

public static final BookWidgetStyle DARK_RUNEWOOD = new BookWidgetStyle(RUNEWOOD_FRAME, DARK_FILLING);
public static final BookWidgetStyle DARK_TOTEMIC_RUNEWOOD = new BookWidgetStyle(TOTEMIC_RUNEWOOD_FRAME, DARK_FILLING);
public static final BookWidgetStyle DARK_GILDED_RUNEWOOD = new BookWidgetStyle(GILDED_RUNEWOOD_FRAME, GILDED_DARK_FILLING);
public static final BookWidgetStyle DARK_SMALL_RUNEWOOD = new BookWidgetStyle(SMALL_RUNEWOOD_FRAME, SMALL_DARK_FILLING);
public static final BookWidgetStyle DARK_GRAND_RUNEWOOD = new BookWidgetStyle(GRAND_RUNEWOOD_FRAME, GRAND_DARK_FILLING, 40);

public static final BookWidgetStyle SOULWOOD = new BookWidgetStyle(SOULWOOD_FRAME, PAPER_FILLING);
public static final BookWidgetStyle TOTEMIC_SOULWOOD = new BookWidgetStyle(TOTEMIC_SOULWOOD_FRAME, PAPER_FILLING);
public static final BookWidgetStyle GILDED_SOULWOOD = new BookWidgetStyle(GILDED_SOULWOOD_FRAME, GILDED_PAPER_FILLING);
public static final BookWidgetStyle SMALL_SOULWOOD = new BookWidgetStyle(SMALL_SOULWOOD_FRAME, SMALL_PAPER_FILLING);
public static final BookWidgetStyle GRAND_SOULWOOD = new BookWidgetStyle(GRAND_SOULWOOD_FRAME, GRAND_PAPER_FILLING, 40);

public static final BookWidgetStyle DARK_SOULWOOD = new BookWidgetStyle(SOULWOOD_FRAME, DARK_FILLING);
public static final BookWidgetStyle DARK_TOTEMIC_SOULWOOD = new BookWidgetStyle(TOTEMIC_SOULWOOD_FRAME, DARK_FILLING);
public static final BookWidgetStyle DARK_GILDED_SOULWOOD = new BookWidgetStyle(GILDED_SOULWOOD_FRAME, GILDED_DARK_FILLING);
public static final BookWidgetStyle DARK_SMALL_SOULWOOD = new BookWidgetStyle(SMALL_SOULWOOD_FRAME, SMALL_DARK_FILLING);
public static final BookWidgetStyle DARK_GRAND_SOULWOOD = new BookWidgetStyle(GRAND_SOULWOOD_FRAME, GRAND_DARK_FILLING, 40);

public static ResourceLocation texturePath(String name) {
return malumPath("textures/gui/book/widgets/" + name + ".png");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sammy.malum.client.screen.codex;

import com.mojang.blaze3d.vertex.PoseStack;
import com.sammy.malum.client.screen.codex.objects.*;
import com.sammy.malum.common.events.SetupMalumCodexEntriesEvent;
import com.sammy.malum.registry.common.SoundRegistry;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia
GL11.glDisable(GL_SCISSOR_TEST);

renderTransparentTexture(FRAME_FADE_TEXTURE, poseStack, guiLeft, guiTop, 0, 0, bookWidth, bookHeight);
renderTexture(FRAME_TEXTURE, poseStack, guiLeft, guiTop, 1, 1, bookWidth, bookHeight);
renderTexture(FRAME_TEXTURE, poseStack, guiLeft, guiTop, 0, 0, bookWidth, bookHeight);
lateEntryRender(guiGraphics, mouseX, mouseY, partialTicks);
}

Expand Down Expand Up @@ -105,93 +106,101 @@ public static VoidProgressionScreen getScreenInstance() {

public static void openCodexViaItem() {
getScreenInstance().openScreen(true);
setupEntries();
screen.playSweetenedSound(SoundRegistry.ARCANA_CODEX_OPEN, 1.25f);
screen.setupObjects();
}

public static void openCodexViaTransition() {
getScreenInstance().openScreen(false);
screen.faceObject(screen.bookObjects.get(0));
screen.playSound(SoundRegistry.ARCANA_TRANSITION_EVIL, 1.25f, 1f);
}

public static void setupEntries() {
VOID_ENTRIES.clear();
VOID_ENTRIES.add(new BookEntry(
"void.introduction", 0, -1)
"research_of_the_rejected", 0, -9)
.setWidgetSupplier((s, e, x, y) -> new ScreenOpenerObject(s, e, x, y, ArcanaProgressionScreen::openCodexViaTransition, malumPath("textures/gui/book/icons/arcana_button.png"), 20, 20))
.setWidgetConfig(w -> w.setStyle(BookWidgetStyle.DARK_GRAND_SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.introduction", 0, -8)
.setWidgetConfig(w -> w.setIcon(ENCYCLOPEDIA_ARCANA).setStyle(BookWidgetStyle.GILDED_SOULWOOD))
);

VOID_ENTRIES.add(new BookEntry(
"void.weeping_well", 0, 1)
"void.weeping_well", 0, -6)
.setWidgetConfig(w -> w.setIcon(BLIGHTED_EARTH).setStyle(BookWidgetStyle.SOULWOOD))
);

VOID_ENTRIES.add(new BookEntry(
"void.null_slate", -2, 2)
"void.null_slate", -2, -5)
.setWidgetConfig(w -> w.setIcon(NULL_SLATE).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.void_salts", -1, 3)
"void.void_salts", -1, -4)
.setWidgetConfig(w -> w.setIcon(VOID_SALTS).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.auric_embers", 1, 3)
"void.auric_embers", 1, -4)
.setWidgetConfig(w -> w.setIcon(AURIC_EMBERS).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.mnemotic_fragment", 2, 2)
"void.mnemotic_fragment", 2, -5)
.setWidgetConfig(w -> w.setIcon(MNEMONIC_FRAGMENT).setStyle(BookWidgetStyle.SOULWOOD))
);

VOID_ENTRIES.add(new BookEntry(
"void.ring_of_growing_flesh", -3, 4)
"void.ring_of_growing_flesh", -3, -3)
.setWidgetConfig(w -> w.setIcon(RING_OF_GROWING_FLESH).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.ring_of_gruesome_satiation", -4, 5)
"void.ring_of_gruesome_satiation", -4, -2)
.setWidgetConfig(w -> w.setIcon(RING_OF_GRUESOME_SATIATION).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.necklace_of_the_watcher", -2, 5)
"void.necklace_of_the_watcher", -2, -2)
.setWidgetConfig(w -> w.setIcon(NECKLACE_OF_THE_WATCHER).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.necklace_of_the_hidden_blade", -3, 6)
"void.necklace_of_the_hidden_blade", -3, -1)
.setWidgetConfig(w -> w.setIcon(NECKLACE_OF_THE_HIDDEN_BLADE).setStyle(BookWidgetStyle.SOULWOOD))
);

VOID_ENTRIES.add(new BookEntry(
"void.soul_stained_steel_staff", 3, 4)
"void.soul_stained_steel_staff", 3, -3)
.setWidgetConfig(w -> w.setIcon(SOUL_STAINED_STEEL_STAFF).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.something2", 4, 5)
"void.something2", 4, -2)
.setWidgetConfig(w -> w.setIcon(BARRIER).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.something3", 2, 5)
"void.something3", 2, -2)
.setWidgetConfig(w -> w.setIcon(BARRIER).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.something4", 3, 6)
"void.something4", 3, -1)
.setWidgetConfig(w -> w.setIcon(BARRIER).setStyle(BookWidgetStyle.SOULWOOD))
);


VOID_ENTRIES.add(new BookEntry(
"void.anomalous_design", 0, 6)
"void.anomalous_design", 0, -1)
.setWidgetConfig(w -> w.setIcon(ANOMALOUS_DESIGN).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.fused_consciousness", 0, 7)
"void.fused_consciousness", 0, 0)
.setWidgetConfig(w -> w.setIcon(FUSED_CONSCIOUSNESS).setStyle(BookWidgetStyle.GILDED_SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.belt_of_the_limitless", -2, 8)
"void.belt_of_the_limitless", -2, 1)
.setWidgetConfig(w -> w.setIcon(BELT_OF_THE_LIMITLESS).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.stellar_mechanism", 2, 8)
"void.stellar_mechanism", 2, 1)
.setWidgetConfig(w -> w.setIcon(STELLAR_MECHANISM).setStyle(BookWidgetStyle.SOULWOOD))
);
VOID_ENTRIES.add(new BookEntry(
"void.staff_of_the_auric_flame", 0, 9)
"void.staff_of_the_auric_flame", 0, 2)
.setWidgetConfig(w -> w.setIcon(STAFF_OF_THE_AURIC_FLAME).setStyle(BookWidgetStyle.SOULWOOD))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ public void click(float xOffset, float yOffset, double mouseX, double mouseY) {

@Override
public void render(Minecraft minecraft, GuiGraphics guiGraphics, float xOffset, float yOffset, int mouseX, int mouseY, float partialTicks) {
int posX = offsetPosX(xOffset);
int posY = offsetPosY(yOffset);
int posX = offsetPosX(xOffset) - (style.textureWidth()-32)/2;
int posY = offsetPosY(yOffset) - (style.textureHeight()-32)/2;
final PoseStack poseStack = guiGraphics.pose();
final int offset = getFrameOffset();
renderTransparentTexture(WIDGET_FADE_TEXTURE, poseStack, posX - 13, posY - 13, 0, 0, 58, 58);
renderTexture(style.frameTexture(), poseStack, posX - offset, posY - offset, 0, 0, width, height);
renderTexture(style.fillingTexture(), poseStack, posX - offset, posY - offset, 0, 0, width, height);
renderTexture(style.frameTexture(), poseStack, posX, posY, 0, 0, style.textureWidth(), style.textureHeight());
renderTexture(style.fillingTexture(), poseStack, posX, posY, 0, 0, style.textureWidth(), style.textureHeight());
if (iconStack != null) {
guiGraphics.renderItem(iconStack, posX + 8, posY + 8);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@

public class IconObject extends EntryObject {
public final ResourceLocation textureLocation;
public final int textureWidth;
public final int textureHeight;

public IconObject(AbstractProgressionCodexScreen screen, BookEntry entry, ResourceLocation textureLocation, int posX, int posY) {
public IconObject(AbstractProgressionCodexScreen screen, BookEntry entry, int posX, int posY, ResourceLocation textureLocation) {
this(screen, entry, posX, posY, textureLocation, 16, 16);
}
public IconObject(AbstractProgressionCodexScreen screen, BookEntry entry, int posX, int posY, ResourceLocation textureLocation, int textureWidth, int textureHeight) {
super(screen, entry, posX, posY);
this.textureLocation = textureLocation;
this.textureWidth = textureWidth;
this.textureHeight = textureHeight;
}

@Override
public void render(Minecraft minecraft, GuiGraphics guiGraphics, float xOffset, float yOffset, int mouseX, int mouseY, float partialTicks) {
super.render(minecraft, guiGraphics, xOffset, yOffset, mouseX, mouseY, partialTicks);
renderWavyIcon(textureLocation, guiGraphics.pose(), offsetPosX(xOffset) + 8, offsetPosY(yOffset) + 8);
renderWavyIcon(textureLocation, guiGraphics.pose(), offsetPosX(xOffset) + 8 - (style.textureWidth()-32)/4, offsetPosY(yOffset) + 8 - (style.textureHeight()-32)/4, 0, textureWidth, textureHeight);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.sammy.malum.client.screen.codex.objects;

import com.sammy.malum.client.screen.codex.*;
import net.minecraft.resources.*;

public class ScreenOpenerObject extends IconObject{
private final Runnable screenOpener;
public ScreenOpenerObject(AbstractProgressionCodexScreen screen, BookEntry entry, int posX, int posY, Runnable screenOpener, ResourceLocation textureLocation) {
super(screen, entry, posX, posY, textureLocation);
this.screenOpener = screenOpener;
}

public ScreenOpenerObject(AbstractProgressionCodexScreen screen, BookEntry entry, int posX, int posY, Runnable screenOpener, ResourceLocation textureLocation, int textureWidth, int textureHeight) {
super(screen, entry, posX, posY, textureLocation, textureWidth, textureHeight);
this.screenOpener = screenOpener;
}

@Override
public void click(float xOffset, float yOffset, double mouseX, double mouseY) {
screenOpener.run();
}
}
Loading

0 comments on commit 2d37889

Please sign in to comment.