尝试写撬棍敲一下发射一发的功能

This commit is contained in:
Atsuishio 2025-07-13 22:47:25 +08:00 committed by Light_Quanta
parent 514c6ed288
commit 2edc769362
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -190,7 +190,8 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
setChanged();
if (stack.is(ModTags.Items.CROWBAR)) {
if (player.isShiftKeyDown() && this.getPassengers().isEmpty()) {
if (player.isShiftKeyDown()) {
if (this.getPassengers().isEmpty()) {
ItemStack container = ContainerBlockItem.createInstance(this);
if (!player.addItem(container)) {
player.drop(container, false);
@ -199,14 +200,17 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
this.discard();
return InteractionResult.SUCCESS;
}
} else {
//TODO 正确实现扣除炮弹
for (int i = 0; i < 12; i++) {
if (!items.get(i).isEmpty()) {
if (items.get(i).getItem() instanceof MediumRocketItem) {
items.remove(i);
player.swing(InteractionHand.MAIN_HAND);
break;
}
}
}
}
return InteractionResult.FAIL;
}