Skip to content

Commit 958187d

Browse files
committed
Merge branch 'base' into mc/1.12
2 parents 8c8774d + 7f85519 commit 958187d

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

BlueMapCore/src/main/webroot/js/libs/hud/HudInfo.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import $ from 'jquery';
22
import {
33
Raycaster,
44
Vector2,
5+
Vector3,
56
BoxBufferGeometry,
67
Mesh,
78
MeshBasicMaterial
@@ -155,10 +156,21 @@ export default class HudInfo {
155156
let lrpath = this.blueMap.dataRoot + this.blueMap.map + '/lowres/';
156157
lrpath += pathFromCoords(lowresTile.x, lowresTile.y);
157158
lrpath += '.json';
159+
160+
//chunk
161+
let chunkCoords = new Vector3(block.x, block.y, block.z).divide({x:16,y:16,z:16}).floor();
162+
let chunk = `x:${chunkCoords.x}, y:${chunkCoords.y}, z:${chunkCoords.z}`;
163+
164+
//region
165+
let regionCoords = new Vector2(block.x, block.z).divide({x:512,y:512}).floor();
166+
let region = `r.${regionCoords.x}.${regionCoords.y}.mca`;
167+
158168
$(`
159169
<div class="files">
160170
<span class="value">${hrpath}</span><br>
161-
<span class="value">${lrpath}</span>
171+
<span class="value">${lrpath}</span><br>
172+
<span class="value">chunk: ${chunk}</span><br>
173+
<span class="value">region: ${region}</span>
162174
</div>
163175
`).appendTo(content);
164176
}

BlueMapCore/src/main/webroot/js/libs/hud/PlayerMarker.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export default class PlayerMarker extends Marker {
1515

1616
this.animationRunning = false;
1717
this.lastFrame = -1;
18+
19+
this.follow = false;
1820
}
1921

2022
setVisible(visible){
@@ -23,17 +25,18 @@ export default class PlayerMarker extends Marker {
2325
this.blueMap.updateFrame = true;
2426

2527
if (!this.renderObject){
26-
let iconElement = $(`<div class="marker-player"><img src="assets/playerheads/${this.player}.png" onerror="this.onerror=null;this.src='${STEVE}';"><div class="nameplate">${this.label}</div></div>`);
27-
iconElement.find("img").click(this.onClick);
28+
this.iconElement = $(`<div class="marker-player"><img src="assets/playerheads/${this.player}.png" onerror="this.onerror=null;this.src='${STEVE}';"><div class="nameplate">${this.label}</div></div>`);
29+
this.iconElement.find("img").click(this.onClick);
30+
$(window).on('mousedown touchstart', this.onStopFollowing);
2831

29-
this.renderObject = new CSS2DObject(iconElement[0]);
32+
this.renderObject = new CSS2DObject(this.iconElement[0]);
3033
this.renderObject.position.copy(this.position);
3134
this.renderObject.onBeforeRender = (renderer, scene, camera) => {
3235
let distanceSquared = this.position.distanceToSquared(camera.position);
3336
if (distanceSquared > 1000000) {
34-
iconElement.addClass("distant");
37+
this.iconElement.addClass("distant");
3538
} else {
36-
iconElement.removeClass("distant");
39+
this.iconElement.removeClass("distant");
3740
}
3841

3942
this.updateRenderObject(this.renderObject, scene, camera);
@@ -57,6 +60,11 @@ export default class PlayerMarker extends Marker {
5760
} else {
5861
this.renderObject.position.copy(this.position);
5962
}
63+
64+
if (this.follow){
65+
this.blueMap.controls.targetPosition.x = this.position.x;
66+
this.blueMap.controls.targetPosition.z = this.position.z;
67+
}
6068
}
6169
};
6270

@@ -86,7 +94,18 @@ export default class PlayerMarker extends Marker {
8694
};
8795

8896
onClick = () => {
97+
this.follow = true;
98+
this.iconElement.addClass("following");
8999

90-
}
100+
this.blueMap.controls.targetPosition.x = this.position.x;
101+
this.blueMap.controls.targetPosition.z = this.position.z;
102+
};
103+
104+
onStopFollowing = event => {
105+
if(this.follow) {
106+
this.follow = true;
107+
this.iconElement.removeClass("following");
108+
}
109+
};
91110

92111
}

BlueMapCore/src/main/webroot/style/modules/hudInfo.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
image-rendering: pixelated;
9797
image-rendering: crisp-edges;
9898

99+
border: solid 2px transparent;
100+
99101
transition: all 0.3s;
100102
}
101103

@@ -115,10 +117,18 @@
115117
img {
116118
width: 16px;
117119
height: 16px;
120+
121+
border-width: 1px;
118122
}
119123

120124
.nameplate {
121125
opacity: 0;
122126
}
123127
}
128+
129+
&.following {
130+
img {
131+
border-color: white;
132+
}
133+
}
124134
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
org.gradle.jvmargs=-Xmx3G
22
org.gradle.daemon=false
33

4-
coreVersion=0.9.0
4+
coreVersion=0.10.0
55

66
targetVersion=mc1.12

0 commit comments

Comments
 (0)