Skip to content

Commit

Permalink
Fixed compact with baritone
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Nov 20, 2023
1 parent 7c79145 commit 10b4633
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,6 @@ public boolean removeVehicleRequirement(ClientPlayerEntity instance) {
return instance.hasVehicle();
}

@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;checkFallFlying()Z"))
public boolean makeElytraMovementServerside(ClientPlayerEntity instance) {
// Elytra movement was serverside in <= 1.14.4 and got moved to the client in 1.15
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) {
return !this.isOnGround() && this.getVelocity().y < 0.0 && !isFallFlying();
}
return instance.checkFallFlying();
}

@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isClimbing()Z"))
public boolean removeLadderCheck(ClientPlayerEntity instance) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_1)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;

import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.*;
import net.minecraft.util.Hand;
import net.raphimc.vialoader.util.VersionEnum;
Expand Down Expand Up @@ -133,4 +134,12 @@ public boolean useOldField(PlayerEntity instance) {
}
return instance.isSprinting();
}

@Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true)
public void makeElytraMovementServerside(CallbackInfoReturnable<Boolean> cir) {
// Elytra movement was serverside in <= 1.14.4 and got moved to the client in 1.15
if ((Object) this instanceof ClientPlayerEntity && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) {
cir.setReturnValue(!this.isOnGround() && this.getVelocity().y < 0.0 && !isFallFlying());
}
}
}

0 comments on commit 10b4633

Please sign in to comment.