Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gradle/*
.idea/*
build/*
build/*
.DS_Store
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ enable-locator-maps: true
# Make the XYZ display position show the eye level position instead of
# the players feet level. This matches Legacy Console Edition but may cause confusion
use-eye-level-position: false
# show players on maps inside of item frames
# barelly works lol
# requires enable-locator-maps to also be true
players-on-item-frames: false
```

## Commands
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'dev.letsgoaway'
version = '1.1'
version = '1.2'

repositories {
mavenCentral()
Expand Down Expand Up @@ -48,8 +48,8 @@ tasks {
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filteringCharset = 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
}
7 changes: 7 additions & 0 deletions src/main/java/dev/letsgoaway/mapxyz/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class Config {
public static boolean enableLocatorMaps = true;

public static boolean useEyeLevelPosition = false;

public static boolean playersonitemframes = false;
//endregion

private static FileConfiguration config;
Expand Down Expand Up @@ -47,6 +49,10 @@ private static void updateValues() {
useEyeLevelPosition = config.getBoolean("use-eye-level-position");
}

if (config.contains("players-on-item-frames", true)) {
playersonitemframes = config.getBoolean("players-on-item-frames");
}

MapXYZ.onConfigLoad();
}

Expand All @@ -57,6 +63,7 @@ private static void saveValues() {
config.set("enable-reduced-debug-info", enableReducedDebugInfo);
config.set("enable-locator-maps", enableLocatorMaps);
config.set("use-eye-level-position", useEyeLevelPosition);
config.set("players-on-item-frames", playersonitemframes);
try {
config.save(MapXYZ.instance.getDataFolder().toPath().resolve("config.yml").toFile());
} catch (IOException e) {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/dev/letsgoaway/mapxyz/PlayerCursorRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import java.util.ArrayList;
import java.util.logging.Level;
import java.io.File;
import javax.imageio.ImageIO;

@SuppressWarnings("deprecation")
public class PlayerCursorRenderer {
Expand All @@ -24,8 +26,35 @@ public static void render(Player viewer, Player player, MapCanvas canvas, MapVie

byte d = calculateRotation(player);

if (x < -62 || x > 62 || z < -62 || z > 62)
{
return;
}


// Nether marker type matches Bedrock Edition locator maps
canvas.getCursors().addCursor(new MapCursor(clampMapCoordinate(x), clampMapCoordinate(z), d, map.getWorld().getEnvironment().equals(World.Environment.NETHER) ? NETHER_MARKER_TYPE : MARKER_TYPE, true, player.getName()));
if (Config.playersonitemframes)
{
try
{
canvas.drawImage(Math.round(x) + 62, Math.round(z) + 62, ImageIO.read(MapXYZ.instance.getResource("test.png")));
}
catch(Exception e)
{
System.out.println("error");
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if ((i == 0 || i == 2) && (j == 0 || j == 2))
{
canvas.setPixelColor(Math.round(x) + 62 + i, Math.round(z) + 62 + j, canvas.getBasePixelColor(Math.round(x) + 62 + i, Math.round(z) + 62 + j));
}
}
}
}
}

private static byte clampMapCoordinate(float coordinate) {
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/dev/letsgoaway/mapxyz/PosRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,23 @@ private static int getHeldMapID(ItemStack stack) {

@Override
public void render(@NotNull MapView map, @NotNull MapCanvas canvas, @NotNull Player player) {
int ymax = 10;
if (Config.playersonitemframes)
{
ymax = 127;
}
for (int x = 0; x < 127; x++) {
for (int y = 0; y < 10; y++) {
for (int y = 0; y < ymax; y++) {
canvas.setPixelColor(x, y, canvas.getBasePixelColor(x, y));
}
}

PlayerCursorRenderer.renderAll(player, canvas, map);

if (!Config.enableXYZDisplay) {
return;
}

PlayerCursorRenderer.renderAll(player, canvas, map);

/*
this is for item frames, unfortunately the position is still visible
if you are holding the same map of id in your hand but that's the best we can do atm
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ enable-reduced-debug-info: true
enable-locator-maps: true
# Make the XYZ display position show the eye level position instead of
# the players feet level. This matches Legacy Console Edition but may cause confusion
use-eye-level-position: false
use-eye-level-position: false
# show players on maps inside of item frames
# barelly works lol
# requires enable-locator-maps to also be true
players-on-item-frames: false
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: MapXYZ
version: '1.1'
version: '1.2'
main: dev.letsgoaway.mapxyz.MapXYZ
api-version: '1.21'
author: LetsGoAway
Expand Down
Binary file added src/main/resources/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.