Skip to content

Commit

Permalink
Mixin refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
KabanFriends committed Jun 28, 2024
1 parent 7fddb68 commit e670bbf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -17,11 +17,11 @@
@Mixin(GuiGraphics.class)
public abstract class MixinGuiGraphics {

@Shadow
protected abstract void flushIfUnmanaged();

@Inject(method = "renderTooltipInternal", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;popPose()V",shift = At.Shift.AFTER))
public void craftgr$fixTooltip(Font font, List<ClientTooltipComponent> tooltips, int mouseX, int mouseY, ClientTooltipPositioner positioner, CallbackInfo ci) {
invokeFlushIfUnmanaged();
private void craftgr$fixTooltip(Font font, List<ClientTooltipComponent> tooltips, int mouseX, int mouseY, ClientTooltipPositioner positioner, CallbackInfo ci) {
flushIfUnmanaged();
}

@Invoker("flushIfUnmanaged")
public abstract void invokeFlushIfUnmanaged();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class MixinMinecraft {

@Inject(method = "stop()V", at = @At("HEAD"))
public void craftgr$onClientStop(CallbackInfo ci) {
private void craftgr$onClientStop(CallbackInfo ci) {
AudioPlayerHandler handler = AudioPlayerHandler.getInstance();

if (handler.isPlaying()) handler.stopPlayback();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class MixinOptionsSubScreen extends Screen {
@Shadow
protected OptionsList list;

public MixinOptionsSubScreen(Component title) {
protected MixinOptionsSubScreen(Component title) {
super(title);
}

@Inject(method = "removed()V", at = @At("RETURN"))
public void craftgr$saveConfig(CallbackInfo ci) {
protected void craftgr$saveConfig(CallbackInfo ci) {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class MixinSoundEngine {

@Inject(method = "reload", at = @At("HEAD"))
public void craftgr$stopAudio(CallbackInfo ci) {
private void craftgr$stopAudio(CallbackInfo ci) {
AudioPlayerHandler handler = AudioPlayerHandler.getInstance();

if (handler.getState() == HandlerState.ACTIVE) {
Expand All @@ -24,7 +24,7 @@ public class MixinSoundEngine {
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/sounds/SoundBufferLibrary;preload(Ljava/util/Collection;)Ljava/util/concurrent/CompletableFuture;", shift = At.Shift.AFTER), method = "loadLibrary()V")
public void craftgr$startAudio(CallbackInfo ci) {
private void craftgr$startAudio(CallbackInfo ci) {
AudioPlayerHandler handler = AudioPlayerHandler.getInstance();

// Establish the connection right after the audio is loaded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class MixinSoundOptionsScreen extends MixinOptionsSubScreen {
}
});

public MixinSoundOptionsScreen(Component title) {
private MixinSoundOptionsScreen(Component title) {
super(title);
}

Expand All @@ -64,7 +64,7 @@ public MixinSoundOptionsScreen(Component title) {
}

@Override
public void craftgr$saveConfig(CallbackInfo ci) {
protected void craftgr$saveConfig(CallbackInfo ci) {
GRConfig.save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class MixinTitleScreen {

@Inject(method = "render", at = @At(value="INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V"))
public void craftgr$onRenderScreen(GuiGraphics graphics, int i, int j, float f, CallbackInfo ci) {
private void craftgr$onRenderScreen(GuiGraphics graphics, int i, int j, float f, CallbackInfo ci) {
// Allow rendering the song overlay
CraftGR.renderSongOverlay = true;
}
Expand Down

0 comments on commit e670bbf

Please sign in to comment.