Skip to content

Commit 00a5fc3

Browse files
committed
v0.16.4.0-rc1 - PMWeather 0.16.4 Update
- Update to PMWeather 0.16.4 - PMWeatherAPI is now able to run in the next PMWeather version in order to allow its use while an official update is pushed - Fixed IRadarOverlay#placeOnRadar Took 22 minutes
1 parent 4da32a5 commit 00a5fc3

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ parchment_mappings_version=2024.11.17
1717
mod_id=pmweatherapi
1818
mod_name=PMWeatherAPI
1919
mod_license=GNU GPL 3.0
20-
mod_version=0.16.3.0-rc1
20+
mod_version=0.16.4.0-rc1
2121
mod_group_id=net.nullved
2222
mod_authors=nullved
2323
mod_description=An API for interfacing with ProtoManly's Weather Mod
2424

2525
# Dependencies
26-
pmweather_version=0.16.3
27-
pmweather_version_range=[0.16.3,0.16.4)
26+
pmweather_version=0.16.4
27+
pmweather_version_range=[0.16.4,0.16.6)
2828

2929
compat.pmshaders=false
3030
pmshaders_version=1.0.2

src/main/java/net/nullved/pmweatherapi/PMWeatherAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public PMWeatherAPI(IEventBus modEventBus, ModContainer modContainer) {
4545
modEventBus.addListener(this::clientSetup);
4646
modEventBus.addListener(this::registerPayloads);
4747

48-
AddonHelper.registerAddon(new AddonInfo(modContainer, List.of("0.16.3")));
48+
AddonHelper.registerAddon(new AddonInfo(modContainer, List.of("0.16.4", "0.16.5")));
4949

5050
LOGGER.info("Initialized PMWAPI");
5151

src/main/java/net/nullved/pmweatherapi/client/render/radar/IRadarOverlay.java

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -261,36 +261,6 @@ default void scale(PoseStack pose, float scaleFactor) {
261261
pose.scale(scaleFactor, scaleFactor, scaleFactor);
262262
}
263263

264-
/**
265-
* Transforms and scales a pose so that 1 block in world space == 1 pixel in radar space.
266-
*
267-
* @param poseStack The {@link PoseStack} to transform
268-
* @param rrd The {@link RadarRenderData}
269-
* @since 0.16.1.0-rc2
270-
*/
271-
default void poseToRadarSpace(PoseStack poseStack, RadarRenderData rrd) {
272-
float wtrRatio = (rrd.sizeRenderDiameter() / 2.0F) / rrd.simSize();
273-
274-
poseStack.translate(0, 0.055f, 0);
275-
poseStack.scale(wtrRatio, 1, wtrRatio);
276-
poseStack.translate(-rrd.radarX() - 0.5f, 0f, -rrd.radarZ() - 0.5f);
277-
}
278-
279-
/**
280-
* Goes to the given {@link Vec3} relative to the radar's position.
281-
* Uses {@link #poseToRadarSpace(PoseStack, RadarRenderData)} and {@link #poseToWorldSpace(PoseStack, RadarRenderData)}
282-
*
283-
* @param location The {@link Vec3} of the absolute location
284-
* @param poseStack The {@link PoseStack}
285-
* @param rrd The {@link RadarRenderData}
286-
* @since 0.16.1.0-rc2
287-
*/
288-
default void placeOnRadar(Vec3 location, PoseStack poseStack, RadarRenderData rrd) {
289-
poseToRadarSpace(poseStack, rrd);
290-
poseStack.translate(location.x, 0, location.z);
291-
poseToWorldSpace(poseStack, rrd);
292-
}
293-
294264
/**
295265
* Orients a {@link PoseStack} to face upwards.
296266
* May not work if other rotations are present!
@@ -324,6 +294,42 @@ default void flipPose(PoseStack poseStack, Axis axis) {
324294
poseStack.mulPose(axis.rotationDegrees(180));
325295
}
326296

297+
/**
298+
* Goes to the given {@link Vec3} relative to the radar's position.
299+
* Uses {@link #poseToRadarSpace(PoseStack, RadarRenderData)} and {@link #poseToWorldSpace(PoseStack, RadarRenderData)}
300+
*
301+
* @param location The {@link Vec3} of the absolute location
302+
* @param poseStack The {@link PoseStack}
303+
* @param rrd The {@link RadarRenderData}
304+
* @since 0.16.1.0-rc2
305+
*/
306+
default void placeOnRadar(Vec3 location, PoseStack poseStack, RadarRenderData rrd) {
307+
double dx = location.x - (rrd.radarX() + 0.5D);
308+
double dz = location.z - (rrd.radarZ() + 0.5D);
309+
310+
float ratio = (rrd.sizeRenderDiameter() / 2.0F) / rrd.simSize();
311+
poseStack.translate(dx * ratio, 0.01f, dz * ratio);
312+
//
313+
// poseToRadarSpace(poseStack, rrd);
314+
// poseStack.translate(location.x, 0, location.z);
315+
// poseToWorldSpace(poseStack, rrd);
316+
}
317+
318+
/**
319+
* Transforms and scales a pose so that 1 block in world space == 1 pixel in radar space.
320+
*
321+
* @param poseStack The {@link PoseStack} to transform
322+
* @param rrd The {@link RadarRenderData}
323+
* @since 0.16.1.0-rc2
324+
*/
325+
default void poseToRadarSpace(PoseStack poseStack, RadarRenderData rrd) {
326+
float wtrRatio = (rrd.sizeRenderDiameter() / 2.0F) / rrd.simSize();
327+
328+
poseStack.translate(0, 0.055f, 0);
329+
poseStack.scale(wtrRatio, 1, wtrRatio);
330+
poseStack.translate(-rrd.radarX() - 0.5f, 0f, -rrd.radarZ() - 0.5f);
331+
}
332+
327333
/**
328334
* Translates a {@link Vec3} of absolute coordinates to a {@link Vec3} of radar coordinates
329335
*
@@ -336,7 +342,6 @@ default Vec3 worldToRadarCoords(Vec3 pos, RadarRenderData rrd) {
336342
return worldToRadarCoords(pos, rrd.blockEntity().getBlockPos(), rrd.sizeRenderDiameter(), rrd.simSize());
337343
}
338344

339-
340345
/**
341346
* Translates a {@link Vec3} of absolute coordinates to a {@link Vec3} of radar coordinates
342347
*
@@ -351,7 +356,6 @@ default Vec3 worldToRadarCoords(Vec3 pos, BlockPos radarPos, float sizeRenderDia
351356
return worldToRadarCoords(pos.x, pos.z, radarPos, sizeRenderDiameter, simSize);
352357
}
353358

354-
355359
/**
356360
* Translates absolute coordinates to a {@link Vec3} of radar coordinates
357361
*
@@ -365,7 +369,6 @@ default Vec3 worldToRadarCoords(double x, double z, RadarRenderData rrd) {
365369
return worldToRadarCoords(x, z, rrd.blockEntity().getBlockPos(), rrd.sizeRenderDiameter(), rrd.simSize());
366370
}
367371

368-
369372
/**
370373
* Translates a {@link Vec3} of absolute coordinates to a {@link Vec3} of radar coordinates
371374
*
@@ -403,7 +406,6 @@ default void poseToWorldSpace(PoseStack poseStack, RadarRenderData rrd) {
403406
poseStack.translate(0, -0.05f, 0);
404407
}
405408

406-
407409
/**
408410
* Translates a {@link Vec3} of radar coordinates to a {@link Vec3} of absolute coordinates
409411
*
@@ -413,10 +415,9 @@ default void poseToWorldSpace(PoseStack poseStack, RadarRenderData rrd) {
413415
* @since 0.16.1.0-rc2
414416
*/
415417
default Vec3 radarToWorldCoords(Vec3 pos, RadarRenderData rrd) {
416-
return worldToRadarCoords(pos, rrd.blockEntity().getBlockPos(), rrd.sizeRenderDiameter(), rrd.simSize());
418+
return radarToWorldCoords(pos, rrd.blockEntity().getBlockPos(), rrd.sizeRenderDiameter(), rrd.simSize());
417419
}
418420

419-
420421
/**
421422
* Translates a {@link Vec3} of radar coordinates to a {@link Vec3} of absolute coordinates
422423
*
@@ -427,10 +428,9 @@ default Vec3 radarToWorldCoords(Vec3 pos, RadarRenderData rrd) {
427428
* @since 0.16.1.0-rc2
428429
*/
429430
default Vec3 radarToWorldCoords(Vec3 pos, BlockPos radarPos, float sizeRenderDiameter, float simSize) {
430-
return worldToRadarCoords(pos.x, pos.z, radarPos, sizeRenderDiameter, simSize);
431+
return radarToWorldCoords(pos.x, pos.z, radarPos, sizeRenderDiameter, simSize);
431432
}
432433

433-
434434
/**
435435
* Translates a {@link Vec3} of radar coordinates to a {@link Vec3} of absolute coordinates
436436
*
@@ -441,7 +441,7 @@ default Vec3 radarToWorldCoords(Vec3 pos, BlockPos radarPos, float sizeRenderDia
441441
* @since 0.16.1.0-rc2
442442
*/
443443
default Vec3 radarToWorldCoords(double x, double z, RadarRenderData rrd) {
444-
return worldToRadarCoords(x, z, rrd.blockEntity().getBlockPos(), rrd.sizeRenderDiameter(), rrd.simSize());
444+
return radarToWorldCoords(x, z, rrd.blockEntity().getBlockPos(), rrd.sizeRenderDiameter(), rrd.simSize());
445445
}
446446

447447
/**
@@ -457,8 +457,8 @@ default Vec3 radarToWorldCoords(double x, double z, RadarRenderData rrd) {
457457
default Vec3 radarToWorldCoords(double x, double z, BlockPos radarPos, float sizeRenderDiameter, float simSize) {
458458
double rtwRatio = simSize / (sizeRenderDiameter / 2.0);
459459

460-
double centerX = radarPos.getX() + 0.5D;
461-
double centerZ = radarPos.getZ() + 0.5D;
460+
double centerX = radarPos.getX();
461+
double centerZ = radarPos.getZ();
462462

463463
double worldX = centerX + (x * rtwRatio);
464464
double worldZ = centerZ + (z * rtwRatio);

0 commit comments

Comments
 (0)