mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-10-24 08:22:28 +00:00
Replace Mth.clamp with Math.clamp
This has existed since Java 21. MC 26.4 does this, but might as well get in early.
This commit is contained in:
3 files changed
+3
-5
No files matched your search
+1
-1
@@ -94,7 +94,7 @@ public final class CustomLecternBlockEntity extends BlockEntity {
|
||||
private void itemChanged() {
|
||||
if (item.getItem() instanceof PrintoutItem) {
|
||||
pageCount = PrintoutData.getOrEmpty(item).pages();
|
||||
page = Mth.clamp(page, 0, pageCount - 1);
|
||||
page = Math.clamp(page, 0, pageCount - 1);
|
||||
} else {
|
||||
pageCount = page = 0;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.container.InvisibleSlot;
|
||||
import dan200.computercraft.shared.media.items.PrintoutData;
|
||||
import dan200.computercraft.shared.media.items.PrintoutItem;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.SimpleContainer;
|
||||
@@ -103,7 +102,7 @@ public class PrintoutMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(Player player, int id) {
|
||||
if (id >= PAGE_BUTTON_OFFSET) {
|
||||
var page = Mth.clamp(id - PAGE_BUTTON_OFFSET, 0, PrintoutData.getOrEmpty(getPrintout()).pages() - 1);
|
||||
var page = Math.clamp(id - PAGE_BUTTON_OFFSET, 0, PrintoutData.getOrEmpty(getPrintout()).pages() - 1);
|
||||
setData(DATA_CURRENT_PAGE, page);
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-2
@@ -28,7 +28,6 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@@ -373,7 +372,7 @@ public abstract class SpeakerPeripheral implements IPeripheral {
|
||||
}
|
||||
|
||||
static double clampVolume(double volume) {
|
||||
return Mth.clamp(volume, 0, 3);
|
||||
return Math.clamp(volume, 0, 3);
|
||||
}
|
||||
|
||||
private record PendingSound<T>(T sound, float volume, float pitch) {
|
||||
|
||||
Reference in new issue
Block a user