mirror of
https://github.com/TeamMidnightDust/PictureSign.git
synced 2025-12-13 04:45:10 +01:00
Fix Java 17
This commit is contained in:
@@ -58,7 +58,7 @@ allprojects {
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 21
|
||||
options.release = 17
|
||||
}
|
||||
ext {
|
||||
releaseChangelog = {
|
||||
|
||||
@@ -3,6 +3,7 @@ package eu.midnightdust.picturesign.util;
|
||||
import eu.midnightdust.picturesign.config.PictureSignConfig;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -43,7 +44,7 @@ public abstract class MediaHandler {
|
||||
return;
|
||||
}
|
||||
double distance = this.pos.getSquaredDistance(playerPos) / PictureSignConfig.audioDistanceMultiplier;
|
||||
setVolume((int) Math.clamp(maxVolume-distance, 0, 100));
|
||||
setVolume((int) MathHelper.clamp(maxVolume-distance, 0, 100));
|
||||
}
|
||||
void setVolume(int volume) {}
|
||||
public void setMaxVolume(int volume) {
|
||||
@@ -53,7 +54,8 @@ public abstract class MediaHandler {
|
||||
public void closePlayer() {}
|
||||
|
||||
public static void closePlayer(Identifier videoId) {
|
||||
if (mediaHandlers.get(videoId) instanceof MediaHandler mediaHandler) mediaHandler.closePlayer();
|
||||
MediaHandler mediaHandler = mediaHandlers.getOrDefault(videoId, null);
|
||||
if (mediaHandler != null) mediaHandler.closePlayer();
|
||||
}
|
||||
public static void closeAll() {
|
||||
mediaHandlers.forEach(((id, player) -> player.closePlayer()));
|
||||
|
||||
Reference in New Issue
Block a user