Skip to content

Commit

Permalink
Merge pull request #50 from wagyourtail/main
Browse files Browse the repository at this point in the history
arch-loom -> unimined
  • Loading branch information
Gaming32 authored Sep 22, 2023
2 parents 3da9011 + 7dbc495 commit 193ffe0
Show file tree
Hide file tree
Showing 11 changed files with 309 additions and 128 deletions.
20 changes: 19 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
plugins {
id("xyz.deftu.gradle.multiversion-root")
// `kotlin-dsl`
id("xyz.deftu.gradle.preprocess-root") version "0.4.1"
id("xyz.wagyourtail.unimined") version "1.0.6-SNAPSHOT" apply false
}

repositories {
mavenCentral()
}

preprocess {
Expand Down Expand Up @@ -28,4 +34,16 @@ preprocess {
fabric11701.link(fabric11605)
fabric11605.link(forge11605)
fabric11605.link(fabric11601)

// subprojects {
// apply(plugin = "java")
// if (name == "1.20.1-fabric") {
// sourceSets.main {
// java {
// srcDir("$rootDir/src/main/java")
// }
// }
// }
// }
}

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ pluginManagement {
maven("https://maven.fabricmc.net")
maven("https://maven.architectury.dev/")
maven("https://maven.minecraftforge.net")
maven("https://maven.neoforged.net/releases")
maven("https://repo.essential.gg/repository/maven-public")
maven("https://maven.jab125.dev/")

maven("https://maven.wagyourtail.xyz/snapshots")
maven("https://maven.wagyourtail.xyz/releases")
gradlePluginPortal()
mavenCentral()
}
Expand Down Expand Up @@ -37,6 +39,7 @@ listOf(
include(":$version")
project(":$version").apply {
projectDir = file("versions/$version")
projectDir.mkdirs()
buildFileName = "../../version.gradle.kts"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected MixinJoinMultiplayerScreen(Component component) {
super(component);
}

@Inject(method = "init", at = @At("TAIL"))
@Inject(method = "init*", at = @At("TAIL"))
private void tabs(CallbackInfo ci) {
if (!WorldHost.CONFIG.isEnableFriends()) return;

Expand All @@ -51,7 +51,7 @@ private void tabs(CallbackInfo ci) {
));
}

@ModifyConstant(method = "init", constant = @Constant(intValue = 32))
@ModifyConstant(method = "init*", constant = @Constant(intValue = 32))
private int makeTopBigger(int constant) {
return WorldHost.CONFIG.isEnableFriends() ? 60 : constant;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ protected MixinSelectWorldScreen(Component component) {
super(component);
}

@ModifyConstant(method = "init", constant = @Constant(stringValue = "selectWorld.select"))
@ModifyConstant(method = "init*", constant = @Constant(stringValue = "selectWorld.select"))
private String changePlayButtonText(String constant) {
return WorldHost.CONFIG.isShareButton() ? "world-host.play_world" : constant;
}

@ModifyConstant(method = "init", constant = @Constant(intValue = 150, ordinal = 0))
@ModifyConstant(method = "init*", constant = @Constant(intValue = 150, ordinal = 0))
private int shrinkPlayButton(int constant) {
return WorldHost.CONFIG.isShareButton() ? 100 : constant;
}

@Inject(
method = "init",
method = "init*",
at = @At(
value = "INVOKE",
//#if MC > 1.16.5
Expand Down Expand Up @@ -70,17 +70,17 @@ private void addShareWorldButton(CallbackInfo ci) {
);
}

@ModifyConstant(method = "init", constant = @Constant(intValue = 4, ordinal = 0))
@ModifyConstant(method = "init*", constant = @Constant(intValue = 4, ordinal = 0))
private int moveCreateButton(int constant) {
return WorldHost.CONFIG.isShareButton() ? 54 : constant;
}

@ModifyConstant(method = "init", constant = @Constant(intValue = 150, ordinal = 1))
@ModifyConstant(method = "init*", constant = @Constant(intValue = 150, ordinal = 1))
private int shrinkCreateButton(int constant) {
return WorldHost.CONFIG.isShareButton() ? 100 : constant;
}

@ModifyConstant(method = "init", constant = @Constant(stringValue = "selectWorld.create"))
@ModifyConstant(method = "init*", constant = @Constant(stringValue = "selectWorld.create"))
private String changeCreateButtonText(String constant) {
return WorldHost.CONFIG.isShareButton() ? "world-host.create_world" : constant;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

@Mixin(ShareToLanScreen.class)
public class MixinShareToLanScreen {
@ModifyConstant(method = "<init>", constant = @Constant(stringValue = "lanServer.title"))
@ModifyConstant(method = "<init>*", constant = @Constant(stringValue = "lanServer.title"))
private static String changeLabelI1(String constant) {
return WorldHost.CONFIG.isEnableFriends() ? "world-host.open_world" : "world-host.open_world_no_friends";
}

@ModifyConstant(method = "init", constant = @Constant(stringValue = "lanServer.start"))
@ModifyConstant(method = "init*", constant = @Constant(stringValue = "lanServer.start"))
private String changeLabelI2(String constant) {
return WorldHost.CONFIG.isEnableFriends() ? "world-host.open_world" : "world-host.open_world_no_friends";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//#if FABRIC && MC > 1.16.1
package io.github.gaming32.worldhost.mixin.modmenu;

import org.spongepowered.asm.mixin.Mixin;

//#if FABRIC && MC > 1.16.1
import com.terraformersmc.modmenu.event.ModMenuEventHandler;
import io.github.gaming32.worldhost.gui.widget.OnlineStatusButton;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -33,11 +32,4 @@ private static void dontShiftOnlineStatus(LayoutElement widget, boolean shiftUp,
//$$ }
//#endif
}
//#else
//$$ // Fallback so that there is *some* mixin class to load
//$$ import net.minecraft.client.Minecraft;
//$$
//$$ @Mixin(Minecraft.class)
//$$ public class MixinModMenuEventHandler {
//$$ }
//#endif
10 changes: 5 additions & 5 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ issueTrackerURL = "https://github.com/Gaming32/world-host/issues"
license = "MIT"

[[mods]]
modId = "${mod_id.replace('-', '_')}"
version = "$mod_version"
displayName = "$mod_name"
modId = "world_host"
version = "$version"
displayName = "World Host"
displayURL = "https://modrinth.com/mod/world-host"
logoFile = "icon.png"
authors = "Gaming32"
description = "Host your singleplayer worlds without having to run a server or setup port forwarding! In the future, we also plan to support Bedrock Edition clients through the use of Geyser."

[[dependencies.$mod_id]]
[[dependencies.world_host]]
modId = "forge"
mandatory = true
versionRange = "[32,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.$mod_id]]
[[dependencies.world_host]]
modId = "minecraft"
mandatory = true
versionRange = "$mc_version"
Expand Down
22 changes: 16 additions & 6 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"schemaVersion": 1,
"id": "$mod_id",
"name": "$mod_name",
"version": "$mod_version",
"id": "world-host",
"name": "World Host",
"version": "$version",
"description": "Host your singleplayer worlds without having to run a server or setup port forwarding! In the future, we also plan to support Bedrock Edition clients through the use of Geyser.",
"authors": [
"Gaming32"
Expand All @@ -28,13 +28,23 @@
],
"depends": {
"fabricloader": "*",
"minecraft": "${mc_version == '1.19.4' ? '>=1.19.4 <1.20' : mc_version == '1.20.1' ? '>=1.20- <1.20.2' : mc_version}",
//#if MC == 1.19.4
//?? "minecraft": ">=1.19.4 <1.20",
//#elseif MC == 1.20.1
//?? "minecraft": ">=1.20- <1.20.2",
//#else
"minecraft": "$mc_version",
//#endif
"fabric-resource-loader-v0": "*"
},
"breaks": {
${mc_version == '1.19.4' ? '"modmenu": "<6.2.0"' : ''}
//#if MC == 1.19.4
"modmenu": "<6.2.0"
//#endif
},
"suggests": {
${mc_version == '1.20.1' ? '"world-host-bedrock": ">=0.4.2"' : ''}
//#if MC == 1.20.1 && 0
"world-host-bedrock": ">=0.4.2"
//#endif
}
}
9 changes: 6 additions & 3 deletions src/main/resources/world-host.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"mixins": [
"MixinCommands",
"MixinPublishCommand",
"ServerConnectionListenerAccessor",
"modmenu.MixinModMenuEventHandler"
"ServerConnectionListenerAccessor"
],
"client": [
"MinecraftAccessor",
Expand All @@ -25,8 +24,12 @@
"MixinWorldSelectionList_WorldListEntry",
"PlainTextButtonAccessor",
"ServerStatusPingerAccessor"
//#if FABRIC && MC > 1.16.1
, "modmenu.MixinModMenuEventHandler"
//#endif
],
"injectors": {
"defaultRequire": 1
}
},
"refmap": "world-host.mixins.refmap.json"
}
Loading

0 comments on commit 193ffe0

Please sign in to comment.