Skip to content

Commit

Permalink
Fix crashes and issues on 1.20.1 Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Oct 4, 2023
1 parent 6210c30 commit 7bbf38f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
// `kotlin-dsl`
id("xyz.deftu.gradle.preprocess-root") version "0.4.1"
id("xyz.wagyourtail.unimined") version "1.0.6-SNAPSHOT" apply false
id("xyz.wagyourtail.unimined") version "1.1.0-SNAPSHOT" apply false
}

repositories {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/github/gaming32/worldhost/WorldHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
//$$ import io.github.gaming32.worldhost.gui.screen.WorldHostConfigScreen;
//$$ import net.minecraft.client.gui.screens.Screen;
//$$ import net.minecraft.server.packs.PackType;
//$$ import net.minecraft.server.packs.PackResources;
//$$ import net.minecraftforge.api.distmarker.Dist;
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
//$$ import net.minecraftforge.fml.ModList;
Expand Down Expand Up @@ -229,7 +230,7 @@ private static void init() {
//#if MC <= 1.19.2
//$$ try {
//#endif
//$$ return c.getResource(PackType.CLIENT_RESOURCES, new ResourceLocation("world-host", "16k.txt"));
//$$ return ((PackResources)c).getResource(PackType.CLIENT_RESOURCES, new ResourceLocation("world-host", "16k.txt"));
//#if MC <= 1.19.2
//$$ } catch (IOException e) {
//$$ throw new UncheckedIOException(e);
Expand Down
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()V", 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()V", 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()V", 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()V", constant = @Constant(intValue = 150, ordinal = 0))
private int shrinkPlayButton(int constant) {
return WorldHost.CONFIG.isShareButton() ? 100 : constant;
}

@Inject(
method = "init*",
method = "init()V",
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()V", 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()V", 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()V", 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 @@ -20,7 +20,7 @@ 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()V", 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
5 changes: 5 additions & 0 deletions version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ tasks.processResources {

tasks.withType<RemapJarTask> {
shade.files.forEach { from(project.zipTree(it)) }
manifest {
if (loaderName == "forge") {
attributes["MixinConfigs"] = "world-host.mixins.json"
}
}
}

val mcJavaVersion = (minecraft as MinecraftProvider).minecraftData.metadata.javaVersion
Expand Down

0 comments on commit 7bbf38f

Please sign in to comment.