Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compat with 1.21.4 #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.7.2'
id 'fabric-loom' version '1.9.2'
}

group 'me.lunaluna.elytra-recast'
Expand Down
10 changes: 5 additions & 5 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Fabric
minecraft_version=1.21
yarn_mappings=1.21+build.7
loader_version=0.15.11
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.8
loader_version=0.16.10
# Dependencies
mod_menu_version=11.0.1
cloth_config_version=15.0.127
mod_menu_version=13.0.2
cloth_config_version=17.0.144
# Libraries
gson_version=2.9.0
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ElytraItem;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;

Expand All @@ -20,18 +19,18 @@ public static boolean castElytra(ClientPlayerEntity player) {
}

public static boolean checkElytra(ClientPlayerEntity player) {
if (player.input.jumping && !player.getAbilities().flying && !player.hasVehicle() && !player.isClimbing()) {
if (player.input.playerInput.jump() && !player.getAbilities().flying && !player.hasVehicle() && !player.isClimbing()) {
var itemStack = player.getEquippedStack(EquipmentSlot.CHEST);
return itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack);
return itemStack.isOf(Items.ELYTRA);
} else
return false;
}

public static boolean checkFallFlyingIgnoreGround(ClientPlayerEntity player) {
if (!player.isTouchingWater() && !player.hasStatusEffect(StatusEffects.LEVITATION)) {
var itemStack = player.getEquippedStack(EquipmentSlot.CHEST);
if (itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ElytraItem is gone I didn't try hard to find a replacement for the ElytraItem.isUsable call removing it seemed fine enough.

player.startFallFlying();
if (itemStack.isOf(Items.ELYTRA)) {
player.startGliding();
return true;
} else
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ private ClientPlayerEntity player() {
private boolean awaitingElytra = false;

@SuppressWarnings("ConstantConditions")
@Inject(method = "tickFallFlying", at = @At("TAIL"))
@Inject(method = "tickMovement", at = @At("TAIL"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is a tickGliding that replaced tickFallFlying but it doesn't work at all as you never get a gliding tick that would have isGliding as false. So I opted for tickMovement which seems to work but is obviously far less efficient.

public void recastIfLanded(CallbackInfo ci) {
if (player() == null || !((Object) this instanceof ClientPlayerEntity))
return;
boolean elytra = isFallFlying();
boolean elytra = isGliding();
if (awaitingElytra) {
if (elytra)
awaitingElytra = false;
} else if (!elytra && previousElytra) {
MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.ITEM_ELYTRA_FLYING.getId(),
MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.ITEM_ELYTRA_FLYING.id(),
SoundCategory.PLAYERS);
ElytraHelper.castElytra(player());
awaitingElytra = ElytraHelper.checkElytra(player());
Expand All @@ -47,5 +47,5 @@ public void recastIfLanded(CallbackInfo ci) {
}

@Shadow
public abstract boolean isFallFlying();
public abstract boolean isGliding();
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gradle Memory
org.gradle.jvmargs=-Xmx1G
# Mod Properties
mod_version=2.5.1
mod_version=2.6.0
maven_group=me.lunaluna
archives_base_name=elytra-recast
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down