mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
Port to 1.21
This commit is contained in:
109
build.gradle
109
build.gradle
@@ -3,14 +3,11 @@ plugins {
|
|||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||||
id 'com.modrinth.minotaur' version '2.+'
|
id "me.shedaniel.unified-publishing" version "0.1.+"
|
||||||
id 'net.darkhax.curseforgegradle' version '1.+'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
import net.darkhax.curseforgegradle.TaskPublishCurseForge
|
|
||||||
|
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
version = "${project.mod_version}+${getMCVersionString()}"
|
version = "${project.mod_version}+${project.minecraft_version}"
|
||||||
|
|
||||||
// This field defines the Java version your mod target.
|
// This field defines the Java version your mod target.
|
||||||
def targetJavaVersion = 21
|
def targetJavaVersion = 21
|
||||||
@@ -20,30 +17,6 @@ boolean isMCVersionNonRelease() {
|
|||||||
|| project.minecraft_version.matches('\\d+\\.\\d+-(pre|rc)(\\d+)')
|
|| project.minecraft_version.matches('\\d+\\.\\d+-(pre|rc)(\\d+)')
|
||||||
}
|
}
|
||||||
|
|
||||||
String getMCVersionString() {
|
|
||||||
return project.minecraft_version
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean pingUrl(String address) {
|
|
||||||
try {
|
|
||||||
def conn = (HttpURLConnection) new URL(address).openConnection()
|
|
||||||
int responseCode = conn.getResponseCode()
|
|
||||||
return (200 <= responseCode && responseCode <= 399)
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String parseReadme() {
|
|
||||||
def excludeRegex = /(?m)<!-- modrinth_exclude\.start -->(.|\n)*?<!-- modrinth_exclude\.end -->/
|
|
||||||
def linkRegex = /!\[([A-z_ ]+)]\((images\/[A-z.\/_]+)\)/
|
|
||||||
|
|
||||||
def readme = (String) file('README.md').text
|
|
||||||
readme = readme.replaceAll(excludeRegex, '')
|
|
||||||
return readme
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -144,39 +117,55 @@ processResources {
|
|||||||
expand 'version': project.version
|
expand 'version': project.version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
modrinth {
|
|
||||||
token = System.getenv("MODRINTH_TOKEN") // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private!
|
ext {
|
||||||
projectId = project.archives_base_name // This can be the project ID or the slug. Either will work!
|
releaseChangelog = {
|
||||||
versionNumber = project.version // You don't need to set this manually. Will fail if Modrinth has this version already
|
def changes = new StringBuilder()
|
||||||
versionName = "MidnightControls " + project.mod_version + " - " + project.minecraft_version
|
changes << "## MidnightControls v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/MidnightControls/commits/)"
|
||||||
versionType = isMCVersionNonRelease() ? "beta" : "release" // Can also be `beta` or `alpha`
|
def proc = "git log --max-count=1 --pretty=format:%s".execute()
|
||||||
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
|
proc.in.eachLine { line ->
|
||||||
gameVersions = [(String) project.minecraft_version] // Must be an array, even with only one version
|
def processedLine = line.toString()
|
||||||
loaders = ["fabric","quilt"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
|
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
|
||||||
dependencies { // A special DSL for creating dependencies
|
changes << "\n- ${processedLine.capitalize()}"
|
||||||
// scope.type
|
}
|
||||||
// The scope can be `required`, `optional`, `incompatible`, or `embedded`
|
}
|
||||||
// The type can either be `project` or `version`
|
proc.waitFor()
|
||||||
required.project "midnightlib" // Creates a new required dependency on MidnightLib
|
return changes.toString()
|
||||||
}
|
}
|
||||||
changelog = project.changelog
|
|
||||||
}
|
}
|
||||||
tasks.register('publishCurseForge', TaskPublishCurseForge) {
|
|
||||||
|
|
||||||
// This token is used to authenticate with CurseForge. It should be handled
|
unifiedPublishing {
|
||||||
// with the same level of care and security as your actual password. You
|
project {
|
||||||
// should never share your token with an untrusted source or publish it
|
displayName = "MidnightControls v$project.version - Fabric $project.minecraft_version"
|
||||||
// publicly to GitHub or embed it within a project. The best practice is to
|
releaseType = "$project.release_type"
|
||||||
// store this token in an environment variable or a build secret.
|
changelog = releaseChangelog()
|
||||||
apiToken = System.getenv("CURSEFORGE_TOKEN")
|
gameVersions = []
|
||||||
|
gameLoaders = ["fabric","quilt"]
|
||||||
|
mainPublication remapJar
|
||||||
|
relations {
|
||||||
|
includes {
|
||||||
|
curseforge = "midnightlib"
|
||||||
|
modrinth = "midnightlib"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Tells CurseForgeGradle to publish the output of the jar task. This will
|
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
||||||
// return a UploadArtifact object that can be used to further configure the
|
if (CURSEFORGE_TOKEN != null) {
|
||||||
// file.
|
curseforge {
|
||||||
def mainFile = upload(project.curseforge_id, remapJar)
|
token = CURSEFORGE_TOKEN
|
||||||
mainFile.changelog = project.changelog
|
id = rootProject.curseforge_id
|
||||||
mainFile.displayName = "MidnightControls " + project.mod_version + " - " + project.minecraft_version
|
gameVersions.addAll "Java 21", project.minecraft_version
|
||||||
mainFile.addModLoader("Fabric", "Quilt")
|
}
|
||||||
mainFile.addRequirement("midnightlib")
|
}
|
||||||
mainFile.releaseType = "release"
|
|
||||||
|
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
||||||
|
if (MODRINTH_TOKEN != null) {
|
||||||
|
modrinth {
|
||||||
|
token = MODRINTH_TOKEN
|
||||||
|
id = rootProject.modrinth_id
|
||||||
|
version = "$project.version"
|
||||||
|
gameVersions.addAll project.minecraft_version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,24 +3,24 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.20.5
|
minecraft_version=1.21
|
||||||
yarn_mappings=1.20.5+build.1
|
yarn_mappings=1.21+build.1
|
||||||
loader_version=0.15.10
|
loader_version=0.15.11
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.9.5
|
mod_version = 1.9.6
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = midnightcontrols
|
archives_base_name = midnightcontrols
|
||||||
|
release_type=beta
|
||||||
modrinth_id = bXX9h73M
|
modrinth_id = bXX9h73M
|
||||||
curseforge_id = 621768
|
curseforge_id = 621768
|
||||||
changelog = See changes at: https://github.com/TeamMidnightDust/MidnightControls/commits/
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.97.7+1.20.5
|
fabric_version=0.100.1+1.21
|
||||||
sodium_version=mc1.19.2-0.4.4
|
sodium_version=mc1.19.2-0.4.4
|
||||||
spruceui_version=5.0.3+1.20.4
|
spruceui_version=5.0.3+1.20.4
|
||||||
midnightlib_version=1.5.4-fabric
|
midnightlib_version=1.5.7-fabric
|
||||||
modmenu_version=10.0.0-beta.1
|
modmenu_version=10.0.0-beta.1
|
||||||
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
||||||
bendylib_version=2.0.+
|
bendylib_version=2.0.+
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ pluginManagement {
|
|||||||
name 'Fabric'
|
name 'Fabric'
|
||||||
url 'https://maven.fabricmc.net/'
|
url 'https://maven.fabricmc.net/'
|
||||||
}
|
}
|
||||||
|
maven { url "https://maven.architectury.dev/" }
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,20 +13,13 @@ import eu.midnightdust.midnightcontrols.event.PlayerChangeControlsModeCallback;
|
|||||||
import eu.midnightdust.midnightcontrols.packet.ControlsModePacket;
|
import eu.midnightdust.midnightcontrols.packet.ControlsModePacket;
|
||||||
import eu.midnightdust.midnightcontrols.packet.FeaturePacket;
|
import eu.midnightdust.midnightcontrols.packet.FeaturePacket;
|
||||||
import eu.midnightdust.midnightcontrols.packet.HelloPacket;
|
import eu.midnightdust.midnightcontrols.packet.HelloPacket;
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
|
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.fabricmc.loader.api.ModContainer;
|
|
||||||
import net.minecraft.network.PacketByteBuf;
|
|
||||||
import net.minecraft.network.packet.CustomPayload;
|
import net.minecraft.network.packet.CustomPayload;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the MidnightControls mod.
|
* Represents the MidnightControls mod.
|
||||||
@@ -37,9 +30,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
public class MidnightControls implements ModInitializer {
|
public class MidnightControls implements ModInitializer {
|
||||||
private static MidnightControls INSTANCE;
|
private static MidnightControls INSTANCE;
|
||||||
public static final CustomPayload.Id<CustomPayload> CONTROLS_MODE_CHANNEL = CustomPayload.id(MidnightControlsConstants.CONTROLS_MODE_CHANNEL.toString());
|
public static final CustomPayload.Id<CustomPayload> CONTROLS_MODE_CHANNEL = new CustomPayload.Id<>(MidnightControlsConstants.CONTROLS_MODE_CHANNEL);
|
||||||
public static final CustomPayload.Id<CustomPayload> FEATURE_CHANNEL = CustomPayload.id(MidnightControlsConstants.FEATURE_CHANNEL.toString());
|
public static final CustomPayload.Id<CustomPayload> FEATURE_CHANNEL = new CustomPayload.Id<>(MidnightControlsConstants.FEATURE_CHANNEL);
|
||||||
public static final CustomPayload.Id<CustomPayload> HELLO_CHANNEL = CustomPayload.id(MidnightControlsConstants.HELLO_CHANNEL.toString());
|
public static final CustomPayload.Id<CustomPayload> HELLO_CHANNEL = new CustomPayload.Id<>(MidnightControlsConstants.HELLO_CHANNEL);
|
||||||
public static boolean isExtrasLoaded;
|
public static boolean isExtrasLoaded;
|
||||||
|
|
||||||
public final Logger logger = LogManager.getLogger("MidnightControls");
|
public final Logger logger = LogManager.getLogger("MidnightControls");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import net.minecraft.util.Identifier;
|
|||||||
*/
|
*/
|
||||||
public class MidnightControlsConstants {
|
public class MidnightControlsConstants {
|
||||||
public static final String NAMESPACE = "midnightcontrols";
|
public static final String NAMESPACE = "midnightcontrols";
|
||||||
public static final Identifier CONTROLS_MODE_CHANNEL = new Identifier(NAMESPACE, "controls_mode");
|
public static final Identifier CONTROLS_MODE_CHANNEL = Identifier.of(NAMESPACE, "controls_mode");
|
||||||
public static final Identifier FEATURE_CHANNEL = new Identifier(NAMESPACE, "feature");
|
public static final Identifier FEATURE_CHANNEL = Identifier.of(NAMESPACE, "feature");
|
||||||
public static final Identifier HELLO_CHANNEL = new Identifier("lambdacontrols", "hello");
|
public static final Identifier HELLO_CHANNEL = Identifier.of(NAMESPACE, "hello");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,20 +64,20 @@ import java.util.*;
|
|||||||
public class MidnightControlsClient extends MidnightControls implements ClientModInitializer {
|
public class MidnightControlsClient extends MidnightControls implements ClientModInitializer {
|
||||||
public static boolean lateInitDone = false;
|
public static boolean lateInitDone = false;
|
||||||
private static MidnightControlsClient INSTANCE;
|
private static MidnightControlsClient INSTANCE;
|
||||||
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_up"),
|
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(Identifier.of(MidnightControlsConstants.NAMESPACE, "look_up"),
|
||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.movement");
|
||||||
public static final KeyBinding BINDING_LOOK_RIGHT = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_right"),
|
public static final KeyBinding BINDING_LOOK_RIGHT = InputManager.makeKeyBinding(Identifier.of(MidnightControlsConstants.NAMESPACE, "look_right"),
|
||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_6, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_6, "key.categories.movement");
|
||||||
public static final KeyBinding BINDING_LOOK_DOWN = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_down"),
|
public static final KeyBinding BINDING_LOOK_DOWN = InputManager.makeKeyBinding(Identifier.of(MidnightControlsConstants.NAMESPACE, "look_down"),
|
||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, "key.categories.movement");
|
||||||
public static final KeyBinding BINDING_LOOK_LEFT = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_left"),
|
public static final KeyBinding BINDING_LOOK_LEFT = InputManager.makeKeyBinding(Identifier.of(MidnightControlsConstants.NAMESPACE, "look_left"),
|
||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, "key.categories.movement");
|
||||||
public static final KeyBinding BINDING_RING = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "ring"),
|
public static final KeyBinding BINDING_RING = InputManager.makeKeyBinding(Identifier.of(MidnightControlsConstants.NAMESPACE, "ring"),
|
||||||
InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.categories.misc");
|
InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.categories.misc");
|
||||||
public static final Identifier CONTROLLER_BUTTONS = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_buttons.png");
|
public static final Identifier CONTROLLER_BUTTONS = Identifier.of(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_buttons.png");
|
||||||
public static final Identifier CONTROLLER_EXPANDED = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_expanded.png");
|
public static final Identifier CONTROLLER_EXPANDED = Identifier.of(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_expanded.png");
|
||||||
public static final Identifier CONTROLLER_AXIS = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_axis.png");
|
public static final Identifier CONTROLLER_AXIS = Identifier.of(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_axis.png");
|
||||||
public static final Identifier CURSOR_TEXTURE = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/cursor.png");
|
public static final Identifier CURSOR_TEXTURE = Identifier.of(MidnightControlsConstants.NAMESPACE, "textures/gui/cursor.png");
|
||||||
public final static File MAPPINGS_FILE = new File("config/gamecontrollercustommappings.txt");
|
public final static File MAPPINGS_FILE = new File("config/gamecontrollercustommappings.txt");
|
||||||
public final MidnightInput input = new MidnightInput();
|
public final MidnightInput input = new MidnightInput();
|
||||||
public final MidnightRing ring = new MidnightRing(this);
|
public final MidnightRing ring = new MidnightRing(this);
|
||||||
@@ -137,8 +137,8 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
|
|
||||||
HudManager.register(this.hud = new MidnightControlsHud(this));
|
HudManager.register(this.hud = new MidnightControlsHud(this));
|
||||||
FabricLoader.getInstance().getModContainer("midnightcontrols").ifPresent(modContainer -> {
|
FabricLoader.getInstance().getModContainer("midnightcontrols").ifPresent(modContainer -> {
|
||||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("midnightcontrols","bedrock"), modContainer, ResourcePackActivationType.NORMAL);
|
ResourceManagerHelper.registerBuiltinResourcePack(Identifier.of("midnightcontrols","bedrock"), modContainer, ResourcePackActivationType.NORMAL);
|
||||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("midnightcontrols","legacy"), modContainer, ResourcePackActivationType.NORMAL);
|
ResourceManagerHelper.registerBuiltinResourcePack(Identifier.of("midnightcontrols","legacy"), modContainer, ResourcePackActivationType.NORMAL);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
|
|||||||
import eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay;
|
import eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay;
|
||||||
import eu.midnightdust.midnightcontrols.client.mixin.*;
|
import eu.midnightdust.midnightcontrols.client.mixin.*;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||||
import net.fabricmc.fabric.impl.client.itemgroup.CreativeGuiExtensions;
|
|
||||||
import net.fabricmc.fabric.impl.client.itemgroup.FabricCreativeGuiComponents;
|
|
||||||
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroup;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.TitleScreen;
|
import net.minecraft.client.gui.screen.TitleScreen;
|
||||||
@@ -64,11 +61,7 @@ public class InputHandlers {
|
|||||||
private InputHandlers() {
|
private InputHandlers() {
|
||||||
}
|
}
|
||||||
private static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
|
private static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
|
||||||
return ItemGroups.getGroups().stream()
|
return (screen.getItemGroupsOnPage(screen.getCurrentPage()));
|
||||||
.filter(itemGroup -> {
|
|
||||||
if (FabricCreativeGuiComponents.COMMON_GROUPS.contains(itemGroup)) return true;
|
|
||||||
return ((CreativeGuiExtensions)screen).fabric_currentPage() == ((FabricItemGroup)itemGroup).getPage() && itemGroup.shouldDisplay();
|
|
||||||
}).toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PressAction handleHotbar(boolean next) {
|
public static PressAction handleHotbar(boolean next) {
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ public class InputManager {
|
|||||||
public void updateMousePosition(@NotNull MinecraftClient client) {
|
public void updateMousePosition(@NotNull MinecraftClient client) {
|
||||||
Objects.requireNonNull(client, "Client instance cannot be null.");
|
Objects.requireNonNull(client, "Client instance cannot be null.");
|
||||||
if (this.prevTargetMouseX != this.targetMouseX || this.prevTargetMouseY != this.targetMouseY) {
|
if (this.prevTargetMouseX != this.targetMouseX || this.prevTargetMouseY != this.targetMouseY) {
|
||||||
double mouseX = this.prevTargetMouseX + (this.targetMouseX - this.prevTargetMouseX) * client.getTickDelta() + 0.5;
|
double mouseX = this.prevTargetMouseX + (this.targetMouseX - this.prevTargetMouseX) * client.getRenderTickCounter().getTickDelta(true) + 0.5;
|
||||||
double mouseY = this.prevTargetMouseY + (this.targetMouseY - this.prevTargetMouseY) * client.getTickDelta() + 0.5;
|
double mouseY = this.prevTargetMouseY + (this.targetMouseY - this.prevTargetMouseY) * client.getRenderTickCounter().getTickDelta(true) + 0.5;
|
||||||
if (!MidnightControlsConfig.virtualMouse)
|
if (!MidnightControlsConfig.virtualMouse)
|
||||||
GLFW.glfwSetCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
GLFW.glfwSetCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
||||||
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
||||||
|
|||||||
@@ -14,9 +14,18 @@ import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
|||||||
import eu.midnightdust.midnightcontrols.client.util.MathUtil;
|
import eu.midnightdust.midnightcontrols.client.util.MathUtil;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.predicate.entity.MovementPredicate;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import org.apache.commons.lang3.mutable.MutableFloat;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the movement handler.
|
* Represents the movement handler.
|
||||||
@@ -35,7 +44,7 @@ public final class MovementHandler implements PressAction {
|
|||||||
private float slowdownFactor = 1.f;
|
private float slowdownFactor = 1.f;
|
||||||
private float movementForward = 0.f;
|
private float movementForward = 0.f;
|
||||||
private float movementSideways = 0.f;
|
private float movementSideways = 0.f;
|
||||||
private MathUtil.PolarUtil polarUtil = new MathUtil.PolarUtil();
|
private final MathUtil.PolarUtil polarUtil = new MathUtil.PolarUtil();
|
||||||
|
|
||||||
private MovementHandler() {
|
private MovementHandler() {
|
||||||
}
|
}
|
||||||
@@ -81,7 +90,7 @@ public final class MovementHandler implements PressAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.slowdownFactor = client.player.shouldSlowDown() ? (MathHelper.clamp(
|
this.slowdownFactor = client.player.shouldSlowDown() ? (MathHelper.clamp(
|
||||||
0.3F + EnchantmentHelper.getSwiftSneakSpeedBoost(client.player),
|
0.3F + (float) client.player.getAttributeValue(EntityAttributes.PLAYER_SNEAKING_SPEED),
|
||||||
0.0F,
|
0.0F,
|
||||||
1.0F
|
1.0F
|
||||||
)) : 1.f;
|
)) : 1.f;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
private static boolean isCrammed = false;
|
private static boolean isCrammed = false;
|
||||||
|
|
||||||
public MidnightControlsHud(@NotNull MidnightControlsClient mod) {
|
public MidnightControlsHud(@NotNull MidnightControlsClient mod) {
|
||||||
super(new Identifier(MidnightControlsConstants.NAMESPACE, "hud/button_indicator"));
|
super(Identifier.of(MidnightControlsConstants.NAMESPACE, "hud/button_indicator"));
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -509,15 +509,14 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
float g = (float)(color.getGreen()) / 255.0F;
|
float g = (float)(color.getGreen()) / 255.0F;
|
||||||
float b = (float)(color.getBlue()) / 255.0F;
|
float b = (float)(color.getBlue()) / 255.0F;
|
||||||
float t = (float)(transparency) / 255.0F;
|
float t = (float)(transparency) / 255.0F;
|
||||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t);
|
||||||
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t);
|
||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t);
|
||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t);
|
||||||
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next();
|
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_RIGHT_Y;
|
|||||||
* Represents the touchscreen overlay
|
* Represents the touchscreen overlay
|
||||||
*/
|
*/
|
||||||
public class TouchscreenOverlay extends Screen {
|
public class TouchscreenOverlay extends Screen {
|
||||||
public static final Identifier WIDGETS_LOCATION = new Identifier("midnightcontrols", "textures/gui/widgets.png");
|
public static final Identifier WIDGETS_LOCATION = Identifier.of("midnightcontrols", "textures/gui/widgets.png");
|
||||||
private final MidnightControlsClient mod;
|
private final MidnightControlsClient mod;
|
||||||
private SilentTexturedButtonWidget inventoryButton;
|
private SilentTexturedButtonWidget inventoryButton;
|
||||||
private SilentTexturedButtonWidget swapHandsButton;
|
private SilentTexturedButtonWidget swapHandsButton;
|
||||||
@@ -168,15 +168,15 @@ public class TouchscreenOverlay extends Screen {
|
|||||||
int emoteOffset = 0;
|
int emoteOffset = 0;
|
||||||
if (PlatformFunctions.isModLoaded("emotecraft")) {
|
if (PlatformFunctions.isModLoaded("emotecraft")) {
|
||||||
emoteOffset = 10;
|
emoteOffset = 10;
|
||||||
TextIconButtonWidget emoteButton = TextIconButtonWidget.builder(Text.empty(), btn -> EmotecraftCompat.openEmotecraftScreen(this), true).width(20).texture(new Identifier(MidnightControlsConstants.NAMESPACE, "touch/emote"), 20, 20).build();
|
TextIconButtonWidget emoteButton = TextIconButtonWidget.builder(Text.empty(), btn -> EmotecraftCompat.openEmotecraftScreen(this), true).width(20).texture(Identifier.of(MidnightControlsConstants.NAMESPACE, "touch/emote"), 20, 20).build();
|
||||||
emoteButton.setPosition(scaledWidth / 2 - 30, 0);
|
emoteButton.setPosition(scaledWidth / 2 - 30, 0);
|
||||||
this.addDrawableChild(emoteButton);
|
this.addDrawableChild(emoteButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextIconButtonWidget chatButton = TextIconButtonWidget.builder(Text.empty(), btn -> this.client.setScreen(new ChatScreen("")), true).width(20).texture(new Identifier(MidnightControlsConstants.NAMESPACE, "touch/chat"), 20, 20).build();
|
TextIconButtonWidget chatButton = TextIconButtonWidget.builder(Text.empty(), btn -> this.client.setScreen(new ChatScreen("")), true).width(20).texture(Identifier.of(MidnightControlsConstants.NAMESPACE, "touch/chat"), 20, 20).build();
|
||||||
chatButton.setPosition(scaledWidth / 2 - 20 + emoteOffset, 0);
|
chatButton.setPosition(scaledWidth / 2 - 20 + emoteOffset, 0);
|
||||||
this.addDrawableChild(chatButton);
|
this.addDrawableChild(chatButton);
|
||||||
TextIconButtonWidget pauseButton = TextIconButtonWidget.builder(Text.empty(), btn -> this.pauseGame(), true).width(20).texture(new Identifier(MidnightControlsConstants.NAMESPACE, "touch/pause"), 20, 20).build();
|
TextIconButtonWidget pauseButton = TextIconButtonWidget.builder(Text.empty(), btn -> this.pauseGame(), true).width(20).texture(Identifier.of(MidnightControlsConstants.NAMESPACE, "touch/pause"), 20, 20).build();
|
||||||
pauseButton.setPosition(scaledWidth / 2 + emoteOffset, 0);
|
pauseButton.setPosition(scaledWidth / 2 + emoteOffset, 0);
|
||||||
this.addDrawableChild(pauseButton);
|
this.addDrawableChild(pauseButton);
|
||||||
// Inventory buttons.
|
// Inventory buttons.
|
||||||
@@ -291,17 +291,17 @@ public class TouchscreenOverlay extends Screen {
|
|||||||
}
|
}
|
||||||
private void initCustomButtons(boolean left) {
|
private void initCustomButtons(boolean left) {
|
||||||
assert client != null;
|
assert client != null;
|
||||||
Identifier emptySprite = new Identifier(MidnightControlsConstants.NAMESPACE, "touch/empty");
|
Identifier emptySprite = Identifier.of(MidnightControlsConstants.NAMESPACE, "touch/empty");
|
||||||
List<String> list = left ? MidnightControlsConfig.leftTouchBinds : MidnightControlsConfig.rightTouchBinds;
|
List<String> list = left ? MidnightControlsConfig.leftTouchBinds : MidnightControlsConfig.rightTouchBinds;
|
||||||
Sprite missingSprite = client.getGuiAtlasManager().getSprite(MissingSprite.getMissingSpriteId());
|
Sprite missingSprite = client.getGuiAtlasManager().getSprite(MissingSprite.getMissingSpriteId());
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
String bindName = list.get(i);
|
String bindName = list.get(i);
|
||||||
ButtonBinding binding = InputManager.getBinding(bindName);
|
ButtonBinding binding = InputManager.getBinding(bindName);
|
||||||
if (binding == null) continue;
|
if (binding == null) continue;
|
||||||
boolean hasTexture = client.getGuiAtlasManager().getSprite(new Identifier(MidnightControlsConstants.NAMESPACE, "binding/"+bindName)) != missingSprite;
|
boolean hasTexture = client.getGuiAtlasManager().getSprite(Identifier.of(MidnightControlsConstants.NAMESPACE, "binding/"+bindName)) != missingSprite;
|
||||||
if (MidnightControlsConfig.debug) System.out.println(left +" "+new Identifier(MidnightControlsConstants.NAMESPACE, "binding/"+bindName)+" "+ hasTexture);
|
if (MidnightControlsConfig.debug) System.out.println(left +" "+Identifier.of(MidnightControlsConstants.NAMESPACE, "binding/"+bindName)+" "+ hasTexture);
|
||||||
var button = TextIconButtonWidget.builder(Text.translatable(binding.getTranslationKey()), b -> binding.handle(client, 1, ButtonState.PRESS), hasTexture)
|
var button = TextIconButtonWidget.builder(Text.translatable(binding.getTranslationKey()), b -> binding.handle(client, 1, ButtonState.PRESS), hasTexture)
|
||||||
.texture(hasTexture ? new Identifier(MidnightControlsConstants.NAMESPACE, "binding/"+bindName) : emptySprite, 20, 20).dimension(20, 20).build();
|
.texture(hasTexture ? Identifier.of(MidnightControlsConstants.NAMESPACE, "binding/"+bindName) : emptySprite, 20, 20).dimension(20, 20).build();
|
||||||
button.setPosition(left ? (3+(i*23)) : this.width-(23+(i*23)), 3);
|
button.setPosition(left ? (3+(i*23)) : this.width-(23+(i*23)), 3);
|
||||||
button.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
|
button.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
|
||||||
this.addDrawableChild(button);
|
this.addDrawableChild(button);
|
||||||
|
|||||||
@@ -14,14 +14,11 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||||
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
|
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
|
||||||
import net.minecraft.client.gui.widget.OptionListWidget;
|
|
||||||
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||||
import net.minecraft.client.option.GameOptions;
|
import net.minecraft.client.option.GameOptions;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -33,15 +30,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(ControlsOptionsScreen.class)
|
@Mixin(ControlsOptionsScreen.class)
|
||||||
public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
||||||
|
|
||||||
@Shadow @Nullable private OptionListWidget optionListWidget;
|
|
||||||
|
|
||||||
public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text title) {
|
public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text title) {
|
||||||
super(parent, gameOptions, title);
|
super(parent, gameOptions, title);
|
||||||
}
|
}
|
||||||
@Unique TextIconButtonWidget button = TextIconButtonWidget.builder(Text.translatable("midnightcontrols.menu.title.controller"), (button -> this.client.setScreen(new MidnightControlsSettingsScreen(this, false))), true)
|
@Unique TextIconButtonWidget button = TextIconButtonWidget.builder(Text.translatable("midnightcontrols.menu.title.controller"), (button -> this.client.setScreen(new MidnightControlsSettingsScreen(this, false))), true)
|
||||||
.dimension(20,20).texture(new Identifier("midnightcontrols", "icon/controller"), 20, 20).build();
|
.dimension(20,20).texture(Identifier.of("midnightcontrols", "icon/controller"), 20, 20).build();
|
||||||
|
|
||||||
@Inject(at = @At("TAIL"), method = "init")
|
@Inject(at = @At("TAIL"), method = "addOptions")
|
||||||
public void midnightcontrols$onInit(CallbackInfo ci) {
|
public void midnightcontrols$onInit(CallbackInfo ci) {
|
||||||
this.midnightcontrols$setupButton();
|
this.midnightcontrols$setupButton();
|
||||||
this.addDrawableChild(button);
|
this.addDrawableChild(button);
|
||||||
@@ -54,7 +49,7 @@ public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
|||||||
}
|
}
|
||||||
@Unique
|
@Unique
|
||||||
public void midnightcontrols$setupButton() {
|
public void midnightcontrols$setupButton() {
|
||||||
assert optionListWidget != null;
|
assert body != null;
|
||||||
button.setPosition(optionListWidget.getWidth() / 2 + 158, optionListWidget.getY() + 4);
|
button.setPosition(body.getWidth() / 2 + 158, body.getY() + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import eu.midnightdust.midnightcontrols.client.touch.TouchUtils;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -34,17 +35,17 @@ public abstract class GameRendererMixin {
|
|||||||
MinecraftClient client;
|
MinecraftClient client;
|
||||||
|
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D", shift = At.Shift.BEFORE))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D", shift = At.Shift.BEFORE))
|
||||||
private void onRender(float tickDelta, long startTime, boolean fullRender, CallbackInfo ci) {
|
private void onRender(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
|
||||||
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
|
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
|
||||||
MidnightControlsClient.get().input.onPreRenderScreen(this.client, this.client.currentScreen);
|
MidnightControlsClient.get().input.onPreRenderScreen(this.client, this.client.currentScreen);
|
||||||
}
|
}
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;draw()V", shift = At.Shift.BEFORE))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;draw()V", shift = At.Shift.BEFORE))
|
||||||
private void renderVirtualCursor(float tickDelta, long startTime, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
private void renderVirtualCursor(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
||||||
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
||||||
drawContext.draw();
|
drawContext.draw();
|
||||||
}
|
}
|
||||||
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z"), method = "renderWorld")
|
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z"), method = "renderWorld")
|
||||||
private void captureProjAndModMatrix(float tickDelta, long limitTime, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrices) {
|
private void captureProjAndModMatrix(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrices) {
|
||||||
TouchUtils.lastProjMat.set(RenderSystem.getProjectionMatrix());
|
TouchUtils.lastProjMat.set(RenderSystem.getProjectionMatrix());
|
||||||
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
|
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
|
||||||
TouchUtils.lastWorldSpaceMatrix.set(matrices);
|
TouchUtils.lastWorldSpaceMatrix.set(matrices);
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ import eu.midnightdust.midnightcontrols.client.touch.TouchUtils;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.Mouse;
|
import net.minecraft.client.Mouse;
|
||||||
import net.minecraft.client.util.GlfwUtil;
|
import net.minecraft.client.util.GlfwUtil;
|
||||||
import net.minecraft.client.util.SmoothUtil;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ThrowablePotionItem;
|
import net.minecraft.item.ThrowablePotionItem;
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.util.UseAction;
|
||||||
|
import net.minecraft.util.math.Smoother;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -57,9 +57,9 @@ public abstract class MouseMixin implements MouseAccessor {
|
|||||||
|
|
||||||
@Shadow private double glfwTime;
|
@Shadow private double glfwTime;
|
||||||
|
|
||||||
@Shadow @Final private SmoothUtil cursorXSmoother;
|
@Shadow @Final private Smoother cursorXSmoother;
|
||||||
|
|
||||||
@Shadow @Final private SmoothUtil cursorYSmoother;
|
@Shadow @Final private Smoother cursorYSmoother;
|
||||||
|
|
||||||
@Shadow private boolean leftButtonClicked;
|
@Shadow private boolean leftButtonClicked;
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public abstract class WorldRendererMixin {
|
|||||||
shift = At.Shift.AFTER
|
shift = At.Shift.AFTER
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void onOutlineRender(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci, @Local MatrixStack matrices) {
|
private void onOutlineRender(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci, @Local MatrixStack matrices) {
|
||||||
if (((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.touchInControllerMode) || MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN)
|
if (((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.touchInControllerMode) || MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN)
|
||||||
&& MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
&& MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
||||||
this.renderFingerOutline(matrices, camera);
|
this.renderFingerOutline(matrices, camera);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package eu.midnightdust.midnightcontrols.client.mouse;
|
|||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.util.GlfwUtil;
|
import net.minecraft.client.util.GlfwUtil;
|
||||||
import net.minecraft.client.util.SmoothUtil;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import net.minecraft.util.math.Smoother;
|
||||||
|
|
||||||
public class EyeTrackerHandler {
|
public class EyeTrackerHandler {
|
||||||
|
|
||||||
@@ -16,8 +16,8 @@ public class EyeTrackerHandler {
|
|||||||
double lastMouseUpdateTime,
|
double lastMouseUpdateTime,
|
||||||
boolean holdingLeftMouseButton,
|
boolean holdingLeftMouseButton,
|
||||||
boolean usingLongRangedTool,
|
boolean usingLongRangedTool,
|
||||||
SmoothUtil smoothX,
|
Smoother smoothX,
|
||||||
SmoothUtil smoothY
|
Smoother smoothY
|
||||||
) {
|
) {
|
||||||
// The player wants objects of interest to be moved under the crosshair that is always center of screen.
|
// The player wants objects of interest to be moved under the crosshair that is always center of screen.
|
||||||
// Normal mouse controls operate with the delta values from the direction of mouse movement,
|
// Normal mouse controls operate with the delta values from the direction of mouse movement,
|
||||||
|
|||||||
Reference in New Issue
Block a user