Updated to 1.20.x

This commit is contained in:
hhhzzzsss 2023-06-18 18:10:39 -05:00
parent 63d2e53811
commit ecf2d35161
6 changed files with 22 additions and 19 deletions

View file

@ -4,15 +4,15 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.19
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.2
loader_version=0.14.21
# Mod Properties
mod_version = 2.0.4
mod_version = 3.0
maven_group = com.github.hhhzzzsss
archives_base_name = song-player
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.80.0+1.19.4
fabric_version=0.83.1+1.20.1

View file

@ -3,6 +3,7 @@ package com.github.hhhzzzsss.songplayer.item;
import com.github.hhhzzzsss.songplayer.SongPlayer;
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
import net.minecraft.client.font.MultilineText;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
@ -52,10 +53,10 @@ public class SongItemConfirmationScreen extends Screen {
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
this.renderBackground(context);
drawCenteredTextWithShadow(matrices, this.textRenderer, this.title, this.width / 2, 40, 0xFFFFFF);
context.drawCenteredTextWithShadow(textRenderer, this.title, this.width / 2, 40, 0xFFFFFF);
if (!loaderThread.isAlive()) {
if (loaderThread.exception != null) {
@ -80,13 +81,13 @@ public class SongItemConfirmationScreen extends Screen {
}
if (loaded) {
loadedText.drawCenterWithShadow(matrices, this.width / 2, 60);
loadedText.drawCenterWithShadow(context, this.width / 2, 60);
}
else {
unloadedText.drawCenterWithShadow(matrices, this.width / 2, 60);
unloadedText.drawCenterWithShadow(context, this.width / 2, 60);
}
super.render(matrices, mouseX, mouseY, delta);
super.render(context, mouseX, mouseY, delta);
}
public String getNumberColor(double number) {

View file

@ -1,6 +1,7 @@
package com.github.hhhzzzsss.songplayer.mixin;
import com.github.hhhzzzsss.songplayer.playing.ProgressDisplay;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
@ -22,7 +23,7 @@ public class InGameHudMixin {
@Inject(method = "render",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", ordinal = 3))
private void onRender(MatrixStack matrixStack, float tickDelta, CallbackInfo ci) {
ProgressDisplay.getInstance().onRenderHUD(matrixStack, scaledWidth, scaledHeight, heldItemTooltipFade);
private void onRender(DrawContext context, float tickDelta, CallbackInfo ci) {
ProgressDisplay.getInstance().onRenderHUD(context, scaledWidth, scaledHeight, heldItemTooltipFade);
}
}

View file

@ -2,6 +2,7 @@ package com.github.hhhzzzsss.songplayer.playing;
import com.github.hhhzzzsss.songplayer.SongPlayer;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
@ -28,7 +29,7 @@ public class ProgressDisplay {
fade = 100;
}
public void onRenderHUD(MatrixStack matrixStack, int scaledWidth, int scaledHeight, int heldItemTooltipFade) {
public void onRenderHUD(DrawContext context, int scaledWidth, int scaledHeight, int heldItemTooltipFade) {
if (fade <= 0) {
return;
}
@ -54,8 +55,8 @@ public class ProgressDisplay {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
Objects.requireNonNull(SongPlayer.MC.textRenderer);
SongPlayer.MC.textRenderer.drawWithShadow(matrixStack, bottomText, (float)bottomTextX, (float)bottomTextY, 16777215 + (opacity << 24));
SongPlayer.MC.textRenderer.drawWithShadow(matrixStack, topText, (float)topTextX, (float)topTextY, 16777215 + (opacity << 24));
context.drawTextWithShadow(SongPlayer.MC.textRenderer, bottomText, bottomTextX, bottomTextY, 16777215 + (opacity << 24));
context.drawTextWithShadow(SongPlayer.MC.textRenderer, topText, topTextX, topTextY, 16777215 + (opacity << 24));
RenderSystem.disableBlend();
}

View file

@ -143,7 +143,7 @@ public class Stage {
.stream()
.filter((bp) -> {
BlockState bs = SongPlayer.MC.world.getBlockState(bp);
return !bs.isAir() && !bs.getMaterial().isLiquid();
return !bs.isAir() && !bs.isLiquid();
})
.sorted((a, b) -> {
// First sort by y
@ -448,7 +448,7 @@ public class Stage {
}
BlockState aboveBs = SongPlayer.MC.world.getBlockState(entry.getValue().up());
if (!aboveBs.isAir() && !aboveBs.getMaterial().isLiquid()) {
if (!aboveBs.isAir() && !aboveBs.isLiquid()) {
return true;
}
}

View file

@ -28,7 +28,7 @@
"depends": {
"fabricloader": ">=0.14.11",
"fabric": "*",
"minecraft": "~1.19.4",
"minecraft": "1.20.x",
"java": ">=17"
},
"suggests": {