Skip to content

Commit 4ba31e1

Browse files
committed
0.15.0.0+rc1 - Update to PMWeather 0.15
- Added ColorMap#getWithBiome - Added ColorMaps#IR - ID Overlay now shows all enabled overlays - Added StormType filtering to NearbyStorms - PixelRenderData now has a Vec3 worldPos parameter - RenderData now has a sizeRenderDiameter property - Added RadarMode#IR - Added new parameters smoothWidth, cycloneWindspeed, and smoothWindspeed to StormBuilder - Added StormType util enum Took 1 hour 55 minutes
1 parent 8d8c506 commit 4ba31e1

File tree

12 files changed

+520
-126
lines changed

12 files changed

+520
-126
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ 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.14.16.2
20+
mod_version=0.15.0.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.14.16
26+
pmweather_version=0.15.0

src/main/java/net/nullved/pmweatherapi/client/render/IDOverlay.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
import com.mojang.blaze3d.vertex.BufferBuilder;
44
import com.mojang.blaze3d.vertex.PoseStack;
55
import com.mojang.math.Axis;
6+
import net.minecraft.client.Minecraft;
67
import net.minecraft.network.chat.Component;
78
import net.neoforged.api.distmarker.Dist;
89
import net.neoforged.api.distmarker.OnlyIn;
910
import net.nullved.pmweatherapi.PMWeatherAPI;
1011
import net.nullved.pmweatherapi.config.PMWClientConfig;
1112
import net.nullved.pmweatherapi.radar.RadarMode;
1213

14+
import java.util.function.Supplier;
15+
1316
/**
1417
* The overlay for {@link RadarMode} IDs.
1518
* <br>
@@ -23,16 +26,36 @@ public class IDOverlay implements IRadarOverlay {
2326
@Override
2427
public void render(boolean canRender, RenderData renderData, BufferBuilder bufferBuilder, Object... args) {
2528
if (!PMWClientConfig.showRadarModeId) return;
29+
if (!Minecraft.getInstance().player.isCrouching()) return;
30+
2631
RadarMode mode = getRadarMode(renderData);
2732
PoseStack poseStack = renderData.poseStack();
2833
PMWClientConfig.RadarModeIDSide side = PMWClientConfig.radarModeIDSide;
2934

30-
poseStack.translate(side.x, 1.055f, side.z);
31-
poseStack.mulPose(Axis.ZP.rotationDegrees(side.rotation));
35+
float scale = renderData.sizeRenderDiameter() / 3.0F;
36+
37+
poseStack.pushPose();
38+
poseStack.translate((side.x * scale) - 0.5F * (scale - 1), 1.055f, (side.z * scale) - 0.5F * (scale - 1));
39+
poseStack.mulPose(Axis.YN.rotationDegrees(side.rotation));
3240
poseStack.scale(0.01f, 0.01f, 0.01f);
3341

3442
renderText(Component.literal(mode.getId().toString()), renderData, poseStack);
3543

44+
float lineHeight = 8.0f;
45+
float offset = lineHeight;
46+
for (Supplier<? extends IRadarOverlay> overlay: RadarOverlays.getOverlays()) {
47+
poseStack.pushPose();
48+
poseStack.translate(0, 0, offset);
49+
poseStack.scale(0.6f, 0.6f, 0.6f);
50+
51+
renderText(Component.literal(overlay.get().getID().toString()).withColor(0x888888), renderData, poseStack);
52+
53+
poseStack.popPose();
54+
offset += lineHeight * 0.6f;
55+
}
56+
57+
poseStack.popPose();
58+
3659
// While I could reset the pose, it is not strictly necessary
3760
// poseStack.scale(100f, 100f, 100f);
3861
// poseStack.mulPose(Axis.ZP.rotationDegrees(-side.rotation));

src/main/java/net/nullved/pmweatherapi/client/render/PixelRenderData.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.nullved.pmweatherapi.client.render;
22

3+
import net.minecraft.world.phys.Vec3;
4+
35
/**
46
* Specific rendering data for a pixel on the radar
57
* @param canRender {@code true} if either the server doesn't require WSR-88D or a WSR-88D is complete within 4 chunks of the radar
@@ -9,8 +11,9 @@
911
* @param x The x-position of the pixel (from {@code -resolution} to {@code resolution})
1012
* @param z The z-position of the pixel (from {@code -resolution} to {@code resolution})
1113
* @param resolution The resolution of the radar
14+
* @param worldPos The world position of the pixel
1215
* @param renderData The associated {@link RenderData}
1316
* @since 0.14.15.6
1417
*/
15-
public record PixelRenderData(boolean canRender, float rdbz, float velocity, float temp, int x, int z, int resolution, RenderData renderData) {
18+
public record PixelRenderData(boolean canRender, float rdbz, float velocity, float temp, int x, int z, int resolution, Vec3 worldPos, RenderData renderData) {
1619
}

src/main/java/net/nullved/pmweatherapi/client/render/RenderData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
/**
88
* A wrapper class to be passed to {@link RenderData}
99
* @param blockEntity The {@link BlockEntity} associated with the render call
10+
* @param sizeRenderDiameter The size in blocks of the radar
1011
* @param partialTicks The time, in partial ticks, since last full tick
1112
* @param poseStack The {@link PoseStack}
1213
* @param multiBufferSource The {@link MultiBufferSource}
1314
* @param combinedLightIn The current light value on the block entity
1415
* @param combinedOverlayIn The current overlay of the block entity
1516
* @since 0.14.15.2
1617
*/
17-
public record RenderData(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource multiBufferSource, int combinedLightIn, int combinedOverlayIn) {
18+
public record RenderData(BlockEntity blockEntity, float sizeRenderDiameter, float partialTicks, PoseStack poseStack, MultiBufferSource multiBufferSource, int combinedLightIn, int combinedOverlayIn) {
1819
}

src/main/java/net/nullved/pmweatherapi/config/PMWClientConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public enum RadarModeIDSide {
4141
NORTH(0, -1, -1),
4242
EAST(90, 2, -1),
4343
SOUTH(180, 2, 2),
44-
WEST(-90, -1, 2),;
44+
WEST(-90, -1, 2);
4545

46-
public int rotation, x, z;
46+
public final int rotation, x, z;
4747

4848
RadarModeIDSide(int rotation, int x, int z) {
4949
this.rotation = rotation;

0 commit comments

Comments
 (0)