修改类名
This commit is contained in:
parent
29011b3135
commit
069d303c17
14 changed files with 41 additions and 60 deletions
|
@ -91,7 +91,7 @@ public class ClickHandler {
|
|||
if (player.getMainHandItem().is(ModTags.Items.GUN)
|
||||
|| stack.is(ModItems.MONITOR.get())
|
||||
|| player.hasEffect(ModMobEffects.SHOCK.get())
|
||||
|| (player.getVehicle() instanceof IVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity))) {
|
||||
|| (player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity))) {
|
||||
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class ClickHandler {
|
|||
if ((player.getMainHandItem().is(ModTags.Items.GUN) && !(player.getVehicle() instanceof ICannonEntity))
|
||||
|| stack.is(ModItems.MONITOR.get())
|
||||
|| (player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && stack.is(ItemStack.EMPTY.getItem()))
|
||||
|| (player.getVehicle() instanceof IArmedVehicleEntity 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);
|
||||
|
@ -162,7 +162,7 @@ public class ClickHandler {
|
|||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && ClientEventHandler.zoom) {
|
||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && ClientEventHandler.zoom) {
|
||||
ClientEventHandler.vehicleFov = Mth.clamp(ClientEventHandler.vehicleFov + 0.4 * scroll, 1, 6);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class ClickHandler {
|
|||
if ((player.getMainHandItem().is(ModTags.Items.GUN) && !(player.getVehicle() instanceof ICannonEntity))
|
||||
|| stack.is(ModItems.MONITOR.get())
|
||||
|| (player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && stack.is(ItemStack.EMPTY.getItem()))
|
||||
|| (player.getVehicle() instanceof IArmedVehicleEntity 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);
|
||||
|
@ -300,7 +300,7 @@ public class ClickHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player)) {
|
||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player)) {
|
||||
ClientEventHandler.holdFire = true;
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ public class ClickHandler {
|
|||
}
|
||||
|
||||
private static void handleVehicleMove(int key, int state, Player player) {
|
||||
if (player.getVehicle() != null && player.getVehicle() instanceof IVehicleEntity && player.getVehicle().getFirstPassenger() == player) {
|
||||
if (player.getVehicle() != null && player.getVehicle() instanceof IArmedVehicleEntity && player.getVehicle().getFirstPassenger() == player) {
|
||||
|
||||
var options = Minecraft.getInstance().options;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
|
@ -30,7 +30,7 @@ public class ProjectileEntityModel extends GeoModel<ProjectileEntity> {
|
|||
|| player.getMainHandItem().is(ModItems.GLOCK_17.get())
|
||||
|| player.getMainHandItem().is(ModItems.GLOCK_18.get())
|
||||
|| player.getMainHandItem().is(ModItems.BOCEK.get())
|
||||
|| (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && !player.getMainHandItem().is(ModTags.Items.GUN))) {
|
||||
|| (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && !player.getMainHandItem().is(ModTags.Items.GUN))) {
|
||||
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity.geo.json");
|
||||
} else {
|
||||
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity2.geo.json");
|
||||
|
|
|
@ -73,7 +73,7 @@ public class VehicleHudOverlay {
|
|||
|
||||
PoseStack poseStack = event.getGuiGraphics().pose();
|
||||
|
||||
if (vehicle instanceof IVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1) {
|
||||
if (vehicle instanceof IArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1) {
|
||||
|
||||
boolean iCharge = iVehicle instanceof IChargeEntity;
|
||||
|
||||
|
@ -121,10 +121,10 @@ public class VehicleHudOverlay {
|
|||
private static boolean shouldRenderCrossHair(Player player) {
|
||||
if (player == null) return false;
|
||||
return !player.isSpectator()
|
||||
&& (player.getVehicle() != null && player.getVehicle() instanceof IVehicleEntity);
|
||||
&& (player.getVehicle() != null && player.getVehicle() instanceof IArmedVehicleEntity);
|
||||
}
|
||||
|
||||
private static String getVehicleAmmoType(ItemStack stack, IVehicleEntity iVehicle) {
|
||||
private static String getVehicleAmmoType(ItemStack stack, IArmedVehicleEntity iVehicle) {
|
||||
if (stack.getItem() == ModItems.AP_5_INCHES.get() && iVehicle instanceof ICannonEntity) {
|
||||
return Component.translatable("des.superbwarfare.tips.ammo_type.ap").getString();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.entity;
|
|||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public interface IVehicleEntity {
|
||||
public interface IArmedVehicleEntity {
|
||||
|
||||
void vehicleShoot(Player player);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
package com.atsuishio.superbwarfare.entity;
|
||||
|
||||
public interface ICannonEntity extends IVehicleEntity {
|
||||
public interface ICannonEntity extends IArmedVehicleEntity {
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ import java.util.List;
|
|||
|
||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||
|
||||
public class SpeedboatEntity extends MobileVehicleEntity implements GeoEntity, IChargeEntity, IVehicleEntity, HasCustomInventoryScreen, ContainerEntity {
|
||||
public class SpeedboatEntity extends MobileVehicleEntity implements GeoEntity, IChargeEntity, IArmedVehicleEntity, HasCustomInventoryScreen, ContainerEntity {
|
||||
|
||||
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT);
|
||||
|
|
|
@ -34,7 +34,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity, IVehicleEntity {
|
||||
public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
public static final float MAX_HEALTH = 50;
|
||||
|
@ -278,10 +278,6 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vehicleShoot(Player player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
}
|
||||
|
@ -296,26 +292,6 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity,
|
|||
return MAX_HEALTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDriver(Player player) {
|
||||
return player == this.getFirstPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int mainGunRpm() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShoot(Player player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmmoCount(Player player) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergy() {
|
||||
return MAX_ENERGY;
|
||||
|
|
|
@ -221,11 +221,11 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
float eyeHeight = entity.getEyeHeight();
|
||||
float bodyHeight = entity.getBbHeight();
|
||||
if ((eyeHeight - 0.35) < hitBoxPos.y && hitBoxPos.y < (eyeHeight + 0.4) &&
|
||||
!(entity instanceof ClaymoreEntity || entity instanceof MortarEntity || entity instanceof IVehicleEntity || entity instanceof DroneEntity)) {
|
||||
!(entity instanceof ClaymoreEntity || entity instanceof MortarEntity || entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) {
|
||||
headshot = true;
|
||||
}
|
||||
if (hitBoxPos.y < (0.33 * bodyHeight) && !(entity instanceof ClaymoreEntity || entity instanceof MortarEntity ||
|
||||
entity instanceof IVehicleEntity || entity instanceof DroneEntity)) {
|
||||
entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) {
|
||||
legShot = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.ClickHandler;
|
||||
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
||||
import com.atsuishio.superbwarfare.entity.DroneEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.ICannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.SpeedboatEntity;
|
||||
import com.atsuishio.superbwarfare.init.*;
|
||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||
|
@ -220,7 +220,12 @@ public class ClientEventHandler {
|
|||
if (level == null) return;
|
||||
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return;
|
||||
if (!stack.is(ModTags.Items.GUN)) {
|
||||
clientTimer.stop();
|
||||
fireSpread = 0;
|
||||
gunSpread = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
var perk = PerkHelper.getPerkByType(stack, Perk.Type.AMMO);
|
||||
int mode = GunsTool.getGunIntTag(stack, "FireMode");
|
||||
|
@ -553,7 +558,7 @@ public class ClientEventHandler {
|
|||
holdFire = false;
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) {
|
||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) {
|
||||
int rpm = iVehicle.mainGunRpm();
|
||||
if (rpm == 0) {
|
||||
rpm = 240;
|
||||
|
@ -585,7 +590,7 @@ public class ClientEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public static void playVehicleClientSounds(Player player, IVehicleEntity iVehicle) {
|
||||
public static void playVehicleClientSounds(Player player, IArmedVehicleEntity iVehicle) {
|
||||
if (iVehicle instanceof SpeedboatEntity speedboat) {
|
||||
float pitch = speedboat.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - speedboat.getEntityData().get(HEAT)));
|
||||
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
|
||||
|
@ -1194,7 +1199,7 @@ public class ClientEventHandler {
|
|||
event.setFOV(event.getFOV() / droneFovLerp);
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity && !(player.getVehicle() instanceof ICannonEntity) && zoom) {
|
||||
if (player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof ICannonEntity) && zoom) {
|
||||
vehicleFovLerp = Mth.lerp(0.1 * Minecraft.getInstance().getDeltaFrameTime(), vehicleFovLerp, vehicleFov);
|
||||
event.setFOV(event.getFOV() / vehicleFovLerp);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class LivingEventHandler {
|
|||
if (vehicle != null) {
|
||||
if (vehicle instanceof ICannonEntity) {
|
||||
event.setCanceled(true);
|
||||
} else if (vehicle instanceof IVehicleEntity) {
|
||||
} else if (vehicle instanceof IArmedVehicleEntity) {
|
||||
event.setAmount(0.3f * event.getAmount());
|
||||
}
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ public class LivingEventHandler {
|
|||
if (!(sourceEntity instanceof Player player)) return;
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
||||
if (sourceEntity.getVehicle() instanceof IVehicleEntity vehicle && DamageTypeTool.isGunDamage(source) && !stack.is(ModTags.Items.GUN)) {
|
||||
if (sourceEntity.getVehicle() instanceof IArmedVehicleEntity vehicle && DamageTypeTool.isGunDamage(source) && !stack.is(ModTags.Items.GUN)) {
|
||||
var drops = event.getDrops();
|
||||
if (vehicle instanceof ContainerEntity containerEntity) {
|
||||
drops.forEach(itemEntity -> {
|
||||
|
@ -731,7 +731,7 @@ public class LivingEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if (sourceEntity.getVehicle() instanceof IVehicleEntity vehicle && source.is(ModDamageTypes.VEHICLE_STRIKE)) {
|
||||
if (sourceEntity.getVehicle() instanceof IArmedVehicleEntity vehicle && source.is(ModDamageTypes.VEHICLE_STRIKE)) {
|
||||
var drops = event.getDrops();
|
||||
if (vehicle instanceof ContainerEntity containerEntity) {
|
||||
drops.forEach(itemEntity -> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.atsuishio.superbwarfare.mixins;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.IArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.ICannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
||||
|
@ -53,7 +53,7 @@ public class MouseHandlerMixin {
|
|||
return 0.33 / (1 + 0.08 * (droneFovLerp - 1));
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle && iVehicle.isDriver(player) && ClientEventHandler.zoom) {
|
||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && ClientEventHandler.zoom) {
|
||||
return 0.33 / (1 + 0.08 * (vehicleFovLerp - 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.network.message;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IArmedVehicleEntity;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
@ -34,7 +34,7 @@ public class VehicleFireMessage {
|
|||
return;
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof IVehicleEntity iVehicle) {
|
||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle) {
|
||||
iVehicle.vehicleShoot(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.atsuishio.superbwarfare.network.message;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.WheelChairEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
|
@ -53,7 +53,7 @@ public class ZoomMessage {
|
|||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
if (player.isPassenger() && player.getVehicle() instanceof IVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) {
|
||||
if (player.isPassenger() && player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) {
|
||||
SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_IN.get(), 2, 1);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class ZoomMessage {
|
|||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
|
||||
if (player.isPassenger() && player.getVehicle() instanceof IVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) {
|
||||
if (player.isPassenger() && player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) {
|
||||
SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_OUT.get(), 2, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.tools;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.IArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -46,7 +46,7 @@ public class SeekTool {
|
|||
&& e != entity
|
||||
&& e.isAlive()
|
||||
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
|
||||
&& (e instanceof LivingEntity || e instanceof IVehicleEntity)
|
||||
&& (e instanceof LivingEntity || e instanceof IArmedVehicleEntity)
|
||||
&& !(e instanceof Player player && (player.isSpectator()))
|
||||
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
|
||||
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
|
||||
|
@ -63,7 +63,7 @@ public class SeekTool {
|
|||
&& e != entity
|
||||
&& e.isAlive()
|
||||
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
|
||||
&& (e instanceof LivingEntity || e instanceof IVehicleEntity)
|
||||
&& (e instanceof LivingEntity || e instanceof IArmedVehicleEntity)
|
||||
&& !(e instanceof Player player && (player.isCreative() || player.isSpectator()))
|
||||
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
|
||||
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
|
||||
|
@ -78,7 +78,7 @@ public class SeekTool {
|
|||
.filter(e -> e.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) <= range * range
|
||||
&& e.isAlive()
|
||||
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
|
||||
&& (e instanceof LivingEntity || e instanceof IVehicleEntity)
|
||||
&& (e instanceof LivingEntity || e instanceof IArmedVehicleEntity)
|
||||
&& !(e instanceof Player player && (player.isCreative() || player.isSpectator())))
|
||||
.toList();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue