Skip to content

Commit

Permalink
Update to Minecraft 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Ampflower committed Jun 29, 2024
1 parent 4b21a88 commit 9df319f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ org.gradle.jvmargs=-Xmx1G

# Your project's version
group=gay.ampflower
projectVersion=0.4.7
projectVersion=0.4.8
modrinthId=z23qey0b
minecraftCompatible=1.20.6
minecraftCompatible=1.21
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
annotations = "23.0.0"

# https://github.com/LambdAurora/SpruceUI
spruceui = "5.1.0+1.20.6"
modmenu = "10.0.+"
spruceui = "5.1.0+1.21"
modmenu = "11.0.+"

# Minecraft
minecraft_version = "1.20.6"
minecraft_required = "1.20.6"
minecraft_version = "1.21"
minecraft_required = "1.21"
fabric_loader = "0.15.+"
fabric_api = "0.100.4+1.20.6"
fabric_api = "0.100.4+1.21"

# Plugins
loom = "1.+"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gay/ampflower/musicmoods/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public static WidgetSprites widgetHoverable(String widget) {
}

public static ResourceLocation widget(String widget) {
return new ResourceLocation(modId, "widget/" + widget);
return ResourceLocation.fromNamespaceAndPath(modId, "widget/" + widget);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package gay.ampflower.musicmoods.client;// Created 2023-09-01T02:55:14

import it.unimi.dsi.fastutil.floats.FloatUnaryOperator;
import net.minecraft.client.Timer;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.sounds.SoundEvent;
Expand All @@ -25,7 +25,7 @@ public class MusicSoundInstance extends AbstractTickableSoundInstance {
*/
private static final float JUMP_LIMIT = 0.025F;

private final Timer timer = new Timer(20F, System.currentTimeMillis(), FloatUnaryOperator.identity());
private final DeltaTracker.Timer timer = new DeltaTracker.Timer(20F, System.currentTimeMillis(), FloatUnaryOperator.identity());
private float fadeOut;
private float fadeIn;

Expand Down Expand Up @@ -66,18 +66,18 @@ public void setFadeIn(float fadeIn) {

@Override
public void tick() {
this.timer.advanceTime(System.currentTimeMillis());
this.timer.advanceTime(System.currentTimeMillis(), false);

if (fadeOut > 0F && this.volume > 0F) {
final var newVolume = Math.max(this.volume - Math.min(this.timer.tickDelta / fadeOut, JUMP_LIMIT), 0F);
final var newVolume = Math.max(this.volume - Math.min(this.timer.getRealtimeDeltaTicks() / fadeOut, JUMP_LIMIT), 0F);

if (newVolume == newVolume) {
this.volume = newVolume;
}
}

if (fadeIn > 0F && this.volume < 1F) {
final var newVolume = Math.min(this.volume + Math.min(this.timer.tickDelta / fadeIn, JUMP_LIMIT), 1F);
final var newVolume = Math.min(this.volume + Math.min(this.timer.getRealtimeDeltaTicks() / fadeIn, JUMP_LIMIT), 1F);

if (newVolume == newVolume) {
this.volume = newVolume;
Expand Down

0 comments on commit 9df319f

Please sign in to comment.