kerosene/remappedSrc/pm/j4/petroleum/mixin/DebugHudMixin.java

39 lines
1.3 KiB
Java
Raw Normal View History

2020-12-20 04:19:55 +00:00
package pm.j4.kerosene.mixin;
2020-12-19 23:30:50 +00:00
import java.util.List;
import java.util.Optional;
import net.minecraft.client.gui.hud.DebugHud;
import net.minecraft.client.util.math.MatrixStack;
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 org.spongepowered.asm.mixin.injection.callback.LocalCapture;
2020-12-20 04:19:55 +00:00
import pm.j4.kerosene.modules.splash.SplashText;
import pm.j4.kerosene.util.config.ConfigHolder;
import pm.j4.kerosene.util.config.ConfigManager;
2020-12-19 23:30:50 +00:00
/**
* The type Debug hud mixin.
*/
@Mixin(DebugHud.class)
public class DebugHudMixin {
/**
* Render text right.
*
* @param matrices the matrices
* @param ci the ci
* @param list the list
*/
@Inject(method = "renderLeftText",
at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/hud/DebugHud;getLeftText()Ljava/util/List;"),
locals = LocalCapture.CAPTURE_FAILSOFT)
protected void renderTextRight(MatrixStack matrices, CallbackInfo ci, List<String> list) {
Optional<ConfigHolder> config = ConfigManager.getConfig();
if (config.isPresent() && config.get().isModuleEnabled("petroleum.splashtext")) {
list.add("[Petroleum] " + SplashText.get() + " loaded");
}
}
}