修复cannon能被击飞的问题
This commit is contained in:
parent
f96ec9cd69
commit
6f33b4aa5d
2 changed files with 36 additions and 12 deletions
|
@ -154,15 +154,27 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
|
|||
|
||||
@Override
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (player.isShiftKeyDown() && player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
||||
this.discard();
|
||||
if (player.isShiftKeyDown()) {
|
||||
if (player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
||||
this.discard();
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
player.startRiding(this);
|
||||
if (this.getFirstPassenger() == null) {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
player.startRiding(this);
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getDeltaMovement() {
|
||||
return new Vec3(0, Math.min(super.getDeltaMovement().y, 0), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -160,15 +160,27 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
|
|||
|
||||
@Override
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (player.isShiftKeyDown() && player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
||||
this.discard();
|
||||
if (player.isShiftKeyDown()) {
|
||||
if (player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
||||
this.discard();
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
player.startRiding(this);
|
||||
if (this.getFirstPassenger() == null) {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
player.startRiding(this);
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getDeltaMovement() {
|
||||
return new Vec3(0, Math.min(super.getDeltaMovement().y, 0), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue