禁用fake player对载具的搭乘行为
This commit is contained in:
parent
4a25df74a1
commit
55831e3ac4
1 changed files with 4 additions and 0 deletions
|
@ -44,6 +44,7 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.gameevent.GameEvent;
|
import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.fluids.FluidType;
|
import net.minecraftforge.fluids.FluidType;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
@ -270,16 +271,19 @@ public abstract class VehicleEntity extends Entity {
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
} else if (!player.isShiftKeyDown()) {
|
} else if (!player.isShiftKeyDown()) {
|
||||||
if (this.getFirstPassenger() == null) {
|
if (this.getFirstPassenger() == null) {
|
||||||
|
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
||||||
player.setXRot(this.getXRot());
|
player.setXRot(this.getXRot());
|
||||||
player.setYRot(this.getYRot());
|
player.setYRot(this.getYRot());
|
||||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||||
} else if (!(this.getFirstPassenger() instanceof Player)) {
|
} else if (!(this.getFirstPassenger() instanceof Player)) {
|
||||||
|
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
||||||
this.getFirstPassenger().stopRiding();
|
this.getFirstPassenger().stopRiding();
|
||||||
player.setXRot(this.getXRot());
|
player.setXRot(this.getXRot());
|
||||||
player.setYRot(this.getYRot());
|
player.setYRot(this.getYRot());
|
||||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
if (this.canAddPassenger(player)) {
|
if (this.canAddPassenger(player)) {
|
||||||
|
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
||||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue