Files
NeoForge/patches/net/minecraft/client/player/LocalPlayer.java.patch
T
b160270bd5 Port to 26.3 (#3403)
Co-authored-by: XFactHD <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: sciwhiz12 <[email protected]>
Co-authored-by: Matyrobbrt <[email protected]>
Co-authored-by: Marc Hermans <[email protected]>
Co-authored-by: Sara Freimer <[email protected]>
2026-09-16 03:08:09 +08:00

59 lines
3.0 KiB
Diff

--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -560,7 +_,14 @@
@Override
public void playSound(SoundEvent sound, float volume, float pitch) {
- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), volume, pitch, false);
+ net.minecraft.core.Holder<SoundEvent> holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(sound);
+ net.neoforged.neoforge.event.PlayLevelSoundEvent.AtEntity event = net.neoforged.neoforge.event.EventHooks.onPlaySoundAtEntity(this, holder, this.getSoundSource(), volume, pitch);
+ if (event.isCanceled() || event.getSound() == null) return;
+ sound = event.getSound().value();
+ SoundSource source = event.getSource();
+ volume = event.getNewVolume();
+ pitch = event.getNewPitch();
+ this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), sound, source, volume, pitch, false);
}
@Override
@@ -803,6 +_,7 @@
&& this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING)
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
this.input.tick();
+ net.neoforged.neoforge.client.ClientHooks.onMovementInputUpdate(this, this.input);
this.minecraft.getTutorial().onInput(this.input);
boolean wasAutoJump = false;
if (this.autoJumpTime > 0) {
@@ -847,7 +_,7 @@
}
boolean justToggledCreativeFlight = false;
- if (abilities.mayfly) {
+ if (this.mayFly()) {
if (this.minecraft.gameMode.isSpectator()) {
if (!abilities.flying) {
abilities.flying = true;
@@ -944,7 +_,7 @@
}
private boolean shouldStopSwimSprinting() {
- return !this.isSprintingPossible(true) || !this.isInWater() || !this.input.hasForwardImpulse() && !this.onGround() && !this.input.keyPresses.shift();
+ return !this.isSprintingPossible(true) || !(this.isInWater() || this.getFluidInteraction().isInFluidMatching(this, (entity, fluidType, _) -> entity.canSwimInFluidType(fluidType))) || !this.input.hasForwardImpulse() && !this.onGround() && !this.input.keyPresses.shift();
}
public Portal.Transition getActivePortalLocalTransition() {
@@ -999,6 +_,13 @@
public float getSpinningEffectAngle(float partialTick) {
return this.spinningEffectTime + partialTick * this.spinningEffectSpeed;
+ }
+
+ @Override
+ protected boolean canGlide() {
+ // Neo: Override canGlide for the client to check if it is connected to a neo forge server, and if not then fall back to checking the worn items.
+ // This way when Player#tryToStartFallFlying is called, on the client, it is able to check for the vanilla components on equipped items
+ return !getAbilities().flying && canGlide(connection.getConnectionType().isNeoForge());
}
@Override