-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Protonull/fix-forge
Fix Forge fuckery
- Loading branch information
Showing
7 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,6 @@ | |
"fabric": "*" | ||
}, | ||
"mixins": [ | ||
"civmodern.mixins.json" | ||
"civmodern.common.mixins.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
forge/src/main/java/sh/okx/civmodern/forge/mixins/PostGuiRenderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package sh.okx.civmodern.forge.mixins; | ||
|
||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import org.jetbrains.annotations.NotNull; | ||
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; | ||
import sh.okx.civmodern.common.AbstractCivModernMod; | ||
import sh.okx.civmodern.common.events.PostRenderGameOverlayEvent; | ||
|
||
/** | ||
* This didn't use to be necessary thanks to the RenderGuiEvent.Post event, but that seems to have been removed and | ||
* there's no equivalent that I am aware of. This is a stopgap measure until an equivalent or better is found. | ||
*/ | ||
@Mixin(Gui.class) | ||
public abstract class PostGuiRenderMixin { | ||
@Inject( | ||
method = "render", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/gui/LayeredDraw;render(Lnet/minecraft/client/gui/GuiGraphics;F)V", | ||
shift = At.Shift.AFTER | ||
) | ||
) | ||
protected void civmodern$emitPostRenderEvent( | ||
final @NotNull GuiGraphics guiGraphics, | ||
final float partialTick, | ||
final @NotNull CallbackInfo ci | ||
) { | ||
AbstractCivModernMod.getInstance().eventBus.post(new PostRenderGameOverlayEvent( | ||
guiGraphics, | ||
partialTick | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "sh.okx.civmodern.forge.mixins", | ||
"compatibilityLevel": "JAVA_17", | ||
"mixins": [], | ||
"client": [ | ||
"PostGuiRenderMixin" | ||
], | ||
"server": [], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |