Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
name: Build
on: [ push, pull_request ]
name: "build"

on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
pull_request:

jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: JDK
uses: actions/setup-java@v2.3.1
call-build:
uses: "jpenilla/actions/.github/workflows/shared-ci.yml@master"
secrets: "inherit"
with:
cache: 'gradle'
distribution: 'temurin'
java-version: '17'
- name: Build with Gradle
run: ./gradlew build
- run: mkdir staging && cp build/libs/*.jar staging
- uses: actions/upload-artifact@v2
with:
name: Package
path: staging
artifacts-path: 'build/libs/*.jar'
loom: true
29 changes: 19 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id("quiet-fabric-loom") version "1.0-SNAPSHOT"
id("quiet-fabric-loom") version "1.4-SNAPSHOT"
}

group = "xyz.jpenilla.squaremap.client"
version = "1.4.0-SNAPSHOT"

val mcVersion = "1.19"
val mcVersion = "1.20.2"

java {
toolchain {
Expand All @@ -14,23 +14,32 @@ java {
}

repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/") {
mavenContent { snapshotsOnly() }
}
mavenCentral()
maven("https://maven.terraformersmc.com/") {
mavenContent {
includeGroup("com.terraformersmc")
}
}
maven("https://maven.parchmentmc.org/") {
mavenContent {
includeGroup("org.parchmentmc.data")
}
}
}

dependencies {
minecraft("com.mojang:minecraft:$mcVersion")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:0.14.8")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.56.1+1.19")
modImplementation("com.terraformersmc:modmenu:4.0.0")
modImplementation(include("ca.stellardrift", "confabricate", "3.0.0-SNAPSHOT"))
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.20.2:2023.10.08@zip")
})
modImplementation("net.fabricmc:fabric-loader:0.15.0")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.91.0+1.20.2")
modImplementation("com.terraformersmc:modmenu:8.0.0")

val configurate = "org.spongepowered:configurate-hocon:4.1.2"
transitiveInclude(configurate)
modImplementation(configurate)
}

tasks {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 22 additions & 13 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://maven.fabricmc.net/")
maven("https://maven.quiltmc.org/repository/release/")
maven("https://repo.jpenilla.xyz/snapshots/")
gradlePluginPortal()
}
}

Expand Down
37 changes: 19 additions & 18 deletions src/main/java/xyz/jpenilla/squaremap/client/gui/MiniMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.concurrent.CompletableFuture;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.texture.DynamicTexture;
import org.lwjgl.opengl.GL11;
Expand Down Expand Up @@ -78,18 +78,20 @@ public MiniMap(SquaremapClientInitializer squaremap) {
}

public void initialize() {
HudRenderCallback.EVENT.register((matrixStack, delta) -> {
HudRenderCallback.EVENT.register((guiGraphics, delta) -> {
if (!this.enabled || !this.visible) {
return;
}
if (this.client.options.renderDebug) {
// todo
if (false) {
//if (this.client.options.debug) {
return;
}
// do not show minimap if no squaremap world set
if (this.squaremap.getWorld() == null) {
return;
}
this.render(matrixStack, delta);
this.render(guiGraphics, delta);
});
}

Expand Down Expand Up @@ -352,7 +354,8 @@ public void updateMapTexture() {
});
}

public void render(PoseStack matrixStack, float delta) {
public void render(GuiGraphics guiGraphics, float delta) {
PoseStack matrixStack = guiGraphics.pose();
TextureManager tex = this.squaremap.getTextureManager();

// get fresh reference to player since vanilla destroys this object on dimension change
Expand Down Expand Up @@ -392,15 +395,14 @@ public void render(PoseStack matrixStack, float delta) {
// on circle maps and prevents corners from extending beyond the frame on rotating square maps.
RenderSystem.blendFuncSeparate(GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_SRC_COLOR, GL11.GL_ZERO);
{
RenderSystem.setShaderTexture(0, this.circular ? TextureManager.MASK_CIRCLE : TextureManager.MASK_SQUARE);
GuiComponent.blit(matrixStack, this.left - this.halfSize, this.top - this.halfSize, 0, 0, 0, this.doubleSize, this.doubleSize, this.doubleSize, this.doubleSize);
guiGraphics.blit(this.circular ? TextureManager.MASK_CIRCLE : TextureManager.MASK_SQUARE, this.left - this.halfSize, this.top - this.halfSize, 0, 0, 0, this.doubleSize, this.doubleSize, this.doubleSize, this.doubleSize);
}

// draw sky background - uses special blend which only writes where high alpha values exist from above
RenderSystem.blendFunc(GL11.GL_DST_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA);
{
matrixStack.pushPose();
tex.drawTexture(matrixStack, tex.getTexture(this.player.level), x0 - halfScale, y0 + halfScale, x1 - halfScale, y1 + halfScale, u2, v2);
tex.drawTexture(matrixStack, tex.getTexture(this.player.level()), x0 - halfScale, y0 + halfScale, x1 - halfScale, y1 + halfScale, u2, v2);
matrixStack.popPose();
}

Expand Down Expand Up @@ -436,8 +438,7 @@ public void render(PoseStack matrixStack, float delta) {

// draw the frame
if (this.showFrame) {
RenderSystem.setShaderTexture(0, this.circular ? TextureManager.FRAME_CIRCLE : TextureManager.FRAME_SQUARE);
GuiComponent.blit(matrixStack, this.left, this.top, 0, 0, 0, this.size, this.size, this.size, this.size);
guiGraphics.blit(this.circular ? TextureManager.FRAME_CIRCLE : TextureManager.FRAME_SQUARE, this.left, this.top, 0, 0, 0, this.size, this.size, this.size, this.size);
}

// draw cardinal directions
Expand All @@ -456,19 +457,19 @@ public void render(PoseStack matrixStack, float delta) {
{
matrixStack.pushPose();
matrixStack.translate(distance * sin(angle2 - 180), distance * cos(angle2 - 180), 0);
text(matrixStack, "N", dirX, dirY);
text(guiGraphics, "N", dirX, dirY);
matrixStack.popPose();
matrixStack.pushPose();
matrixStack.translate(distance * sin(angle2 + 90), distance * cos(angle2 + 90), 0);
text(matrixStack, "E", dirX, dirY);
text(guiGraphics, "E", dirX, dirY);
matrixStack.popPose();
matrixStack.pushPose();
matrixStack.translate(distance * sin(angle2), distance * cos(angle2), 0);
text(matrixStack, "S", dirX, dirY);
text(guiGraphics, "S", dirX, dirY);
matrixStack.popPose();
matrixStack.pushPose();
matrixStack.translate(distance * sin(angle2 - 90), distance * cos(angle2 - 90), 0);
text(matrixStack, "W", dirX, dirY);
text(guiGraphics, "W", dirX, dirY);
matrixStack.popPose();
}
matrixStack.popPose();
Expand All @@ -478,7 +479,7 @@ public void render(PoseStack matrixStack, float delta) {
if (this.showCoordinates) {
matrixStack.pushPose();
matrixStack.scale(this.textScale, this.textScale, this.textScale);
text(matrixStack, String.format("%s, %s, %s", (int) Math.floor(this.player.getX()), (int) Math.floor(this.player.getY()), (int) Math.floor(this.player.getZ())), this.textX, this.textZ + 8);
text(guiGraphics, String.format("%s, %s, %s", (int) Math.floor(this.player.getX()), (int) Math.floor(this.player.getY()), (int) Math.floor(this.player.getZ())), this.textX, this.textZ + 8);
matrixStack.popPose();
}

Expand All @@ -488,10 +489,10 @@ public void render(PoseStack matrixStack, float delta) {
matrixStack.popPose();
}

private void text(PoseStack matrixStack, String text, int x, int y) {
private void text(GuiGraphics guiGraphics, String text, int x, int y) {
x -= (int) (this.client.font.width(text) / 2F);
this.client.font.draw(matrixStack, text, x + 1, y + 1, 0xFF3F3F3F);
this.client.font.draw(matrixStack, text, x, y, 0xFFFFFFFF);
guiGraphics.drawString(Minecraft.getInstance().font, text, x + 1, y + 1, 0xFF3F3F3F);
guiGraphics.drawString(Minecraft.getInstance().font, text, x, y, 0xFFFFFFFF);
}

private float cos(float degree) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package xyz.jpenilla.squaremap.client.gui.screen;

import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.vertex.PoseStack;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import xyz.jpenilla.squaremap.client.SquaremapClientInitializer;
Expand All @@ -23,17 +23,17 @@ protected AbstractScreen(SquaremapClientInitializer squaremap, Screen parent) {
}

@Override
public void render(PoseStack matrixStack, int mouseX, int mouseY, float delta) {
renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, delta);
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) {
renderBackground(guiGraphics, mouseX, mouseY, delta);
super.render(guiGraphics, mouseX, mouseY, delta);
}

@Override
public void renderBackground(PoseStack matrixStack, int vOffset) {
public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
if (this.minecraft != null && this.minecraft.level != null) {
this.fillGradient(matrixStack, 0, 0, this.width, this.height, 0xD00F4863, 0xC0370038);
guiGraphics.fillGradient(0, 0, this.width, this.height, 0xD00F4863, 0xC0370038);
} else {
this.renderDirtBackground(vOffset);
this.renderDirtBackground(guiGraphics);
}
}

Expand All @@ -57,13 +57,13 @@ public void onClose() {
}
}

protected void drawText(PoseStack matrixStack, String text, int x, int y) {
drawText(matrixStack, Component.nullToEmpty(text), x, y);
protected void drawText(GuiGraphics guiGraphics, String text, int x, int y) {
drawText(guiGraphics, Component.nullToEmpty(text), x, y);
}

protected void drawText(PoseStack matrixStack, Component text, int x, int y) {
protected void drawText(GuiGraphics guiGraphics, Component text, int x, int y) {
x = x - (int) (this.font.width(text) / 2F);
this.font.drawShadow(matrixStack, text, x, y, 0xFFFFFFFF);
guiGraphics.drawString(this.font, text, x, y, 0xFFFFFFFF, true);
}

public class KeyHandler extends Task {
Expand Down
Loading