-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NOTE: HUD overlay and debug overlay info doesn't render on Forge.
- Loading branch information
Showing
23 changed files
with
186 additions
and
107 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
14 changes: 9 additions & 5 deletions
14
platforms/common/src/main/java/dynamic_fps/impl/mixin/ToastComponentMixin.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,19 +1,23 @@ | ||
package dynamic_fps.impl.mixin; | ||
|
||
import java.util.Deque; | ||
|
||
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.CallbackInfoReturnable; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import dynamic_fps.impl.DynamicFPSMod; | ||
import net.minecraft.client.gui.components.toasts.Toast; | ||
import net.minecraft.client.gui.components.toasts.ToastComponent; | ||
|
||
@Mixin(ToastComponent.class) | ||
public class ToastComponentMixin { | ||
@Inject(method = "freeSlots", at = @At("HEAD"), cancellable = true) | ||
private void hasFreeSlots(CallbackInfoReturnable<Integer> callbackInfo) { | ||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/Deque;isEmpty()Z")) | ||
private boolean onQueueIsEmpty(Deque<Toast> queued) { | ||
if (!DynamicFPSMod.shouldShowToasts()) { | ||
callbackInfo.setReturnValue(0); | ||
return true; | ||
} else { | ||
return queued.isEmpty(); | ||
} | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
platforms/common/src/main/java/dynamic_fps/impl/util/Logging.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
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
27 changes: 27 additions & 0 deletions
27
platforms/fabric/src/main/java/net/lostluma/dynamic_fps/impl/fabric/mixin/GuiMixin.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,27 @@ | ||
package net.lostluma.dynamic_fps.impl.fabric.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import dynamic_fps.impl.util.HudInfoRenderer; | ||
import net.minecraft.client.gui.Gui; | ||
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; | ||
|
||
@Mixin(Gui.class) | ||
public class GuiMixin { | ||
/** | ||
* Render info on whether Dynamic FPS is disabled or always reducing the user's FPS. | ||
*/ | ||
@Inject( | ||
method = "render", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/gui/Gui;renderHotbar(FLcom/mojang/blaze3d/vertex/PoseStack;)V" | ||
) | ||
) | ||
private void render(CallbackInfo callbackInfo, @Local PoseStack poseStack) { | ||
HudInfoRenderer.renderInfo(poseStack); | ||
} | ||
} |
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
Oops, something went wrong.