取消潜行下载具

This commit is contained in:
Atsuihsio 2025-01-01 22:38:47 +08:00
parent 5be40ce195
commit a1ee630f23
2 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,34 @@
package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.VehicleEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = Player.class, priority = 1100)
public abstract class PlayerEntityMixin extends Entity {
public PlayerEntityMixin(EntityType<?> type, Level world) {
super(type, world);
}
@Inject(method = "wantsToStopRiding", at = @At("HEAD"), cancellable = true)
void shouldDismountInjection(CallbackInfoReturnable<Boolean> cir) {
if (this.getRootVehicle() instanceof VehicleEntity) {
cir.setReturnValue(false);
}
}
@Inject(method = "updatePlayerPose()V", at = @At("TAIL"))
void updatePostInjection(CallbackInfo ci) {
if (getRootVehicle() instanceof VehicleEntity) {
this.setPose(Pose.STANDING);
}
}
}

View file

@ -5,7 +5,8 @@
"refmap": "mixins.superbwarfare.refmap.json", "refmap": "mixins.superbwarfare.refmap.json",
"mixins": [ "mixins": [
"ClientboundSetEntityMotionPacketMixin", "ClientboundSetEntityMotionPacketMixin",
"LivingEntityMixin" "LivingEntityMixin",
"PlayerEntityMixin"
], ],
"client": [ "client": [
"CameraMixin", "CameraMixin",