Compare commits

..

No commits in common. "e9e0d559214dfa36efb64380918aff3fa8930ac6" and "ccd3c00ff5a6770db3bbcfe13dd5597131b6faf9" have entirely different histories.

9 changed files with 28 additions and 38 deletions

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.10-SNAPSHOT' id 'fabric-loom' version '1.6-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+" id "com.modrinth.minotaur" version "2.+"
id 'maven-publish' id 'maven-publish'
} }

View file

@ -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.4 minecraft_version=1.21
yarn_mappings=1.21.4+build.8 yarn_mappings=1.21+build.9
loader_version=0.16.13 loader_version=0.15.11
# 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.119.2+1.21.4 fabric_version=0.102.0+1.21
yacl_version=3.6.6+1.21.4-fabric yacl_version=3.5.0+1.21-fabric
modmenu_version=13.0.3 modmenu_version=11.0.1

Binary file not shown.

View file

@ -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.12-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

8
gradlew vendored
View file

@ -15,8 +15,6 @@
# 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
#
############################################################################## ##############################################################################
# #
@ -57,7 +55,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/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/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/.
@ -86,7 +84,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 -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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
@ -205,7 +203,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, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_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
View file

@ -13,8 +13,6 @@
@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 ##########################################################################

View file

@ -1,6 +1,13 @@
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;
@ -8,18 +15,13 @@ 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.HudLayerRegistrationCallback; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
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();
@ -46,7 +48,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");
} }
HudLayerRegistrationCallback.EVENT.register(new HudRenderHandler()); HudRenderCallback.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!");

View file

@ -1,28 +1,21 @@
package xyz.devcomp.elytralock.events; package xyz.devcomp.elytralock.events;
import net.fabricmc.fabric.api.client.rendering.v1.HudLayerRegistrationCallback; import xyz.devcomp.elytralock.ElytraLock;
import net.fabricmc.fabric.api.client.rendering.v1.IdentifiedLayer;
import net.fabricmc.fabric.api.client.rendering.v1.LayeredDrawerWrapper; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
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 HudLayerRegistrationCallback { public class HudRenderHandler implements HudRenderCallback {
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 register(LayeredDrawerWrapper layeredDrawer) { public void onHudRender(DrawContext context, RenderTickCounter tickCounter) {
layeredDrawer.attachLayerAfter(IdentifiedLayer.HOTBAR_AND_BARS, LAYER_ID, HudRenderHandler::render);
}
private static void render(DrawContext context, RenderTickCounter tickCounter) {
if (!MinecraftClient.isHudEnabled()) if (!MinecraftClient.isHudEnabled())
return; return;
@ -39,7 +32,6 @@ public class HudRenderHandler implements HudLayerRegistrationCallback {
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(RenderLayer::getGuiTextured, icon, (width / 2) + offset, height - HEIGHT - 3, 0, 0, WIDTH, context.drawTexture(icon, (width / 2) + offset, height - HEIGHT - 3, 0, 0, WIDTH, HEIGHT, WIDTH, HEIGHT);
HEIGHT, WIDTH, HEIGHT);
} }
} }

View file

@ -25,7 +25,7 @@ public class PlayerEntityMixin {
} }
}); });
@Inject(method = "checkGliding()Z", at = @At("HEAD"), cancellable = true) @Inject(method = "checkFallFlying()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);