遇到一个神秘问题
This commit is contained in:
parent
bb82b004d1
commit
9108bdea0b
6 changed files with 16 additions and 10 deletions
|
@ -118,10 +118,10 @@ public class ClickHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if ((player.getMainHandItem().is(ModTags.Items.GUN) && !(player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity))
|
||||
if ((player.getMainHandItem().is(ModTags.Items.GUN) && !(player.getVehicle() instanceof ICannonEntity))
|
||||
|| stack.is(ModItems.MONITOR.get())
|
||||
|| (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() != null && player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player && stack.is(ItemStack.EMPTY.getItem()))
|
||||
|| (player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && stack.is(ItemStack.EMPTY.getItem()))
|
||||
|| (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get()))) {
|
||||
if (button == ModKeyMappings.FIRE.getKey().getValue()) {
|
||||
handleWeaponFirePress(player, stack);
|
||||
|
@ -244,10 +244,10 @@ public class ClickHandler {
|
|||
ModUtils.PACKET_HANDLER.sendToServer(new SensitivityMessage(false));
|
||||
}
|
||||
|
||||
if ((player.getMainHandItem().is(ModTags.Items.GUN) && !(player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity))
|
||||
if ((player.getMainHandItem().is(ModTags.Items.GUN) && !(player.getVehicle() instanceof ICannonEntity))
|
||||
|| stack.is(ModItems.MONITOR.get())
|
||||
|| (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() != null && player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player && stack.is(ItemStack.EMPTY.getItem()))
|
||||
|| (player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && stack.is(ItemStack.EMPTY.getItem()))
|
||||
|| (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get()))) {
|
||||
if (key == ModKeyMappings.FIRE.getKey().getValue()) {
|
||||
handleWeaponFirePress(player, stack);
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.RenderHelper;
|
||||
import com.atsuishio.superbwarfare.entity.SpeedboatEntity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -67,6 +68,6 @@ public class VehicleMgHudOverlay {
|
|||
private static boolean shouldRenderCrossHair(Player player) {
|
||||
if (player == null) return false;
|
||||
return !player.isSpectator()
|
||||
&& player.getVehicle() instanceof SpeedboatEntity && ClientEventHandler.zoom;
|
||||
&& player.getVehicle() instanceof SpeedboatEntity && ClientEventHandler.zoom && !player.getMainHandItem().is(ModTags.Items.GUN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -553,7 +553,7 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
|||
|
||||
@Override
|
||||
public boolean isDriver(Player player) {
|
||||
return false;
|
||||
return player == this.getFirstPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -433,7 +433,7 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
|
|||
|
||||
@Override
|
||||
public boolean isDriver(Player player) {
|
||||
return false;
|
||||
return player == this.getFirstPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -528,7 +528,7 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
|
|||
|
||||
@Override
|
||||
public boolean isDriver(Player player) {
|
||||
return false;
|
||||
return player == this.getFirstPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
|||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -551,6 +552,10 @@ public class ClientEventHandler {
|
|||
if (player == null) return;
|
||||
if (level == null) return;
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player)) {
|
||||
player.displayClientMessage(Component.literal("canShoot: " + iVehicle.canShoot(player)), true);
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) {
|
||||
int rpm = iVehicle.mainGunRpm();
|
||||
if (rpm == 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue