Skip to content

Commit

Permalink
1.20.3 compiles!
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Dec 5, 2023
1 parent 8169747 commit f5f0d3c
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 30 deletions.
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ repositories {
}

preprocess {
val fabric12003 = createNode("1.20.3-fabric", 1_20_03, "yarn")
val neoforge12003 = createNode("1.20.3-neoforge", 1_20_03, "yarn")
val fabric12002 = createNode("1.20.2-fabric", 1_20_02, "yarn")
val neoforge12002 = createNode("1.20.2-neoforge", 1_20_02, "yarn")
val fabric12001 = createNode("1.20.1-fabric", 1_20_01, "yarn")
Expand All @@ -24,7 +26,9 @@ preprocess {
val forge11605 = createNode("1.16.5-forge", 1_16_05, "srg")
val fabric11601 = createNode("1.16.1-fabric", 1_16_01, "yarn")

fabric12002.link(neoforge12002)
fabric12003.link(neoforge12003)
neoforge12003.link(neoforge12002)
neoforge12002.link(fabric12002)
fabric12002.link(fabric12001)
fabric12001.link(forge12001)
forge12001.link(forge11904)
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ listOf(
"1.20.1-fabric",
"1.20.2-neoforge",
"1.20.2-fabric",
"1.20.3-neoforge",
"1.20.3-fabric",
).forEach { version ->
include(":$version")
project(":$version").apply {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/gaming32/worldhost/WorldHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import net.minecraft.server.players.GameProfileCache;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.quiltmc.qup.json.JsonReader;
import org.quiltmc.qup.json.JsonWriter;
import org.quiltmc.parsers.json.JsonReader;
import org.quiltmc.parsers.json.JsonWriter;

import java.io.*;
import java.net.InetAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.gaming32.worldhost;

import io.github.gaming32.worldhost.gui.OnlineStatusLocation;
import org.quiltmc.qup.json.JsonReader;
import org.quiltmc.qup.json.JsonWriter;
import org.quiltmc.parsers.json.JsonReader;
import org.quiltmc.parsers.json.JsonWriter;

import java.io.IOException;
import java.util.LinkedHashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ protected void init() {
super.init();

if (list == null) {
list = new FriendsList(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64), 36);
list = new FriendsList();
//#if MC > 1.16.1
if (minecraft != null && minecraft.level != null) {
list.setRenderBackground(false);
}
//#endif
} else {
list.updateSize(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64));
}
setListSize(list, 32, WorldHost.BEDROCK_SUPPORT ? 80 : 64);
addWidget(list);

addRenderableWidget(
Expand Down Expand Up @@ -174,16 +173,35 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {
}

public class FriendsList extends ObjectSelectionList<FriendsEntry> {
public FriendsList(int i, int j, int k, int l, int m) {
public FriendsList() {
//noinspection DataFlowIssue
super(FriendsScreen.this.minecraft, i, j, k, l, m);
super(
FriendsScreen.this.minecraft,
//#if MC >= 1.20.3
0, 0, 0,
//#else
//$$ 0, 0, 0, 0,
//#endif
36
);
}

//#if MC >= 1.20.2
@Override
protected void renderDecorations(@NotNull GuiGraphics graphics, int mouseX, int mouseY) {
super.renderDecorations(graphics, mouseX, mouseY);
graphics.setColor(0.25f, 0.25f, 0.25f, 1f);
//#if MC >= 1.20.3
final int x0 = getX();
final int x1 = getRight();
final int y0 = getY();
final int y1 = getBottom();
//#else
//$$ final int x0 = this.x0;
//$$ final int x1 = this.x1;
//$$ final int y0 = this.y0;
//$$ final int y1 = this.y1;
//#endif
graphics.blit(BACKGROUND_LOCATION, x0, 0, 0f, 0f, width, y0, 32, 32);
graphics.blit(BACKGROUND_LOCATION, x0, y1, 0f, y1, width, height - y1, 32, 32);
graphics.setColor(1f, 1f, 1f, 1f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ protected void init() {
assert minecraft != null;
sendRepeatEvents(true);
if (list == null) {
list = new OnlineFriendsList(minecraft, width, height, 60, height - 64, 36);
list = new OnlineFriendsList();
WorldHost.ONLINE_FRIENDS.forEach((u, c) -> list.addEntry(new OnlineFriendsListEntry(u, c)));
WorldHost.pingFriends();
WorldHost.ONLINE_FRIEND_UPDATES.add(this);
} else {
list.updateSize(width, height, 60, height - 64);
}
setListSize(list, 60, 64);
addWidget(list);

joinButton = addRenderableWidget(
Expand Down Expand Up @@ -231,8 +230,17 @@ public void friendsListUpdate(Map<UUID, Long> friends) {
}

public class OnlineFriendsList extends ObjectSelectionList<OnlineFriendsListEntry> {
public OnlineFriendsList(Minecraft minecraftClient, int i, int j, int k, int l, int m) {
super(minecraftClient, i, j, k, l, m);
public OnlineFriendsList() {
//noinspection DataFlowIssue
super(
OnlineFriendsScreen.this.minecraft,
//#if MC >= 1.20.3
0, 0, 0,
//#else
//$$ 0, 0, 0, 0,
//#endif
36
);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.blaze3d.vertex.PoseStack;
import io.github.gaming32.worldhost.versions.ButtonBuilder;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.AbstractSelectionList;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -402,4 +403,12 @@ public void whRenderBackground(
super.renderBackground(context, mouseX, mouseY, delta);
//#endif
}

public void setListSize(AbstractSelectionList<?> list, int topMargin, int bottomMargin) {
//#if MC >= 1.20.3
list.setRectangle(width, height - bottomMargin - topMargin, 0, topMargin);
//#else
//$$ list.updateSize(width, height, topMargin, height - bottomMargin);
//#endif
}
}
33 changes: 19 additions & 14 deletions version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ unimined.minecraft {
searge()
mojmap()
when {
mcVersion >= 1_20_02 -> "1.20.2:2023.10.22"
mcVersion >= 1_20_01 -> "1.20.1:2023.09.03"
mcVersion >= 1_19_04 -> "1.19.4:2023.06.26"
mcVersion >= 1_19_03 -> "1.19.3:2023.06.25"
Expand Down Expand Up @@ -98,9 +99,13 @@ unimined.minecraft {
}
isNeoForge -> neoForged {
loader(when (mcVersion) {
1_20_02 -> "35-beta"
1_20_02 -> "86"
1_20_03 -> "1-beta"
else -> throw IllegalStateException("Unknown NeoForge version for $mcVersionString")
})
minecraftRemapper.config {
ignoreConflicts(true)
}
}
else -> throw IllegalStateException()
}
Expand Down Expand Up @@ -205,9 +210,9 @@ dependencies {
bundle(dependency)
}

bundleImplementation("org.quiltmc.qup:json:0.2.0")
bundleImplementation("org.quiltmc.parsers:json:0.2.1")
if (isForgeLike) {
"minecraftLibraries"("org.quiltmc.qup:json:0.2.0")
"minecraftLibraries"("org.quiltmc.parsers:json:0.2.1")
}

//TODO: bump to unimined 1.1.0+ to use these, also enable the processor in unimined's mixin config settings
Expand All @@ -218,9 +223,10 @@ dependencies {

if (isFabric) {
when (mcVersion) {
1_20_02 -> "8.0.0-beta.2" // TODO: Update out of beta
1_20_01 -> "7.0.1"
1_19_04 -> "6.2.3"
1_20_03 -> "9.0.0-pre.1" // TODO: Update out of pre
1_20_02 -> "8.0.0"
1_20_01 -> "7.2.2"
1_19_04 -> "6.3.1"
1_19_02 -> "4.2.0-beta.2"
1_18_02 -> "3.2.5"
1_17_01 -> "2.0.17"
Expand All @@ -234,17 +240,16 @@ dependencies {
}
}

if (!isNeoForge) { // TODO: Remove check when DevAuth for NeoForge is released (which depends on Arch)
modRuntimeOnly("me.djtheredstoner:DevAuth-${if (isFabric) "fabric" else "forge-latest"}:1.1.2")
}
modRuntimeOnly("me.djtheredstoner:DevAuth-${if (isFabric) "fabric" else "forge-latest"}:1.1.2")

if (isFabric) {
when (mcVersion) {
1_20_02 -> "0.89.2+1.20.2"
1_20_01 -> "0.89.0+1.20.1"
1_19_04 -> "0.87.0+1.19.4"
1_19_02 -> "0.76.1+1.19.2"
1_18_02 -> "0.76.0+1.18.2"
1_20_03 -> "0.91.1+1.20.3"
1_20_02 -> "0.91.1+1.20.2"
1_20_01 -> "0.91.0+1.20.1"
1_19_04 -> "0.87.2+1.19.4"
1_19_02 -> "0.77.0+1.19.2"
1_18_02 -> "0.77.0+1.18.2"
1_17_01 -> "0.46.1+1.17"
1_16_05, 1_16_01 -> "0.42.0+1.16"
else -> null
Expand Down
2 changes: 1 addition & 1 deletion versions/mainProject
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.2-fabric
1.20.3-fabric

0 comments on commit f5f0d3c

Please sign in to comment.