-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
129 changed files
with
3,506 additions
and
2,578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## Changes | ||
- Backport to 1.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
81 changes: 81 additions & 0 deletions
81
common/src/main/java/dev/boxadactle/coordinatesdisplay/Bindings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
Oops, something went wrong.