mirror of
https://github.com/CompeyDev/elytra-lock-fabric.git
synced 2025-05-04 10:43:46 +01:00
feat: update to 1.21.4
* Updates the mod to support Minecraft v1.21.4 * Updated dependencies to more recent versions * Bumped minimum loader requirement to fabric v0.16.3 and API requirement to fabric-api v0.119.2 * Bumped gradle to v8.13 and fabric-loom to v1.10 * Changed HUD rendering logic to use `HudLayerRegistrationCallback` instead of the deprecated `HudRenderCallback` interface * Update method name for fall flying prevention injection method
This commit is contained in:
parent
ccd3c00ff5
commit
247e3c611c
9 changed files with 38 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.10-SNAPSHOT'
|
||||||
id "com.modrinth.minotaur" version "2.+"
|
id "com.modrinth.minotaur" version "2.+"
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.21
|
minecraft_version=1.21.4
|
||||||
yarn_mappings=1.21+build.9
|
yarn_mappings=1.21.4+build.8
|
||||||
loader_version=0.15.11
|
loader_version=0.16.13
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.1.2
|
mod_version=0.1.2
|
||||||
|
@ -14,6 +14,6 @@ maven_group=xyz.devcomp
|
||||||
archives_base_name=elytra-lock
|
archives_base_name=elytra-lock
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.102.0+1.21
|
fabric_version=0.119.2+1.21.4
|
||||||
yacl_version=3.5.0+1.21-fabric
|
yacl_version=3.6.6+1.21.4-fabric
|
||||||
modmenu_version=11.0.1
|
modmenu_version=13.0.3
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
8
gradlew
vendored
8
gradlew
vendored
|
@ -15,6 +15,8 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
|
@ -55,7 +57,7 @@
|
||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
@ -84,7 +86,7 @@ done
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -203,7 +205,7 @@ fi
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command:
|
# Collect all arguments for the java command:
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# and any embedded shellness will be escaped.
|
# and any embedded shellness will be escaped.
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# treated as '${Hostname}' itself on the command line.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
|
@ -13,6 +13,8 @@
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
package xyz.devcomp.elytralock;
|
package xyz.devcomp.elytralock;
|
||||||
|
|
||||||
import xyz.devcomp.elytralock.config.ConfigHandler;
|
|
||||||
import xyz.devcomp.elytralock.config.ConfigUtil;
|
|
||||||
import xyz.devcomp.elytralock.events.ClientExitHandler;
|
|
||||||
import xyz.devcomp.elytralock.events.ClientTickEndHandler;
|
|
||||||
import xyz.devcomp.elytralock.events.HudRenderHandler;
|
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -15,13 +8,18 @@ import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
import net.fabricmc.fabric.api.client.rendering.v1.HudLayerRegistrationCallback;
|
||||||
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.option.KeyBinding;
|
import net.minecraft.client.option.KeyBinding;
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
|
||||||
|
import xyz.devcomp.elytralock.config.ConfigHandler;
|
||||||
|
import xyz.devcomp.elytralock.config.ConfigUtil;
|
||||||
|
import xyz.devcomp.elytralock.events.ClientExitHandler;
|
||||||
|
import xyz.devcomp.elytralock.events.ClientTickEndHandler;
|
||||||
|
import xyz.devcomp.elytralock.events.HudRenderHandler;
|
||||||
|
|
||||||
public class ElytraLock implements ClientModInitializer {
|
public class ElytraLock implements ClientModInitializer {
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger("Elytra Lock");
|
public static final Logger LOGGER = LoggerFactory.getLogger("Elytra Lock");
|
||||||
public static final FabricLoader LOADER = FabricLoader.getInstance();
|
public static final FabricLoader LOADER = FabricLoader.getInstance();
|
||||||
|
@ -48,7 +46,7 @@ public class ElytraLock implements ClientModInitializer {
|
||||||
LOGGER.warn("YACL_v3 is not loaded, not persisting elytra toggle");
|
LOGGER.warn("YACL_v3 is not loaded, not persisting elytra toggle");
|
||||||
}
|
}
|
||||||
|
|
||||||
HudRenderCallback.EVENT.register(new HudRenderHandler());
|
HudLayerRegistrationCallback.EVENT.register(new HudRenderHandler());
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(new ClientTickEndHandler());
|
ClientTickEvents.END_CLIENT_TICK.register(new ClientTickEndHandler());
|
||||||
ClientLifecycleEvents.CLIENT_STOPPING.register(new ClientExitHandler());
|
ClientLifecycleEvents.CLIENT_STOPPING.register(new ClientExitHandler());
|
||||||
LOGGER.info("Registered HUD_RENDER, END_CLIENT_TICK and CLIENT_STOPPING events successfully!");
|
LOGGER.info("Registered HUD_RENDER, END_CLIENT_TICK and CLIENT_STOPPING events successfully!");
|
||||||
|
|
|
@ -1,21 +1,28 @@
|
||||||
package xyz.devcomp.elytralock.events;
|
package xyz.devcomp.elytralock.events;
|
||||||
|
|
||||||
import xyz.devcomp.elytralock.ElytraLock;
|
import net.fabricmc.fabric.api.client.rendering.v1.HudLayerRegistrationCallback;
|
||||||
|
import net.fabricmc.fabric.api.client.rendering.v1.IdentifiedLayer;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
import net.fabricmc.fabric.api.client.rendering.v1.LayeredDrawerWrapper;
|
||||||
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.RenderLayer;
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
import net.minecraft.client.util.Window;
|
import net.minecraft.client.util.Window;
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import xyz.devcomp.elytralock.ElytraLock;
|
||||||
|
|
||||||
public class HudRenderHandler implements HudRenderCallback {
|
public class HudRenderHandler implements HudLayerRegistrationCallback {
|
||||||
public static final int WIDTH = 16;
|
public static final int WIDTH = 16;
|
||||||
public static final int HEIGHT = 16;
|
public static final int HEIGHT = 16;
|
||||||
|
private static final Identifier LAYER_ID = Identifier.of("elytralock", "toggle-status-indicator");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHudRender(DrawContext context, RenderTickCounter tickCounter) {
|
public void register(LayeredDrawerWrapper layeredDrawer) {
|
||||||
|
layeredDrawer.attachLayerBefore(IdentifiedLayer.CHAT, LAYER_ID, HudRenderHandler::render);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void render(DrawContext context, RenderTickCounter tickCounter) {
|
||||||
if (!MinecraftClient.isHudEnabled())
|
if (!MinecraftClient.isHudEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -32,6 +39,7 @@ public class HudRenderHandler implements HudRenderCallback {
|
||||||
Window window = ElytraLock.client.getWindow();
|
Window window = ElytraLock.client.getWindow();
|
||||||
int width = window.getScaledWidth(), height = window.getScaledHeight();
|
int width = window.getScaledWidth(), height = window.getScaledHeight();
|
||||||
|
|
||||||
context.drawTexture(icon, (width / 2) + offset, height - HEIGHT - 3, 0, 0, WIDTH, HEIGHT, WIDTH, HEIGHT);
|
context.drawTexture(RenderLayer::getGuiTextured, icon, (width / 2) + offset, height - HEIGHT - 3, 0, 0, WIDTH,
|
||||||
|
HEIGHT, WIDTH, HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ public class PlayerEntityMixin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@Inject(method = "checkFallFlying()Z", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "checkGliding()Z", at = @At("HEAD"), cancellable = true)
|
||||||
private void preventFallFlying(CallbackInfoReturnable<Boolean> info) {
|
private void preventFallFlying(CallbackInfoReturnable<Boolean> info) {
|
||||||
if (logOnce.run("Elytra is locked, so preventing fall flying"))
|
if (logOnce.run("Elytra is locked, so preventing fall flying"))
|
||||||
info.setReturnValue(false);
|
info.setReturnValue(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue