Skip to content
Merged
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 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ var generateModMetadata = tasks.register("generateModMetadata", ProcessResources
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description,
pmweather_version : pmweather_version]
pmweather_version : pmweather_version,
pmweather_version_range: pmweather_version_range]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ parchment_mappings_version=2024.11.17
mod_id=pmweatherapi
mod_name=PMWeatherAPI
mod_license=GNU GPL 3.0
mod_version=0.14.16.2
mod_version=0.15.1.0
mod_group_id=net.nullved
mod_authors=NullVed
mod_description=An API for interfacing with ProtoManly's Weather Mod

# Dependencies
pmweather_version=0.14.16
pmweather_version=0.15.1
pmweather_version_range=[0.15.0-1.21.1-alpha,0.15.999-1.21.1-alpha)
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.nullved.pmweatherapi.PMWeatherAPI;
import net.nullved.pmweatherapi.config.PMWClientConfig;
import net.nullved.pmweatherapi.radar.RadarMode;

import java.util.function.Supplier;

/**
* The overlay for {@link RadarMode} IDs.
* <br>
Expand All @@ -23,16 +26,36 @@ public class IDOverlay implements IRadarOverlay {
@Override
public void render(boolean canRender, RenderData renderData, BufferBuilder bufferBuilder, Object... args) {
if (!PMWClientConfig.showRadarModeId) return;
if (!Minecraft.getInstance().player.isCrouching()) return;

RadarMode mode = getRadarMode(renderData);
PoseStack poseStack = renderData.poseStack();
PMWClientConfig.RadarModeIDSide side = PMWClientConfig.radarModeIDSide;

poseStack.translate(side.x, 1.055f, side.z);
poseStack.mulPose(Axis.ZP.rotationDegrees(side.rotation));
float scale = renderData.sizeRenderDiameter() / 3.0F;

poseStack.pushPose();
poseStack.translate((side.x * scale) - 0.5F * (scale - 1), 1.055f, (side.z * scale) - 0.5F * (scale - 1));
poseStack.mulPose(Axis.YN.rotationDegrees(side.rotation));
poseStack.scale(0.01f, 0.01f, 0.01f);

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

float lineHeight = 8.0f;
float offset = lineHeight;
for (Supplier<? extends IRadarOverlay> overlay: RadarOverlays.getOverlays()) {
poseStack.pushPose();
poseStack.translate(0, 0, offset);
poseStack.scale(0.6f, 0.6f, 0.6f);

renderText(Component.literal(overlay.get().getID().toString()).withColor(0x888888), renderData, poseStack);

poseStack.popPose();
offset += lineHeight * 0.6f;
}

poseStack.popPose();

// While I could reset the pose, it is not strictly necessary
// poseStack.scale(100f, 100f, 100f);
// poseStack.mulPose(Axis.ZP.rotationDegrees(-side.rotation));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.nullved.pmweatherapi.client.render;

import net.minecraft.world.phys.Vec3;

/**
* Specific rendering data for a pixel on the radar
* @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
Expand All @@ -9,8 +11,9 @@
* @param x The x-position of the pixel (from {@code -resolution} to {@code resolution})
* @param z The z-position of the pixel (from {@code -resolution} to {@code resolution})
* @param resolution The resolution of the radar
* @param worldPos The world position of the pixel
* @param renderData The associated {@link RenderData}
* @since 0.14.15.6
*/
public record PixelRenderData(boolean canRender, float rdbz, float velocity, float temp, int x, int z, int resolution, RenderData renderData) {
public record PixelRenderData(boolean canRender, float rdbz, float velocity, float temp, int x, int z, int resolution, Vec3 worldPos, RenderData renderData) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
/**
* A wrapper class to be passed to {@link RenderData}
* @param blockEntity The {@link BlockEntity} associated with the render call
* @param sizeRenderDiameter The size in blocks of the radar
* @param partialTicks The time, in partial ticks, since last full tick
* @param poseStack The {@link PoseStack}
* @param multiBufferSource The {@link MultiBufferSource}
* @param combinedLightIn The current light value on the block entity
* @param combinedOverlayIn The current overlay of the block entity
* @since 0.14.15.2
*/
public record RenderData(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource multiBufferSource, int combinedLightIn, int combinedOverlayIn) {
public record RenderData(BlockEntity blockEntity, float sizeRenderDiameter, float partialTicks, PoseStack poseStack, MultiBufferSource multiBufferSource, int combinedLightIn, int combinedOverlayIn) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public enum RadarModeIDSide {
NORTH(0, -1, -1),
EAST(90, 2, -1),
SOUTH(180, 2, 2),
WEST(-90, -1, 2),;
WEST(-90, -1, 2);

public int rotation, x, z;
public final int rotation, x, z;

RadarModeIDSide(int rotation, int x, int z) {
this.rotation = rotation;
Expand Down
Loading
Loading