Skip to content

Commit

Permalink
Merge branch 'latest' into 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Boxadactle committed Jul 22, 2024
2 parents 77a7aed + 3f3e08e commit a79d1a9
Show file tree
Hide file tree
Showing 129 changed files with 3,506 additions and 2,578 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Report any bugs that cause issues when playing
title: ''
labels: bug
assignees: ''

---

## Clear and Consise description of the issue

**What happened**?


**What did you expect to happen?**


**Steps to reproduce the issue:**


## Mod Information
**Minecraft version:**
**Mod version:**
**Other relevant mods:**

**Relevant logs (if applicable):**
Pastebin link or attachment

## Screenshots or videos: (Optional)
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/question-or-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Question or Support
about: Ask any questions about the mod
title: ''
labels: question
assignees: ''

---

## Clear and concise description of your problem

**What are you trying to achieve?**


**What is happening instead?**


## Relevant details about your setup
**Minecraft version:**
**Mod version:**
42 changes: 21 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build

- name: Upload fabric
uses: actions/upload-artifact@v3
with:
name: fabric-build
path: fabric/build/libs

- name: Upload forge
uses: actions/upload-artifact@v3
with:
name: forge-build
path: forge/build/libs
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew build
- name: Upload fabric
uses: actions/upload-artifact@v3
with:
name: fabric-build
path: fabric/build/libs
- name: Upload forge
uses: actions/upload-artifact@v3
with:
name: forge-build
path: forge/build/libs
11 changes: 7 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ name: Publish
on:
push:
branches: [ "latest" ]
pull_request:
branches: [ "latest" ]

permissions:
contents: read
Expand All @@ -22,10 +20,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Build with Gradle
Expand All @@ -48,3 +46,8 @@ jobs:
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

- name: Create GitHub release
run: ./gradlew githubRelease
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_TOKEN }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Changes
- Backport to 1.20
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Coordinates Display is a Client-side mod that adds an HUD to show your position,

# Dependencies

Both versions of this mod embed [BoxLib](https://github.com/Boxadactle/BoxLib/), a Client-side library mod developed by me.
#### Versions 10.0.0+ of this mod require [BoxLib](https://modrinth.com/mod/boxlib) a Client-side library mod developed by me.

## Fabric

Expand Down
96 changes: 71 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,47 +1,93 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
id 'dev.architectury.loom' version '1.7-SNAPSHOT' apply false
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id "me.shedaniel.unified-publishing" version "0.1.+"
id "com.github.breadmoirai.github-release" version "2.5.2"
}

architectury {
minecraft = rootProject.minecraft_version
minecraft = project.minecraft_version
}

subprojects {
apply plugin: "dev.architectury.loom"

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()
}
allprojects {
group = rootProject.maven_group
version = rootProject.mod_version
}

allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
subprojects {
apply plugin: 'dev.architectury.loom'
apply plugin: 'architectury-plugin'
apply plugin: 'maven-publish'

archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
base {
// Set up a suffixed format for the mod jar names, e.g. `example-fabric`.
archivesName = "$rootProject.archives_name-$project.name"
}

repositories {
maven { url = "https://maven.boxadactle.dev/" }
maven { url = "https://maven.terraformersmc.com/releases/" }
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.officialMojangMappings()
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

// Configure Maven publishing.
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = base.archivesName.get()
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}

githubRelease {
owner = "Boxadactle"
repo = "coordinates-display"
tagName = "$project.version"
targetCommitish = "latest"
releaseName = "Coordinates Display $project.version"
generateReleaseNotes = true
body = """"Coordinates Display $project.version for Minecraft $project.minecraft_version"
${new File(rootProject.rootDir, project.changelog_file).text}
"""
authorization = "Token ${System.getenv("GITHUB_TOKEN")}"

var files = []
for (String platform : project.enabled_platforms.split(',')) {
files += fileTree("$platform/build/libs") {
include "*$project.version*"
}
}
releaseAssets = files

// dryRun = true
}
27 changes: 7 additions & 20 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

modCompileOnlyApi("dev.boxadactle:Boxlib:${rootProject.boxlib_version}") { transitive = true }
}

architectury {
common("fabric", "forge")
common rootProject.enabled_platforms.split(',')
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
dependencies {
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
// which get remapped to the correct annotations on each platform.
// Do NOT use other classes from Fabric Loader.
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
modImplementation "dev.boxadactle:Boxlib-common:$rootProject.boxlib_version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package dev.boxadactle.coordinatesdisplay;

import com.mojang.blaze3d.platform.InputConstants;
import dev.boxadactle.boxlib.scheduling.Scheduling;
import dev.boxadactle.boxlib.util.ClientUtils;
import dev.boxadactle.boxlib.util.WorldUtils;
import dev.boxadactle.coordinatesdisplay.screen.CoordinatesScreen;
import dev.boxadactle.coordinatesdisplay.screen.config.PositionScreen;
import dev.boxadactle.coordinatesdisplay.position.Position;
import dev.boxadactle.coordinatesdisplay.registry.DisplayMode;
import net.minecraft.client.KeyMapping;
import org.lwjgl.glfw.GLFW;

public class Bindings {

public static final KeyMapping hudEnabled = new KeyMapping("key.coordinatesdisplay.hudenabled", GLFW.GLFW_KEY_H, "category.coordinatesdisplay");

public static final KeyMapping coordinatesGUIKeybind = new KeyMapping("key.coordinatesdisplay.coordinatesgui", GLFW.GLFW_KEY_C, "category.coordinatesdisplay");

public static final KeyMapping copyLocation = new KeyMapping("key.coordinatesdisplay.copypos", -1, "category.coordinatesdisplay");
public static final KeyMapping sendLocation = new KeyMapping("key.coordinatesdisplay.sendpos", -1, "category.coordinatesdisplay");
public static final KeyMapping copyPosTp = new KeyMapping("key.coordinatesdisplay.copypostp", -1, "category.coordinatesdisplay");

public static final KeyMapping changeHudPosition = new KeyMapping("key.coordinatesdisplay.changeHudPos", GLFW.GLFW_KEY_F9, "category.coordinatesdisplay");
public static final KeyMapping cycleDisplayMode = new KeyMapping("key.coordinatesdisplay.cycleDisplayMode", GLFW.GLFW_KEY_M, "category.coordinatesdisplay");

public static void toggleHud() {
CoordinatesDisplay.LOGGER.info("Toggling HUD visibility");
CoordinatesDisplay.CONFIG.get().enabled = !CoordinatesDisplay.CONFIG.get().enabled;
CoordinatesDisplay.CONFIG.save();
}

public static void coordinatesGui() {
Scheduling.nextTick(() -> ClientUtils.setScreen(new CoordinatesScreen(Position.of(WorldUtils.getPlayer()))));
}

public static void copyLocation(Position pos) {
ClientUtils.getKeyboard().setClipboard(ModUtil.parseText(CoordinatesDisplay.CONFIG.get().copyPosMessage, pos));
CoordinatesDisplay.LOGGER.player.info("Copied to clipboard!");
CoordinatesDisplay.LOGGER.info("Copied location to clipboard");
}

public static void sendLocation(Position pos) {
CoordinatesDisplay.LOGGER.player.publicChat(ModUtil.parseText(CoordinatesDisplay.CONFIG.get().posChatMessage, pos));
CoordinatesDisplay.LOGGER.info("Sent position as chat message");
}

public static void copyTeleportCommand(Position pos) {
ClientUtils.getKeyboard().setClipboard(CoordinatesDisplay.getConfig().teleportMode.toCommand(pos));

CoordinatesDisplay.LOGGER.player.info("Copied position as teleport command!");
}

public static void openHudPositionGui() {
Scheduling.nextTick(() -> ClientUtils.setScreen(new PositionScreen(null)));
}

public static void cycleDisplayMode() {
if (!InputConstants.isKeyDown(ClientUtils.getWindow(), 340)) CoordinatesDisplay.getConfig().renderMode = DisplayMode.nextMode(CoordinatesDisplay.getConfig().renderMode);
else CoordinatesDisplay.getConfig().renderMode = DisplayMode.previousMode(CoordinatesDisplay.getConfig().renderMode);

CoordinatesDisplay.CONFIG.save();
}

public static void checkBindings(Position pos) {
if (hudEnabled.consumeClick()) toggleHud();

if (coordinatesGUIKeybind.consumeClick()) coordinatesGui();

if (copyLocation.consumeClick()) copyLocation(pos);

if (sendLocation.consumeClick()) sendLocation(pos);

if (copyPosTp.consumeClick()) copyTeleportCommand(pos);

if (changeHudPosition.consumeClick()) openHudPositionGui();

if (cycleDisplayMode.consumeClick()) cycleDisplayMode();
}

}
Loading

0 comments on commit a79d1a9

Please sign in to comment.