-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I can load into a world on Fabric without crashes
- Loading branch information
Showing
19 changed files
with
71 additions
and
60 deletions.
There are no files selected for viewing
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
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
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
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
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
47 changes: 24 additions & 23 deletions
47
common/src/main/java/io/github/gaming32/bingo/mixin/common/client/MixinGui.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 |
---|---|---|
@@ -1,44 +1,45 @@ | ||
package io.github.gaming32.bingo.mixin.common.client; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import io.github.gaming32.bingo.client.BingoClient; | ||
import io.github.gaming32.bingo.client.BoardScreen; | ||
import io.github.gaming32.bingo.client.config.BingoClientConfig; | ||
import io.github.gaming32.bingo.client.config.BoardCorner; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Gui.class) | ||
public class MixinGui { | ||
@Shadow @Final private Minecraft minecraft; | ||
|
||
@WrapOperation( | ||
method = "render", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderEffects(Lnet/minecraft/client/gui/GuiGraphics;)V") | ||
) | ||
private void moveEffects(Gui instance, GuiGraphics guiGraphics, Operation<Void> original) { | ||
final BingoClientConfig config = BingoClient.CONFIG; | ||
if ( | ||
BingoClient.clientGame == null || config.getBoardCorner() != BoardCorner.UPPER_RIGHT || | ||
minecraft.getDebugOverlay().showDebugScreen() || minecraft.screen instanceof BoardScreen | ||
) { | ||
original.call(instance, guiGraphics); | ||
return; | ||
@Inject(method = "renderEffects", at = @At("HEAD")) | ||
private void moveEffectsPre(GuiGraphics guiGraphics, float f, CallbackInfo ci) { | ||
if (bingo$effectsNeedMoving()) { | ||
final float scale = BingoClient.CONFIG.getBoardScale(); | ||
guiGraphics.pose().pushPose(); | ||
guiGraphics.pose().translate( | ||
(-BingoClient.getBoardWidth() - BingoClient.BOARD_OFFSET) * scale, | ||
BingoClient.BOARD_OFFSET * scale, 0f | ||
); | ||
} | ||
} | ||
|
||
@Inject(method = "renderEffects", at = @At("RETURN")) | ||
private void moveEffectsPost(GuiGraphics guiGraphics, float f, CallbackInfo ci) { | ||
if (bingo$effectsNeedMoving()) { | ||
guiGraphics.pose().popPose(); | ||
} | ||
} | ||
|
||
final float scale = config.getBoardScale(); | ||
guiGraphics.pose().pushPose(); | ||
guiGraphics.pose().translate( | ||
(-BingoClient.getBoardWidth() - BingoClient.BOARD_OFFSET) * scale, | ||
BingoClient.BOARD_OFFSET * scale, 0f | ||
); | ||
original.call(instance, guiGraphics); | ||
guiGraphics.pose().popPose(); | ||
@Unique | ||
private boolean bingo$effectsNeedMoving() { | ||
return BingoClient.clientGame != null && BingoClient.CONFIG.getBoardCorner() == BoardCorner.UPPER_RIGHT && | ||
!minecraft.getDebugOverlay().showDebugScreen() && !(minecraft.screen instanceof BoardScreen); | ||
} | ||
} |
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
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
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
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