优化DPS发电机和标靶的右键交互
This commit is contained in:
parent
1d6e60ef01
commit
c1886d7da5
2 changed files with 8 additions and 8 deletions
|
@ -152,6 +152,10 @@ public class DPSGeneratorEntity extends LivingEntity implements GeoEntity {
|
|||
|
||||
@Override
|
||||
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||
if (player.getMainHandItem() != ItemStack.EMPTY) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
if (player.isShiftKeyDown()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
this.discard();
|
||||
|
@ -161,10 +165,6 @@ public class DPSGeneratorEntity extends LivingEntity implements GeoEntity {
|
|||
player.addItem(new ItemStack(ModItems.DPS_GENERATOR_DEPLOYER.get()));
|
||||
}
|
||||
} else {
|
||||
if (player.getMainHandItem() != ItemStack.EMPTY) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
this.lookAt(EntityAnchorArgument.Anchor.EYES, new Vec3((player.getX()), this.getY(), (player.getZ())));
|
||||
this.setXRot(0);
|
||||
this.xRotO = this.getXRot();
|
||||
|
|
|
@ -135,6 +135,10 @@ public class TargetEntity extends LivingEntity implements GeoEntity {
|
|||
|
||||
@Override
|
||||
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||
if (player.getMainHandItem() != ItemStack.EMPTY) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
if (player.isShiftKeyDown()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
this.discard();
|
||||
|
@ -144,10 +148,6 @@ public class TargetEntity extends LivingEntity implements GeoEntity {
|
|||
player.addItem(new ItemStack(ModItems.TARGET_DEPLOYER.get()));
|
||||
}
|
||||
} else {
|
||||
if (player.getMainHandItem() != ItemStack.EMPTY) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
this.lookAt(EntityAnchorArgument.Anchor.EYES, new Vec3((player.getX()), this.getY(), (player.getZ())));
|
||||
this.setXRot(0);
|
||||
this.xRotO = this.getXRot();
|
||||
|
|
Loading…
Add table
Reference in a new issue