Skip to content

Commit

Permalink
Fix #451
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Nov 18, 2023
1 parent 0ff2f7f commit 09e04e0
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package dev.architectury.hooks.client.screen.forge;

import dev.architectury.mixin.forge.ScreenAccessor;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Renderable;
import net.minecraft.client.gui.components.events.GuiEventListener;
Expand All @@ -38,14 +37,14 @@ public static List<Renderable> getRenderables(Screen screen) {
}

public static <T extends AbstractWidget & Renderable & NarratableEntry> T addRenderableWidget(Screen screen, T widget) {
return ((ScreenAccessor) screen).invokeAddRenderableWidget(widget);
return screen.addRenderableWidget(widget);
}

public static <T extends Renderable> T addRenderableOnly(Screen screen, T listener) {
return ((ScreenAccessor) screen).invokeAddRenderableOnly(listener);
return screen.addRenderableOnly(listener);
}

public static <T extends GuiEventListener & NarratableEntry> T addWidget(Screen screen, T listener) {
return ((ScreenAccessor) screen).invokeAddWidget(listener);
return screen.addWidget(listener);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// adopted from fabric
@Mixin(Minecraft.class)
public abstract class MixinMinecraft {
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;gameThread:Ljava/lang/Thread;", shift = At.Shift.AFTER, ordinal = 0), method = "run")
@Inject(at = @At(value = "INVOKE", target = "Ljava/lang/Runtime;getRuntime()Ljava/lang/Runtime;", ordinal = 0), method = "run")
private void onStart(CallbackInfo ci) {
ClientLifecycleEvent.CLIENT_STARTED.invoker().stateChanged((Minecraft) (Object) this);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
@Override
public List<String> getMixins() {
return ArchitecturyTarget.getCurrentTarget().equals("forge")
? List.of("minecraftforge.MixinChunkSerializer")
? List.of()
: List.of("neoforge.MixinChunkSerializer");
}

Expand Down
3 changes: 1 addition & 2 deletions forge/src/main/resources/architectury.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"minVersion": "0.8",
"client": [
"MixinClientLevel",
"MixinMinecraft",
"ScreenAccessor"
"MixinMinecraft"
],
"mixins": [
"MixinEntitySpawnExtension",
Expand Down
1 change: 1 addition & 0 deletions minecraftforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ loom {
forge {
mixinConfig "architectury.mixins.json"
mixinConfig "architectury-common.mixins.json"
mixinConfig "architectury-forge.mixins.json"

convertAccessWideners = true
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
Expand Down
14 changes: 14 additions & 0 deletions minecraftforge/src/main/resources/architectury-forge.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"required": true,
"package": "dev.architectury.mixin.forge",
"compatibilityLevel": "JAVA_16",
"minVersion": "0.8",
"client": [
],
"mixins": [
"minecraftforge.MixinChunkSerializer"
],
"injectors": {
"defaultRequire": 1
}
}
1 change: 1 addition & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier = null
atAccessWideners.add "architectury.accessWidener"
}

task renameJarForPublication(type: Zip, dependsOn: remapJar) {
Expand Down

0 comments on commit 09e04e0

Please sign in to comment.