-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Rule:
mountingFlyingTooLongFix
back for 1.18 compat
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...in/java/carpetfixes/mixins/playerFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package carpetfixes.mixins.playerFixes; | ||
|
||
import carpetfixes.CFSettings; | ||
import carpetfixes.settings.ModIds; | ||
import carpetfixes.settings.VersionPredicates; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; | ||
import net.minecraft.server.network.ServerPlayNetworkHandler; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Restriction(require = @Condition(value = ModIds.MINECRAFT, versionPredicates = VersionPredicates.LT_22w03a)) | ||
@Mixin(ServerPlayNetworkHandler.class) | ||
public class ServerPlayNetworkHandler_vehicleFloatingMixin { | ||
|
||
/** | ||
* Players can get kicked for flying by mounting an entity after jumping, this is | ||
* because the server does not realize that players mounting an entity means they | ||
* are no longer jumping. So this fix is as simple as telling the server | ||
* that if they are riding an entity, they should not be considered floating. | ||
*/ | ||
|
||
|
||
@Shadow | ||
private boolean floating; | ||
|
||
@Shadow | ||
public ServerPlayerEntity player; | ||
|
||
|
||
@Inject( | ||
method = "onVehicleMove(Lnet/minecraft/network/packet/c2s/play/VehicleMoveC2SPacket;)V", | ||
at = @At("RETURN") | ||
) | ||
public void IfVehicleMovedPlayerNotFlying(VehicleMoveC2SPacket packet, CallbackInfo ci) { | ||
if (CFSettings.mountingFlyingTooLongFix && this.player.hasVehicle() && this.player.getVehicle() != this.player) | ||
this.floating = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters