修复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
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||||
if (player.isShiftKeyDown() && player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
if (player.isShiftKeyDown()) {
|
||||||
this.discard();
|
if (player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
||||||
|
this.discard();
|
||||||
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
|
}
|
||||||
|
return InteractionResult.PASS;
|
||||||
} else {
|
} else {
|
||||||
player.setXRot(this.getXRot());
|
if (this.getFirstPassenger() == null) {
|
||||||
player.setYRot(this.getYRot());
|
player.setXRot(this.getXRot());
|
||||||
player.startRiding(this);
|
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
|
@Override
|
||||||
|
|
|
@ -160,15 +160,27 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||||
if (player.isShiftKeyDown() && player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
if (player.isShiftKeyDown()) {
|
||||||
this.discard();
|
if (player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
|
||||||
|
this.discard();
|
||||||
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
|
}
|
||||||
|
return InteractionResult.PASS;
|
||||||
} else {
|
} else {
|
||||||
player.setXRot(this.getXRot());
|
if (this.getFirstPassenger() == null) {
|
||||||
player.setYRot(this.getYRot());
|
player.setXRot(this.getXRot());
|
||||||
player.startRiding(this);
|
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
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue