Skip to content

Commit

Permalink
fix clock time not displaying correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Jan 6, 2025
1 parent e93fa64 commit 094eb0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ public void render(ClockBlockEntity blockEntity, float partialTick, PoseStack st

private void renderHands(ClockBlockEntity blockEntity, ModelPart hourHand, ModelPart minuteHand, double y, double z, PoseStack stack, VertexConsumer vc, int light, int overlay) {
Level level = Objects.requireNonNull(blockEntity.getLevel());
float rotation = level.dimensionType().natural() ? -level.getSunAngle(1) * 2 : getRotation(level);
float rotation = level.dimensionType().natural() ? -((level.getDayTime() + 6000) % 12000) * 0.03f : getRotation(level);
stack.pushPose();
stack.translate(0, y, z);
stack.pushPose();
stack.mulPose(Axis.ZP.rotation(rotation));
stack.mulPose(Axis.ZP.rotationDegrees(rotation));
hourHand.render(stack, vc, light, overlay);
stack.popPose();
stack.pushPose();
stack.mulPose(Axis.ZP.rotation(rotation * 12));
stack.mulPose(Axis.ZP.rotationDegrees((rotation * 12) % 360));
minuteHand.render(stack, vc, light, overlay);
stack.popPose();
stack.popPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public record ClockTrigger(int hour, int minute, boolean redstone, boolean sound

public int getInGameTime() {
// 1 in-game hour is 1000 ticks, 1 in-game minute is 50/3 ticks.
return (int) (hour * 1000 + minute * 50 / 3d);
return ((int) (hour * 1000 + minute * 50 / 3d) + 18000) % 24000;
}

@Override
Expand Down

0 comments on commit 094eb0d

Please sign in to comment.