From e0eb1c953d6a43025fcb567c6bef68be870d9e97 Mon Sep 17 00:00:00 2001 From: granny Date: Tue, 18 Jun 2024 03:37:59 -0700 Subject: [PATCH] Update to 1.21 (#40) --- build.gradle | 2 +- gradle.properties | 10 +++++----- .../purpurmc/purpur/client/config/Seats.java | 1 - .../purpur/client/gui/SplashTexture.java | 2 +- .../client/gui/screen/AbstractScreen.java | 2 +- .../purpur/client/gui/screen/MobScreen.java | 4 ++++ .../purpur/client/gui/screen/MobsScreen.java | 20 ++++++++----------- .../gui/screen/widget/DoubleButton.java | 2 +- .../client/gui/screen/widget/MobButton.java | 2 +- .../client/gui/screen/widget/MobsList.java | 6 +++--- .../client/mixin/MixinLoadingOverlay.java | 2 +- .../network/ClientboundBeehivePayload.java | 2 +- .../network/ServerboundBeehivePayload.java | 2 +- .../ServerboundPurpurClientHelloPayload.java | 2 +- 14 files changed, 29 insertions(+), 30 deletions(-) diff --git a/build.gradle b/build.gradle index 187cc9a..6b20e4b 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ dependencies { minecraft("com.mojang:minecraft:${project.minecraft_version}") mappings loom.layered() { officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${project.parchment_version}@zip") + //parchment("org.parchmentmc.data:parchment-${minecraft_version}:${project.parchment_version}@zip") // TODO: update when available } modImplementation("net.fabricmc:fabric-loader:${project.loader_version}") modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") diff --git a/gradle.properties b/gradle.properties index 6ed1785..29ba72d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ org.gradle.jvmargs=-Xmx2G -minecraft_version=1.20.6 -loader_version=0.15.10 -parchment_version=2024.05.01 -fabric_version=0.97.8+1.20.6 -modmenu_version=10.0.0-beta.1 +minecraft_version=1.21 +loader_version=0.15.11 +#parchment_version=2024.05.01 # TODO: update when available +fabric_version=0.100.1+1.21 +modmenu_version=11.0.0-beta.1 configurate_version=4.1.2 maven_group=org.purpurmc.purpur.client diff --git a/src/main/java/org/purpurmc/purpur/client/config/Seats.java b/src/main/java/org/purpurmc/purpur/client/config/Seats.java index 912ff0e..089ed29 100644 --- a/src/main/java/org/purpurmc/purpur/client/config/Seats.java +++ b/src/main/java/org/purpurmc/purpur/client/config/Seats.java @@ -93,7 +93,6 @@ public void setAllSeats(double x, double y, double z) { allay.setSeat(z, y, z); armadillo.setSeat(z, y, z); axolotl.setSeat(z, y, z); - allay.setSeat(z, y, z); bat.setSeat(z, y, z); bee.setSeat(z, y, z); blaze.setSeat(z, y, z); diff --git a/src/main/java/org/purpurmc/purpur/client/gui/SplashTexture.java b/src/main/java/org/purpurmc/purpur/client/gui/SplashTexture.java index a48b677..c6525b8 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/SplashTexture.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/SplashTexture.java @@ -10,7 +10,7 @@ import net.minecraft.server.packs.resources.ResourceManager; public class SplashTexture extends SimpleTexture { - public static final ResourceLocation SPLASH = new ResourceLocation("purpurclient", "textures/splash.png"); + public static final ResourceLocation SPLASH = ResourceLocation.fromNamespaceAndPath("purpurclient", "textures/splash.png"); public SplashTexture() { super(SPLASH); diff --git a/src/main/java/org/purpurmc/purpur/client/gui/screen/AbstractScreen.java b/src/main/java/org/purpurmc/purpur/client/gui/screen/AbstractScreen.java index 3bf5f3c..b2de142 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/screen/AbstractScreen.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/screen/AbstractScreen.java @@ -7,7 +7,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.screens.OptionsSubScreen; +import net.minecraft.client.gui.screens.options.OptionsSubScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; diff --git a/src/main/java/org/purpurmc/purpur/client/gui/screen/MobScreen.java b/src/main/java/org/purpurmc/purpur/client/gui/screen/MobScreen.java index 080c403..efc32a3 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/screen/MobScreen.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/screen/MobScreen.java @@ -140,6 +140,10 @@ public void init() { this.fakePlayer.startRiding(this.fakeEntity, true); } + @Override + protected void addOptions() { + } + @Override public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { renderBackground(context, mouseX, mouseY, delta); diff --git a/src/main/java/org/purpurmc/purpur/client/gui/screen/MobsScreen.java b/src/main/java/org/purpurmc/purpur/client/gui/screen/MobsScreen.java index 01ebf69..5d514cf 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/screen/MobsScreen.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/screen/MobsScreen.java @@ -7,7 +7,7 @@ import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.MobsList; import net.minecraft.client.gui.components.OptionsList; -import net.minecraft.client.gui.screens.OptionsSubScreen; +import net.minecraft.client.gui.screens.options.OptionsSubScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -17,7 +17,6 @@ public class MobsScreen extends OptionsSubScreen { public final static MutableComponent MOBS_BTN = Component.translatable("purpurclient.options.mobs"); - protected OptionsList options; protected int centerX; public MobsScreen(Screen screen) { @@ -25,8 +24,8 @@ public MobsScreen(Screen screen) { } @Override - protected void init() { - MobsList widget = new MobsList(this.minecraft, this.height, this.height, this); + protected void addContents() { + MobsList widget = new MobsList(this.minecraft, this.height, this); int amount = 15; List list = new ArrayList<>(); @@ -38,19 +37,16 @@ protected void init() { } } widget.addEntry(list); - this.options = this.addRenderableWidget(widget); - super.init(); + this.list = this.layout.addToContents(widget); } @Override - public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float delta) { - super.renderBackground(context, mouseX, mouseY, delta); - context.fillGradient(0, 0, this.width, this.height, 0x800F4863, 0x80370038); + protected void addOptions() { } @Override - protected void repositionElements() { - super.repositionElements(); - this.options.updateSize(this.width, this.layout); + public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float delta) { + super.renderBackground(context, mouseX, mouseY, delta); + context.fillGradient(0, 0, this.width, this.height, 0x800F4863, 0x80370038); } } diff --git a/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/DoubleButton.java b/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/DoubleButton.java index f8cfa29..c699505 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/DoubleButton.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/DoubleButton.java @@ -15,7 +15,7 @@ public class DoubleButton extends AbstractWidget implements Tickable { private final static Component PLUS = Component.nullToEmpty("+"); private final static Component MINUS = Component.nullToEmpty("-"); - private static final WidgetSprites TEXTURES = new WidgetSprites(new ResourceLocation("widget/button"), new ResourceLocation("widget/button_disabled"), new ResourceLocation("widget/button_highlighted")); + private static final WidgetSprites TEXTURES = new WidgetSprites(ResourceLocation.parse("widget/button"), ResourceLocation.parse("widget/button_disabled"), ResourceLocation.parse("widget/button_highlighted")); private final DoubleOption option; private int tooltipDelay; diff --git a/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobButton.java b/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobButton.java index 80cf3e3..6dcba31 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobButton.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobButton.java @@ -13,7 +13,7 @@ public class MobButton extends SpriteIconButton { public static final int MOBS_ATLAS_WIDTH = 512; public static final int MOBS_TEXTURE_WIDTH = 16; - public static final ResourceLocation MOBS_TEXTURE = new ResourceLocation("purpurclient", "textures/mobs.png"); + public static final ResourceLocation MOBS_TEXTURE = ResourceLocation.fromNamespaceAndPath("purpurclient", "textures/mobs.png"); public MobButton(Minecraft client, Screen screen, Mob mob) { super(MOBS_TEXTURE_WIDTH, MOBS_TEXTURE_WIDTH, diff --git a/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobsList.java b/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobsList.java index 06af008..5660b20 100644 --- a/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobsList.java +++ b/src/main/java/org/purpurmc/purpur/client/gui/screen/widget/MobsList.java @@ -12,7 +12,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; -import net.minecraft.client.gui.screens.OptionsSubScreen; +import net.minecraft.client.gui.screens.options.OptionsSubScreen; import net.minecraft.client.gui.screens.Screen; import org.jetbrains.annotations.Nullable; @@ -22,8 +22,8 @@ public class MobsList extends OptionsList { private static final int DEFAULT_ITEM_HEIGHT = 25; private final OptionsSubScreen screen; - public MobsList(Minecraft minecraft, int width, int height, OptionsSubScreen screen) { - super(minecraft, width, height, screen); + public MobsList(Minecraft minecraft, int width, OptionsSubScreen screen) { + super(minecraft, width, screen); this.screen = screen; } diff --git a/src/main/java/org/purpurmc/purpur/client/mixin/MixinLoadingOverlay.java b/src/main/java/org/purpurmc/purpur/client/mixin/MixinLoadingOverlay.java index 8bcbac8..42b5466 100644 --- a/src/main/java/org/purpurmc/purpur/client/mixin/MixinLoadingOverlay.java +++ b/src/main/java/org/purpurmc/purpur/client/mixin/MixinLoadingOverlay.java @@ -83,7 +83,7 @@ public void render(GuiGraphics context, int mouseX, int mouseY, float delta, Cal this.delta = 0; opacity = Mth.clamp(g, 0.0f, 1.0f); } else { - this.delta += this.minecraft.getFrameTime(); + this.delta += this.minecraft.getTimer().getRealtimeDeltaTicks(); opacity = Mth.clampedLerp(-0.5F, 1.0F, this.delta / 30F); } diff --git a/src/main/java/org/purpurmc/purpur/client/network/ClientboundBeehivePayload.java b/src/main/java/org/purpurmc/purpur/client/network/ClientboundBeehivePayload.java index fe6433a..13e82d8 100644 --- a/src/main/java/org/purpurmc/purpur/client/network/ClientboundBeehivePayload.java +++ b/src/main/java/org/purpurmc/purpur/client/network/ClientboundBeehivePayload.java @@ -12,7 +12,7 @@ public record ClientboundBeehivePayload(BlockPos pos, int numOfBees) implements CustomPacketPayload { public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec(ClientboundBeehivePayload::write, ClientboundBeehivePayload::new); - public static final Type TYPE = new Type<>(new ResourceLocation("purpur", "beehive_s2c")); + public static final Type TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("purpur", "beehive_s2c")); public static String NUM_OF_BEES = null; public ClientboundBeehivePayload(FriendlyByteBuf friendlyByteBuf) { diff --git a/src/main/java/org/purpurmc/purpur/client/network/ServerboundBeehivePayload.java b/src/main/java/org/purpurmc/purpur/client/network/ServerboundBeehivePayload.java index d08cbbb..81275da 100644 --- a/src/main/java/org/purpurmc/purpur/client/network/ServerboundBeehivePayload.java +++ b/src/main/java/org/purpurmc/purpur/client/network/ServerboundBeehivePayload.java @@ -9,7 +9,7 @@ public record ServerboundBeehivePayload(BlockPos pos) implements CustomPacketPayload { public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec(ServerboundBeehivePayload::write, ServerboundBeehivePayload::new); - public static final Type TYPE = new Type<>(new ResourceLocation("purpur", "beehive_c2s")); + public static final Type TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("purpur", "beehive_c2s")); public ServerboundBeehivePayload(FriendlyByteBuf friendlyByteBuf) { this(friendlyByteBuf.readBlockPos()); diff --git a/src/main/java/org/purpurmc/purpur/client/network/ServerboundPurpurClientHelloPayload.java b/src/main/java/org/purpurmc/purpur/client/network/ServerboundPurpurClientHelloPayload.java index 0278859..bf38241 100644 --- a/src/main/java/org/purpurmc/purpur/client/network/ServerboundPurpurClientHelloPayload.java +++ b/src/main/java/org/purpurmc/purpur/client/network/ServerboundPurpurClientHelloPayload.java @@ -8,7 +8,7 @@ public record ServerboundPurpurClientHelloPayload(int protocol) implements CustomPacketPayload { public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec(ServerboundPurpurClientHelloPayload::write, ServerboundPurpurClientHelloPayload::new); - public static final Type TYPE = new Type<>(new ResourceLocation("purpur", "client")); + public static final Type TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("purpur", "client")); public static final int PROTOCOL = 0; public ServerboundPurpurClientHelloPayload(){