Skip to content

Commit

Permalink
Fabric 1.20.6 runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed May 9, 2024
1 parent 976ed9e commit 2f55a32
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 38 deletions.
Expand Up @@ -29,10 +29,6 @@
//$$ import com.mojang.blaze3d.vertex.PoseStack;
//#endif

//#if MC >= 1.20.2
import net.minecraft.client.renderer.RenderType;
//#endif

public class FriendsScreen extends WorldHostScreen {
public static final Component ADD_FRIEND_TEXT = Components.translatable("world-host.add_friend");
private static final Component ADD_SILENTLY_TEXT = Components.translatable("world-host.friends.add_silently");
Expand Down Expand Up @@ -185,33 +181,6 @@ public FriendsList() {
);
}

//#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
//#if MC < 1.20.5
//$$ 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);
//#endif
graphics.setColor(1f, 1f, 1f, 1f);
graphics.fillGradient(RenderType.guiOverlay(), x0, y0, x1, y0 + 4, 0xff000000, 0, 0);
graphics.fillGradient(RenderType.guiOverlay(), x0, y1 - 4, x1, y1, 0, 0xff000000, 0);
}

//#endif

@Override
public void setSelected(@Nullable FriendsEntry entry) {
super.setSelected(entry);
Expand Down
Expand Up @@ -13,16 +13,24 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//#if MC >= 1.20.5
import net.minecraft.client.multiplayer.TransferState;
//#endif

@Mixin(ConnectScreen.class)
public class MixinConnectScreen {
@Shadow @Final Screen parent;

@Inject(method = "connect", at = @At("HEAD"), cancellable = true)
private void overrideConnect(
Minecraft minecraft, ServerAddress serverAddress,
Minecraft minecraft,
ServerAddress serverAddress,
//#if MC > 1.19.2
ServerData serverData,
//#endif
//#if MC >= 1.20.5
TransferState transferState,
//#endif
CallbackInfo ci
) {
final String host = serverAddress.getHost();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/world-host.mixins.json
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.7",
"package": "io.github.gaming32.worldhost.mixin",
"compatibilityLevel": "$java_version",
"compatibilityLevel": "JAVA_16",
"mixins": [
"MixinCommands",
"MixinLevelSummary",
Expand Down
18 changes: 13 additions & 5 deletions version.gradle.kts
Expand Up @@ -86,7 +86,7 @@ unimined.minecraft {

when {
isFabric -> fabric {
loader("0.15.1")
loader("0.15.6")
}
isForge -> minecraftForge {
loader(when(mcVersion) {
Expand Down Expand Up @@ -256,11 +256,19 @@ dependencies {
1_18_02 -> "0.77.0+1.18.2"
1_17_01 -> "0.46.1+1.17"
else -> null
}?.let { fabricApi.fabricModule("fabric-resource-loader-v0", it) }
?.let {
"modImplementation"(it)
bundle(it)
}?.let { fapiVersion ->
val resourceLoader = fabricApi.fabricModule("fabric-resource-loader-v0", fapiVersion)
"modImplementation"(resourceLoader)
bundle(resourceLoader)

for (module in listOf(
"fabric-screen-api-v1",
"fabric-key-binding-api-v1",
"fabric-lifecycle-events-v1"
)) {
"modRuntimeOnly"(fabricApi.fabricModule(module,fapiVersion))
}
}
}

if (isFabric && mcVersion >= 1_18_02) {
Expand Down

0 comments on commit 2f55a32

Please sign in to comment.