Compare commits
2 Commits
db7f1daa02
...
60f5142796
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60f5142796 | ||
|
|
b8ee08bf81 |
@@ -56,21 +56,20 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
*/
|
||||
public class MidnightControlsClient extends MidnightControls {
|
||||
public static boolean lateInitDone = false;
|
||||
public static final KeyBinding.Category MIDNIGHTCONTROLS_CATEGORY = KeyBinding.Category.create(Identifier.of("midnightcontrols", "keybinds"));
|
||||
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(id("look_up"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.midnightcontrols");
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, MIDNIGHTCONTROLS_CATEGORY);
|
||||
public static final KeyBinding BINDING_LOOK_RIGHT = InputManager.makeKeyBinding(id("look_right"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_6, "key.categories.midnightcontrols");
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_6, MIDNIGHTCONTROLS_CATEGORY);
|
||||
public static final KeyBinding BINDING_LOOK_DOWN = InputManager.makeKeyBinding(id("look_down"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, "key.categories.midnightcontrols");
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, MIDNIGHTCONTROLS_CATEGORY);
|
||||
public static final KeyBinding BINDING_LOOK_LEFT = InputManager.makeKeyBinding(id("look_left"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, "key.categories.midnightcontrols");
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, MIDNIGHTCONTROLS_CATEGORY);
|
||||
public static final KeyBinding BINDING_RING = InputManager.makeKeyBinding(id("ring"),
|
||||
InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.categories.midnightcontrols");
|
||||
InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), MIDNIGHTCONTROLS_CATEGORY);
|
||||
public static final Identifier CONTROLLER_BUTTONS = id("textures/gui/controller_buttons.png");
|
||||
public static final Identifier CONTROLLER_EXPANDED = id("textures/gui/controller_expanded.png");
|
||||
public static final Identifier CONTROLLER_AXIS = id("textures/gui/controller_axis.png");
|
||||
public static final Identifier WAYLAND_CURSOR_TEXTURE_LIGHT = id("cursor/light/mouse_pointer");
|
||||
public static final Identifier WAYLAND_CURSOR_TEXTURE_DARK = id("cursor/dark/mouse_pointer");
|
||||
public static final File MAPPINGS_FILE = new File("config/gamecontrollercustommappings.txt");
|
||||
public static MinecraftClient client = MinecraftClient.getInstance();
|
||||
public static final MidnightInput input = new MidnightInput();
|
||||
|
||||
@@ -58,9 +58,6 @@ import net.minecraft.client.gui.screen.advancement.AdvancementTab;
|
||||
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.MerchantScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.StonecutterScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
|
||||
import net.minecraft.client.gui.screen.world.WorldListWidget;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
|
||||
@@ -420,18 +420,9 @@ public class InputManager {
|
||||
* @param code the code
|
||||
* @param category the category of the key binding
|
||||
* @return the key binding
|
||||
* @see #makeKeyBinding(Identifier, InputUtil.Type, int, String)
|
||||
* @see #makeKeyBinding(Identifier, InputUtil.Type, int, net.minecraft.client.option.KeyBinding.Category)
|
||||
*/
|
||||
public static @NotNull KeyBinding makeKeyBinding(@NotNull Identifier id, InputUtil.Type type, int code, @NotNull String category) {
|
||||
return new KeyBinding(String.format("key.%s.%s", id.getNamespace(), id.getPath()), type, code, new KeyBinding.Category(validVanillaId(category)));
|
||||
}
|
||||
|
||||
private static Identifier validVanillaId(String path) {
|
||||
for(int i = 0; i < path.length(); ++i) {
|
||||
if (!Identifier.isPathCharacterValid(path.charAt(i))) {
|
||||
path = path.replace(path.charAt(i), '_');
|
||||
}
|
||||
}
|
||||
return Identifier.ofVanilla(path);
|
||||
public static @NotNull KeyBinding makeKeyBinding(@NotNull Identifier id, InputUtil.Type type, int code, @NotNull KeyBinding.Category category) {
|
||||
return new KeyBinding(String.format("key.%s.%s", id.getNamespace(), id.getPath()), type, code, category);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,44 +9,25 @@
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ControllerType;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.VirtualMouseSkin;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.render.UnalignedTexturedQuadGuiElementRenderState;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.DrawContextAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.render.state.TexturedQuadGuiElementRenderState;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.TextureSetup;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Atlases;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Matrix3x2f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
|
||||
/**
|
||||
* Represents the midnightcontrols renderer.
|
||||
@@ -213,69 +194,6 @@ public class MidnightControlsRenderer {
|
||||
private static int getButtonTipWidth(@NotNull String action, @NotNull TextRenderer textRenderer) {
|
||||
return 15 + 5 + textRenderer.getWidth(action);
|
||||
}
|
||||
public static void renderWaylandCursor(@NotNull DrawContext context, @NotNull MinecraftClient client) {
|
||||
if (MidnightControlsConfig.virtualMouse || client.currentScreen == null || MidnightControlsConfig.controlsMode != ControlsMode.CONTROLLER) return;
|
||||
|
||||
float mouseX = (float) client.mouse.getX() * client.getWindow().getScaledWidth() / client.getWindow().getWidth();
|
||||
float mouseY = (float) client.mouse.getY() * client.getWindow().getScaledHeight() / client.getWindow().getHeight();
|
||||
|
||||
try {
|
||||
Identifier spritePath = MidnightControlsClient.WAYLAND_CURSOR_TEXTURE_LIGHT;
|
||||
if (MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.DEFAULT_DARK || MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.SECOND_DARK)
|
||||
spritePath = MidnightControlsClient.WAYLAND_CURSOR_TEXTURE_DARK;
|
||||
|
||||
Sprite sprite = client.getAtlasManager().getAtlasTexture(Atlases.GUI).getSprite(spritePath);
|
||||
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 8, mouseY, mouseY + 8, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
} catch (IllegalStateException ignored) {}
|
||||
}
|
||||
|
||||
public static void renderVirtualCursor(@NotNull DrawContext context, @NotNull MinecraftClient client) {
|
||||
if (!MidnightControlsConfig.virtualMouse || (client.currentScreen == null
|
||||
|| MidnightInput.isScreenInteractive(client.currentScreen)))
|
||||
return;
|
||||
|
||||
float mouseX = (float) client.mouse.getX() * client.getWindow().getScaledWidth() / client.getWindow().getWidth();
|
||||
float mouseY = (float) client.mouse.getY() * client.getWindow().getScaledHeight() / client.getWindow().getHeight();
|
||||
|
||||
boolean hoverSlot = false;
|
||||
|
||||
if (client.currentScreen instanceof HandledScreenAccessor inventoryScreen) {
|
||||
int guiLeft = inventoryScreen.getX();
|
||||
int guiTop = inventoryScreen.getY();
|
||||
|
||||
Slot slot = inventoryScreen.midnightcontrols$getSlotAt(mouseX, mouseY);
|
||||
|
||||
if (slot != null) {
|
||||
mouseX = guiLeft + slot.x;
|
||||
mouseY = guiTop + slot.y;
|
||||
hoverSlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hoverSlot && client.currentScreen != null) {
|
||||
var slot = MidnightControlsCompat.getSlotAt(client.currentScreen, (int) mouseX, (int) mouseY);
|
||||
|
||||
if (slot != null) {
|
||||
mouseX = slot.x();
|
||||
mouseY = slot.y();
|
||||
hoverSlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hoverSlot) {
|
||||
mouseX -= 8;
|
||||
mouseY -= 8;
|
||||
}
|
||||
|
||||
try {
|
||||
Sprite sprite = client.getAtlasManager().getAtlasTexture(Atlases.GUI).getSprite(id(MidnightControlsConfig.virtualMouseSkin.getSpritePath() + (hoverSlot ? "_slot" : "")));
|
||||
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 16, mouseY, mouseY + 16, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
} catch (IllegalStateException ignored) {}
|
||||
}
|
||||
private static void drawUnalignedTexturedQuad(RenderPipeline pipeline, Identifier texture, DrawContext context, float x1, float x2, float y1, float y2, float u1, float u2, float v1, float v2) {
|
||||
DrawContextAccessor accessor = (DrawContextAccessor) context;
|
||||
accessor.getState().addSimpleElement(new UnalignedTexturedQuadGuiElementRenderState(pipeline, TextureSetup.withoutGlTexture(client.getTextureManager().getTexture(texture).getGlTextureView()), new Matrix3x2f(context.getMatrices()), x1, y1, x2, y2, u1, u2, v1, v2, 0xffffffff, accessor.getScissorStack().peekLast()));
|
||||
}
|
||||
|
||||
public record ButtonSize(int length, int height) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package eu.midnightdust.midnightcontrols.client.gui.cursor;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.DrawContextAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.cursor.Cursor;
|
||||
import net.minecraft.client.texture.TextureSetup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Matrix3x2f;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
|
||||
public abstract class CursorRenderer {
|
||||
public static Cursor currentCursorStyle = Cursor.DEFAULT;
|
||||
|
||||
public abstract void renderCursor(@NotNull DrawContext context, @NotNull MinecraftClient client);
|
||||
|
||||
public static void drawUnalignedTexturedQuad(RenderPipeline pipeline, Identifier texture, DrawContext context, float x1, float x2, float y1, float y2, float u1, float u2, float v1, float v2) {
|
||||
DrawContextAccessor accessor = (DrawContextAccessor) context;
|
||||
accessor.getState().addSimpleElement(new UnalignedTexturedQuadGuiElementRenderState(pipeline, TextureSetup.withoutGlTexture(client.getTextureManager().getTexture(texture).getGlTextureView()), new Matrix3x2f(context.getMatrices()), x1, y1, x2, y2, u1, u2, v1, v2, 0xffffffff, accessor.getScissorStack().peekLast()));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package eu.midnightdust.midnightcontrols.client.gui.render;
|
||||
package eu.midnightdust.midnightcontrols.client.gui.cursor;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -0,0 +1,67 @@
|
||||
package eu.midnightdust.midnightcontrols.client.gui.cursor;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.util.Atlases;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
|
||||
public class VirtualCursorRenderer extends CursorRenderer {
|
||||
private static final VirtualCursorRenderer INSTANCE = new VirtualCursorRenderer();
|
||||
|
||||
public static VirtualCursorRenderer getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void renderCursor(@NotNull DrawContext context, @NotNull MinecraftClient client) {
|
||||
if (!MidnightControlsConfig.virtualMouse || (client.currentScreen == null
|
||||
|| MidnightInput.isScreenInteractive(client.currentScreen)))
|
||||
return;
|
||||
|
||||
float mouseX = (float) client.mouse.getX() * client.getWindow().getScaledWidth() / client.getWindow().getWidth();
|
||||
float mouseY = (float) client.mouse.getY() * client.getWindow().getScaledHeight() / client.getWindow().getHeight();
|
||||
|
||||
boolean hoverSlot = false;
|
||||
|
||||
if (client.currentScreen instanceof HandledScreenAccessor inventoryScreen) {
|
||||
int guiLeft = inventoryScreen.getX();
|
||||
int guiTop = inventoryScreen.getY();
|
||||
|
||||
Slot slot = inventoryScreen.midnightcontrols$getSlotAt(mouseX, mouseY);
|
||||
|
||||
if (slot != null) {
|
||||
mouseX = guiLeft + slot.x;
|
||||
mouseY = guiTop + slot.y;
|
||||
hoverSlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hoverSlot && client.currentScreen != null) {
|
||||
var slot = MidnightControlsCompat.getSlotAt(client.currentScreen, (int) mouseX, (int) mouseY);
|
||||
|
||||
if (slot != null) {
|
||||
mouseX = slot.x();
|
||||
mouseY = slot.y();
|
||||
hoverSlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hoverSlot) {
|
||||
mouseX -= 8;
|
||||
mouseY -= 8;
|
||||
}
|
||||
|
||||
try {
|
||||
Sprite sprite = client.getAtlasManager().getAtlasTexture(Atlases.GUI).getSprite(id(MidnightControlsConfig.virtualMouseSkin.getSpritePath() + (hoverSlot ? "_slot" : "")));
|
||||
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 16, mouseY, mouseY + 16, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
} catch (IllegalStateException ignored) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package eu.midnightdust.midnightcontrols.client.gui.cursor;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.VirtualMouseSkin;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.cursor.StandardCursors;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.Atlases;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
|
||||
public class WaylandCursorRenderer extends CursorRenderer {
|
||||
private static final WaylandCursorRenderer INSTANCE = new WaylandCursorRenderer();
|
||||
|
||||
public static final Identifier WAYLAND_CURSOR_ARROW_LIGHT = id("cursor/light/mouse_arrow");
|
||||
public static final Identifier WAYLAND_CURSOR_ARROW_DARK = id("cursor/dark/mouse_arrow");
|
||||
public static final Identifier WAYLAND_CURSOR_POINTING_LIGHT = id("cursor/light/mouse_pointing_hand");
|
||||
public static final Identifier WAYLAND_CURSOR_POINTING_DARK = id("cursor/dark/mouse_pointing_hand");
|
||||
public static final Identifier WAYLAND_CURSOR_IBEAM_LIGHT = id("cursor/light/mouse_ibeam");
|
||||
public static final Identifier WAYLAND_CURSOR_IBEAM_DARK = id("cursor/dark/mouse_ibeam");
|
||||
|
||||
public static WaylandCursorRenderer getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void renderCursor(@NotNull DrawContext context, @NotNull MinecraftClient client) {
|
||||
if (MidnightControlsConfig.virtualMouse || client.currentScreen == null || MidnightControlsConfig.controlsMode != ControlsMode.CONTROLLER) return;
|
||||
|
||||
float mouseX = (float) client.mouse.getX() * client.getWindow().getScaledWidth() / client.getWindow().getWidth();
|
||||
float mouseY = (float) client.mouse.getY() * client.getWindow().getScaledHeight() / client.getWindow().getHeight();
|
||||
|
||||
try {
|
||||
Sprite sprite = getSprite(client);
|
||||
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX - 2, mouseX + 6, mouseY - 2, mouseY + 6, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
} catch (IllegalStateException ignored) {}
|
||||
}
|
||||
|
||||
private static Sprite getSprite(@NotNull MinecraftClient client) {
|
||||
boolean isDark = MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.DEFAULT_DARK || MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.SECOND_DARK;
|
||||
Identifier spritePath;
|
||||
if (CursorRenderer.currentCursorStyle == StandardCursors.POINTING_HAND) spritePath = isDark ? WAYLAND_CURSOR_POINTING_DARK : WAYLAND_CURSOR_POINTING_LIGHT;
|
||||
else if (CursorRenderer.currentCursorStyle == StandardCursors.IBEAM) spritePath = isDark ? WAYLAND_CURSOR_IBEAM_DARK : WAYLAND_CURSOR_IBEAM_LIGHT;
|
||||
else spritePath = isDark ? WAYLAND_CURSOR_ARROW_DARK : WAYLAND_CURSOR_ARROW_LIGHT;
|
||||
|
||||
return client.getAtlasManager().getAtlasTexture(Atlases.GUI).getSprite(spritePath);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.gui.cursor.CursorRenderer;
|
||||
import net.minecraft.client.gui.cursor.Cursor;
|
||||
import net.minecraft.client.util.Window;
|
||||
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(Cursor.class)
|
||||
public abstract class CursorMixin {
|
||||
@Inject(method = "applyTo", at = @At("TAIL"))
|
||||
public void midnightcontrols$applyCursorStyle(Window window, CallbackInfo ci) {
|
||||
CursorRenderer.currentCursorStyle = ((Cursor) (Object) this);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsRenderer;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.cursor.VirtualCursorRenderer;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.cursor.WaylandCursorRenderer;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchUtils;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
@@ -39,8 +41,8 @@ public abstract class GameRendererMixin {
|
||||
}
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER))
|
||||
private void midnightcontrols$renderVirtualCursor(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
||||
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
||||
if (MidnightControlsClient.isWayland) MidnightControlsRenderer.renderWaylandCursor(drawContext, client);
|
||||
VirtualCursorRenderer.getInstance().renderCursor(drawContext, client);
|
||||
if (MidnightControlsClient.isWayland) WaylandCursorRenderer.getInstance().renderCursor(drawContext, client);
|
||||
//drawContext.draw();
|
||||
}
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderHand(FZLorg/joml/Matrix4f;)V"), method = "renderWorld")
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"midnightcontrols.midnightconfig.enum.TouchMode.FINGER_POS": "Finger Position",
|
||||
"midnightcontrols.midnightconfig.enum.CameraMode.FLAT": "Flat",
|
||||
"midnightcontrols.midnightconfig.enum.CameraMode.ADAPTIVE": "Adaptive",
|
||||
"key.categories.midnightcontrols": "MidnightControls",
|
||||
"key.category.midnightcontrols.keybinds": "MidnightControls",
|
||||
"key.midnightcontrols.look_down": "Look Down",
|
||||
"key.midnightcontrols.look_left": "Look Left",
|
||||
"key.midnightcontrols.look_right": "Look Right",
|
||||
|
||||
|
After Width: | Height: | Size: 311 B |
|
After Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 341 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 296 B |
|
Before Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 339 B |
|
After Width: | Height: | Size: 261 B |
@@ -12,6 +12,7 @@
|
||||
"ClickableWidgetAccessor",
|
||||
"ClientPlayerEntityMixin",
|
||||
"CreativeInventoryScreenAccessor",
|
||||
"CursorMixin",
|
||||
"DrawContextAccessor",
|
||||
"GameOptionsScreenMixin",
|
||||
"GameRendererMixin",
|
||||
@@ -20,6 +21,7 @@
|
||||
"InputUtilMixin",
|
||||
"KeyBindingIDAccessor",
|
||||
"KeyBindingMixin",
|
||||
"KeyboardAccessor",
|
||||
"KeyboardMixin",
|
||||
"MinecraftClientMixin",
|
||||
"MouseAccessor",
|
||||
|
||||