diff --git a/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java index 5fd4373ca..4a3fec4d3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java +++ b/src/main/java/com/atsuishio/superbwarfare/block/BarbedWireBlock.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.block; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.Registries; diff --git a/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java index 8d2160395..acabe3e41 100644 --- a/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java +++ b/src/main/java/com/atsuishio/superbwarfare/block/JumpPadBlock.java @@ -1,7 +1,7 @@ package com.atsuishio.superbwarfare.block; import com.atsuishio.superbwarfare.entity.TargetEntity; -import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.network.ModVariables; import net.minecraft.core.BlockPos; @@ -99,7 +99,7 @@ public class JumpPadBlock extends Block { super.entityInside(blockstate, level, pos, entity); // 禁止套娃 - if (entity instanceof TargetEntity || entity instanceof ICannonEntity) return; + if (entity instanceof TargetEntity || entity instanceof CannonEntity) return; if (entity.isShiftKeyDown()) { if (entity.onGround()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java index 98d1be149..ae4d5793a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java @@ -5,7 +5,7 @@ import com.atsuishio.superbwarfare.compat.CompatHolder; import com.atsuishio.superbwarfare.compat.clothconfig.ClothConfigHelper; import com.atsuishio.superbwarfare.config.client.ReloadConfig; import com.atsuishio.superbwarfare.entity.MortarEntity; -import com.atsuishio.superbwarfare.entity.vehicle.*; +import com.atsuishio.superbwarfare.entity.vehicle.base.*; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.gun.GunItem; @@ -94,7 +94,7 @@ public class ClickHandler { int button = event.getButton(); if (stack.is(ModTags.Items.GUN) || stack.is(ModItems.MONITOR.get()) || stack.is(ModItems.LUNGE_MINE.get()) || player.hasEffect(ModMobEffects.SHOCK.get()) - || (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))) { + || (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))) { if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) { event.setCanceled(true); } @@ -106,7 +106,7 @@ public class ClickHandler { if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) { if (stack.is(ModTags.Items.GUN) - || (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && !stack.getItem().isEdible())) { + || (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && !stack.getItem().isEdible())) { event.setCanceled(true); } } @@ -120,7 +120,7 @@ public class ClickHandler { if (stack.is(ModTags.Items.GUN) || stack.is(ModItems.MONITOR.get()) || stack.is(ModItems.LUNGE_MINE.get()) - || (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player)) + || (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.isDriver(player)) || (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get()))) { if (button == ModKeyMappings.FIRE.getKey().getValue()) { handleWeaponFirePress(player, stack); @@ -266,7 +266,7 @@ public class ClickHandler { if (stack.is(ModTags.Items.GUN) || stack.is(ModItems.MONITOR.get()) - || (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player)) + || (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.isDriver(player)) || (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get()))) { if (key == ModKeyMappings.FIRE.getKey().getValue()) { handleWeaponFirePress(player, stack); @@ -334,7 +334,7 @@ public class ClickHandler { } - if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.banHand(player)) { + if (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.banHand(player)) { if (iVehicle.isDriver(player)) { ClientEventHandler.holdFireVehicle = true; } @@ -345,7 +345,7 @@ public class ClickHandler { ClientEventHandler.holdFire = true; } - if (stack.getItem() instanceof GunItem gunItem && !(player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity)) { + if (stack.getItem() instanceof GunItem gunItem && !(player.getVehicle() != null && player.getVehicle() instanceof CannonEntity)) { if ((!(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading")) && !GunsTool.getGunBooleanTag(stack, "Reloading") && !GunsTool.getGunBooleanTag(stack, "Charging") @@ -382,7 +382,7 @@ public class ClickHandler { public static void handleWeaponZoomPress(Player player, ItemStack stack) { ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(0)); - if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.banHand(player)) { + if (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.banHand(player)) { if (iVehicle.isDriver(player)) { ClientEventHandler.zoomVehicle = true; } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/ProjectileEntityModel.java b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/ProjectileEntityModel.java index 96dc2aab7..6963dafe3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/ProjectileEntityModel.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/ProjectileEntityModel.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.model.entity; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModTags; @@ -31,7 +31,7 @@ public class ProjectileEntityModel extends GeoModel { || player.getMainHandItem().is(ModItems.GLOCK_17.get()) || player.getMainHandItem().is(ModItems.GLOCK_18.get()) || player.getMainHandItem().is(ModItems.BOCEK.get()) - || (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && !player.getMainHandItem().is(ModTags.Items.GUN))) { + || (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && !player.getMainHandItem().is(ModTags.Items.GUN))) { return ModUtils.loc("geo/projectile_entity.geo.json"); } else { return ModUtils.loc("geo/projectile_entity2.geo.json"); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/CannonHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/CannonHudOverlay.java index 465c2fe5a..9491092e2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/CannonHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/CannonHudOverlay.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity; -import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.tools.FormatTool; import com.atsuishio.superbwarfare.tools.TraceTool; @@ -127,6 +127,6 @@ public class CannonHudOverlay { private static boolean shouldRenderCrossHair(Player player) { if (player == null) return false; return !player.isSpectator() - && (player.getVehicle() != null && (player.getVehicle() instanceof ICannonEntity)); + && (player.getVehicle() != null && (player.getVehicle() instanceof CannonEntity)); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java index 84e5a4e3e..e24e9ea1c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.client.DisplayConfig; import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModTags; @@ -57,7 +57,8 @@ public class CrossHairOverlay { if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) return; - if (!player.getMainHandItem().is(ModTags.Items.GUN) || (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))) return; + if (!player.getMainHandItem().is(ModTags.Items.GUN) || (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))) + return; GuiGraphics guiGraphics = event.getGuiGraphics(); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/GrenadeLauncherOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/GrenadeLauncherOverlay.java index cb330023f..877cecd1a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/GrenadeLauncherOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/GrenadeLauncherOverlay.java @@ -1,8 +1,8 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; -import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.network.ModVariables; @@ -30,7 +30,7 @@ public class GrenadeLauncherOverlay { if (player != null && player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) return; - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) return; if (!shouldRenderCrossHair(player)) return; @@ -60,7 +60,7 @@ public class GrenadeLauncherOverlay { if (player == null) return false; return !player.isSpectator() && (player.getMainHandItem().getItem() == ModItems.M_79.get() || player.getMainHandItem().getItem() == ModItems.SECONDARY_CATACLYSM.get()) - && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || (player.isPassenger() && player.getVehicle() instanceof ICannonEntity)) + && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || (player.isPassenger() && player.getVehicle() instanceof CannonEntity)) && !ClientEventHandler.zoom; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java index cbf98dc91..246a7cebb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java @@ -2,7 +2,11 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.RenderHelper; -import com.atsuishio.superbwarfare.entity.vehicle.*; +import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; +import com.atsuishio.superbwarfare.entity.vehicle.base.HelicopterEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.network.ModVariables; @@ -58,7 +62,7 @@ public class HelicopterHudOverlay { if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) return; - if (player.getVehicle() instanceof IHelicopterEntity iHelicopterEntity && player.getVehicle() instanceof MobileVehicleEntity mobileVehicle && iHelicopterEntity.isDriver(player) && player.getVehicle() instanceof MultiWeaponVehicleEntity multiWeaponVehicle) { + if (player.getVehicle() instanceof HelicopterEntity iHelicopterEntity && player.getVehicle() instanceof MobileVehicleEntity mobileVehicle && iHelicopterEntity.isDriver(player) && player.getVehicle() instanceof MultiWeaponVehicleEntity multiWeaponVehicle) { poseStack.pushPose(); poseStack.translate(-6 * ClientEventHandler.turnRot[1], -6 * ClientEventHandler.turnRot[0], 0); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/JavelinHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/JavelinHudOverlay.java index 581dc9691..9d2145e76 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/JavelinHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/JavelinHudOverlay.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.RenderHelper; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.network.ModVariables; @@ -55,7 +55,8 @@ public class JavelinHudOverlay { if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) return; - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) return; + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) + return; if ((stack.getItem() == ModItems.JAVELIN.get() && !stack.getOrCreateTag().getBoolean("HoloHidden")) && Minecraft.getInstance().options.getCameraType().isFirstPerson() && ClientEventHandler.zoom) { RenderSystem.disableDepthTest(); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java index a627221cd..e64cf4fc2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java @@ -2,8 +2,8 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.client.KillMessageConfig; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.event.KillMessageHandler; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModItems; @@ -178,7 +178,7 @@ public class KillMessageOverlay { if (player != null && player.getVehicle() instanceof VehicleEntity vehicleEntity) { // 载具图标 - if ((vehicleEntity instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand(player)) || record.damageType == ModDamageTypes.VEHICLE_STRIKE) { + if ((vehicleEntity instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand(player)) || record.damageType == ModDamageTypes.VEHICLE_STRIKE) { renderItem = true; ResourceLocation resourceLocation = vehicleEntity.getVehicleIcon(); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/RedTriangleOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/RedTriangleOverlay.java index 93478ab82..efade06e2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/RedTriangleOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/RedTriangleOverlay.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.RenderHelper; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.tools.SeekTool; import com.mojang.blaze3d.systems.RenderSystem; @@ -37,7 +37,7 @@ public class RedTriangleOverlay { ItemStack stack = player.getMainHandItem(); if (!stack.is(ModItems.RPG.get())) return; - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) return; Entity idf = SeekTool.seekLivingEntity(player, player.level(), 128, 6); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java index 0a26ec0e0..f411b5e6e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.RenderHelper; import com.atsuishio.superbwarfare.config.client.DisplayConfig; import com.atsuishio.superbwarfare.entity.vehicle.*; +import com.atsuishio.superbwarfare.entity.vehicle.base.*; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.tools.FormatTool; @@ -95,7 +96,7 @@ public class VehicleHudOverlay { } poseStack.popPose(); - if (vehicle instanceof IArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1 && iVehicle.isDriver(player)) { + if (vehicle instanceof ArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1 && iVehicle.isDriver(player)) { boolean iCharge = iVehicle instanceof EnergyVehicleEntity; // 渲染当前弹药量 @@ -104,7 +105,7 @@ public class VehicleHudOverlay { float v = h / 1.5f - (iCharge ? 42 : 29) / 1.5f; if (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) - && !(iVehicle instanceof ICannonEntity + && !(iVehicle instanceof CannonEntity || (iVehicle instanceof Ah6Entity ah6Entity && ah6Entity.getWeaponType(0) == 1)) ) { event.getGuiGraphics().drawString( @@ -146,11 +147,11 @@ public class VehicleHudOverlay { return !player.isSpectator() && (player.getVehicle() != null && player.getVehicle() instanceof VehicleEntity); } - private static String getVehicleAmmoType(ItemStack stack, IArmedVehicleEntity iVehicle) { - if (stack.getItem() == ModItems.AP_5_INCHES.get() && iVehicle instanceof ICannonEntity) { + private static String getVehicleAmmoType(ItemStack stack, ArmedVehicleEntity iVehicle) { + if (stack.getItem() == ModItems.AP_5_INCHES.get() && iVehicle instanceof CannonEntity) { return Component.translatable("des.superbwarfare.tips.ammo_type.ap").getString(); } - if (stack.getItem() == ModItems.HE_5_INCHES.get() && iVehicle instanceof ICannonEntity) { + if (stack.getItem() == ModItems.HE_5_INCHES.get() && iVehicle instanceof CannonEntity) { return Component.translatable("des.superbwarfare.tips.ammo_type.he").getString(); } if (iVehicle instanceof SpeedboatEntity) { @@ -185,7 +186,7 @@ public class VehicleHudOverlay { if (player == null) return; - if (player.getVehicle() instanceof ILandArmorEntity iLand && iLand.isDriver(player) + if (player.getVehicle() instanceof LandArmorEntity iLand && iLand.isDriver(player) && iLand instanceof MultiWeaponVehicleEntity multiWeaponVehicle && iLand instanceof MobileVehicleEntity mobileVehicle) { poseStack.pushPose(); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleTeamOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleTeamOverlay.java index 91121f66e..adbfb6395 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleTeamOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleTeamOverlay.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.client.overlay; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.tools.FormatTool; import com.atsuishio.superbwarfare.tools.TraceTool; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/src/main/java/com/atsuishio/superbwarfare/client/screens/FuMO25Screen.java b/src/main/java/com/atsuishio/superbwarfare/client/screens/FuMO25Screen.java index abba0e3d9..361e6277c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/screens/FuMO25Screen.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/screens/FuMO25Screen.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.client.screens; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.block.entity.FuMO25BlockEntity; import com.atsuishio.superbwarfare.client.RenderHelper; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.menu.FuMO25Menu; import com.atsuishio.superbwarfare.network.message.RadarChangeModeMessage; import com.atsuishio.superbwarfare.network.message.RadarSetParametersMessage; diff --git a/src/main/java/com/atsuishio/superbwarfare/compat/jade/SbwJadePlugin.java b/src/main/java/com/atsuishio/superbwarfare/compat/jade/SbwJadePlugin.java index 0d79a226f..f18c0823e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/compat/jade/SbwJadePlugin.java +++ b/src/main/java/com/atsuishio/superbwarfare/compat/jade/SbwJadePlugin.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.compat.jade; import com.atsuishio.superbwarfare.block.ContainerBlock; import com.atsuishio.superbwarfare.compat.jade.providers.ContainerEntityProvider; import com.atsuishio.superbwarfare.compat.jade.providers.VehicleHealthProvider; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import snownee.jade.api.IWailaClientRegistration; import snownee.jade.api.IWailaCommonRegistration; import snownee.jade.api.IWailaPlugin; diff --git a/src/main/java/com/atsuishio/superbwarfare/compat/jade/providers/VehicleHealthProvider.java b/src/main/java/com/atsuishio/superbwarfare/compat/jade/providers/VehicleHealthProvider.java index f856b4979..25b64828c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/compat/jade/providers/VehicleHealthProvider.java +++ b/src/main/java/com/atsuishio/superbwarfare/compat/jade/providers/VehicleHealthProvider.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.compat.jade.providers; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.compat.jade.elements.WrenchHealthElement; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.resources.ResourceLocation; import snownee.jade.api.EntityAccessor; import snownee.jade.api.IEntityComponentProvider; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java index d7ba13c8f..52b6a6460 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.entity; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java index 70c7ecf3d..ea383a52a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java @@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.entity; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.EntityFindUtil; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/MortarEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/MortarEntity.java index 78265793b..adc9ef906 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/MortarEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/MortarEntity.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.gui.RangeHelper; import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModSounds; @@ -36,6 +36,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; +import org.jetbrains.annotations.NotNull; import org.joml.Math; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; @@ -120,7 +121,7 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, AnimatedEn } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getMainHandItem(); if (stack.getItem() instanceof MortarShell shell && !player.isShiftKeyDown() && this.entityData.get(FIRE_TIME) == 0) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java index 0338554fb..d1009fd58 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity.projectile; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.entity.AnimatedEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; import com.atsuishio.superbwarfare.tools.ChunkLoadTool; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java index e24ff5fb1..9519e8761 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity.projectile; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.entity.AnimatedEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index 609ef96da..62427822f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -4,7 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.block.BarbedWireBlock; import com.atsuishio.superbwarfare.entity.ICustomKnockback; import com.atsuishio.superbwarfare.entity.TargetEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.Transcript; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 985956532..96202af2f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -6,6 +6,10 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity; import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.HelicopterEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiSeatVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; @@ -61,7 +65,7 @@ import java.util.Objects; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; -public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity, IHelicopterEntity, MultiWeaponVehicleEntity, MultiSeatVehicleEntity { +public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity, HelicopterEntity, MultiWeaponVehicleEntity, MultiSeatVehicleEntity { private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get(); @@ -667,7 +671,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity } @Override - public Vec3 getDismountLocationForPassenger(LivingEntity passenger) { + public @NotNull Vec3 getDismountLocationForPassenger(LivingEntity passenger) { Vec3 vec3d = getDismountOffset(getBbWidth() * Mth.SQRT_OF_TWO, passenger.getBbWidth() * Mth.SQRT_OF_TWO); double ox = getX() + vec3d.x; int i = this.getOrderedPassengers().indexOf(passenger); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java index 9e637d143..f21cc8a96 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java @@ -3,6 +3,8 @@ package com.atsuishio.superbwarfare.entity.vehicle; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; @@ -41,6 +43,7 @@ import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PlayMessages; +import org.jetbrains.annotations.NotNull; import org.joml.Math; import org.joml.Vector3d; import software.bernie.geckolib.animatable.GeoEntity; @@ -55,7 +58,7 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Comparator; import java.util.List; -public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, ICannonEntity { +public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, CannonEntity { public static final EntityDataAccessor COOL_DOWN = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor LASER_LEFT_LENGTH = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.FLOAT); @@ -109,7 +112,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getMainHandItem(); if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java index 75ef56103..414b2a100 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java @@ -6,6 +6,9 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity; import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; @@ -56,7 +59,7 @@ import java.util.List; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; -public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity { +public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, MultiWeaponVehicleEntity { public static final EntityDataAccessor FIRE_ANIM = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/DroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/DroneEntity.java index 952729bec..1fa0f68a0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/DroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/DroneEntity.java @@ -6,6 +6,7 @@ import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity; import com.atsuishio.superbwarfare.entity.projectile.LaserEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; @@ -287,7 +288,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getMainHandItem(); if (stack.getItem() == ModItems.MONITOR.get()) { if (!player.isCrouching()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/IArmedVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/IArmedVehicleEntity.java deleted file mode 100644 index 8ec946436..000000000 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/IArmedVehicleEntity.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.atsuishio.superbwarfare.entity.vehicle; - -import net.minecraft.world.entity.player.Player; - -public interface IArmedVehicleEntity { - - void vehicleShoot(Player player); - - boolean isDriver(Player player); - - int mainGunRpm(); - - boolean canShoot(Player player); - - int getAmmoCount(Player player); - - boolean banHand(Player player); - - boolean hidePassenger(); - - int zoomFov(); -} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ICannonEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ICannonEntity.java deleted file mode 100644 index 83cdf0c4f..000000000 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ICannonEntity.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.atsuishio.superbwarfare.entity.vehicle; - -public interface ICannonEntity extends IArmedVehicleEntity { - -} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java index ea2230299..b8765765c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java @@ -1,6 +1,7 @@ package com.atsuishio.superbwarfare.entity.vehicle; import com.atsuishio.superbwarfare.entity.TargetEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.ContainerBlockItem; @@ -35,6 +36,7 @@ import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Math; import software.bernie.geckolib.animatable.GeoEntity; @@ -166,7 +168,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity, } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getMainHandItem(); if (player.isCrouching()) { if (stack.is(ModItems.CROWBAR.get()) && (getOwner() == null || player == getOwner())) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index 666746fbf..02077acd5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -5,6 +5,9 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; @@ -58,7 +61,7 @@ import java.util.List; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; -public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity { +public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, MultiWeaponVehicleEntity { public static final EntityDataAccessor FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java index 92e9aa5da..3d0c91a9b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java @@ -4,6 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem; @@ -37,6 +39,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PlayMessages; +import org.jetbrains.annotations.NotNull; import org.joml.Math; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; @@ -50,7 +53,7 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Comparator; import java.util.List; -public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntity { +public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity { public static final EntityDataAccessor COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); @@ -91,7 +94,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getMainHandItem(); if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java index f8f9f383c..8cb2da975 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java @@ -4,6 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem; @@ -37,6 +39,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PlayMessages; +import org.jetbrains.annotations.NotNull; import org.joml.Math; import org.joml.Vector3d; import software.bernie.geckolib.animatable.GeoEntity; @@ -51,7 +54,7 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Comparator; import java.util.List; -public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEntity { +public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEntity { public static final EntityDataAccessor COOL_DOWN = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor TYPE = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT); @@ -96,7 +99,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getMainHandItem(); if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MultiSeatVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MultiSeatVehicleEntity.java deleted file mode 100644 index b5e509285..000000000 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MultiSeatVehicleEntity.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.atsuishio.superbwarfare.entity.vehicle; - -import net.minecraft.world.entity.Entity; - -import java.util.List; - -public interface MultiSeatVehicleEntity { - List getOrderedPassengers(); - - Entity getNthEntity(int index); - - boolean changeSeat(Entity entity, int index); - - int getSeatIndex(Entity entity); - - int getSeatCount(); -} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java index c36eefbf0..6ffa4c7eb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java @@ -4,6 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.ModVariables; @@ -49,7 +51,7 @@ import java.util.List; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; -public class SpeedboatEntity extends ContainerMobileVehicleEntity implements GeoEntity, IArmedVehicleEntity { +public class SpeedboatEntity extends ContainerMobileVehicleEntity implements GeoEntity, ArmedVehicleEntity { public static final EntityDataAccessor FIRE_ANIM = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java index 550ef675e..5197f4894 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; @@ -107,7 +108,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { if (player.getMainHandItem().is(Items.MELON) && !entityData.get(MELON)) { entityData.set(MELON, true); player.getMainHandItem().shrink(1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java index 7e5fd6bc5..5d0657e05 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java @@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.entity.vehicle; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.entity.MortarEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModSounds; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index b236d9088..be657c0ce 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -4,6 +4,9 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; @@ -62,7 +65,7 @@ import java.util.List; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; -public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity { +public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, MultiWeaponVehicleEntity { public static final EntityDataAccessor FIRE_ANIM = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.FLOAT); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100GunEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100GunEntity.java index 361d2e874..36a0c3ea0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100GunEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100GunEntity.java @@ -1,6 +1,8 @@ package com.atsuishio.superbwarfare.entity.vehicle; import com.atsuishio.superbwarfare.ModUtils; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.tools.AmmoType; @@ -21,12 +23,13 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; +import org.jetbrains.annotations.NotNull; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; import software.bernie.geckolib.core.animation.AnimatableManager; import software.bernie.geckolib.util.GeckoLibUtil; -public class Yx100GunEntity extends VehicleEntity implements GeoEntity, ICannonEntity { +public class Yx100GunEntity extends VehicleEntity implements GeoEntity, CannonEntity { public static final EntityDataAccessor AMMO = SynchedEntityData.defineId(Yx100GunEntity.class, EntityDataSerializers.INT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); @@ -56,7 +59,7 @@ public class Yx100GunEntity extends VehicleEntity implements GeoEntity, ICannonE } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { return super.interact(player, hand); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/ArmedVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/ArmedVehicleEntity.java new file mode 100644 index 000000000..bc290eb36 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/ArmedVehicleEntity.java @@ -0,0 +1,66 @@ +package com.atsuishio.superbwarfare.entity.vehicle.base; + +import net.minecraft.world.entity.player.Player; + +public interface ArmedVehicleEntity { + + /** + * 载具开火 + * + * @param player 玩家 + */ + void vehicleShoot(Player player); + + /** + * 判断指定玩家是否是载具驾驶员 + * + * @param player 玩家 + * @return 是否是驾驶员 + */ + boolean isDriver(Player player); + + /** + * 主武器射速 + * + * @return 射速 + */ + int mainGunRpm(); + + /** + * 当前情况载具是否可以开火 + * + * @param player 玩家 + * @return 是否可以开火 + */ + boolean canShoot(Player player); + + /** + * 获取当前选择的主武器的备弹数量 + * + * @param player 玩家 + * @return 备弹数量 + */ + int getAmmoCount(Player player); + + /** + * 是否隐藏玩家手臂 + * + * @param player 玩家 + * @return 是否隐藏 + */ + boolean banHand(Player player); + + /** + * 是否隐藏载具上的玩家 + * + * @return 是否隐藏 + */ + boolean hidePassenger(); + + /** + * 瞄准时的放大倍率 + * + * @return 放大倍率 + */ + int zoomFov(); +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/CannonEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/CannonEntity.java new file mode 100644 index 000000000..58c23f576 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/CannonEntity.java @@ -0,0 +1,5 @@ +package com.atsuishio.superbwarfare.entity.vehicle.base; + +public interface CannonEntity extends ArmedVehicleEntity { + +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/ContainerMobileVehicleEntity.java similarity index 89% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileVehicleEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/ContainerMobileVehicleEntity.java index ea01e6793..bfbe9d359 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/ContainerMobileVehicleEntity.java @@ -1,4 +1,4 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.menu.VehicleMenu; @@ -29,11 +29,11 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Math; -public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements HasCustomInventoryScreen, ContainerEntity { +public abstract class ContainerMobileVehicleEntity extends MobileVehicleEntity implements HasCustomInventoryScreen, ContainerEntity { public static final int CONTAINER_SIZE = 102; - private NonNullList items = NonNullList.withSize(CONTAINER_SIZE, ItemStack.EMPTY); + private final NonNullList items = NonNullList.withSize(CONTAINER_SIZE, ItemStack.EMPTY); private LazyOptional itemHandler = LazyOptional.of(() -> new InvWrapper(this)); public ContainerMobileVehicleEntity(EntityType pEntityType, Level pLevel) { @@ -58,7 +58,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { if (player.getVehicle() == this) return InteractionResult.PASS; ItemStack stack = player.getMainHandItem(); @@ -71,7 +71,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public void remove(RemovalReason pReason) { + public void remove(@NotNull RemovalReason pReason) { if (!this.level().isClientSide && pReason != RemovalReason.DISCARDED) { Containers.dropContents(this.level(), this, this); } @@ -128,7 +128,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public NonNullList getItemStacks() { + public @NotNull NonNullList getItemStacks() { return this.items; } @@ -207,17 +207,17 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public ItemStack getItem(int pSlot) { + public @NotNull ItemStack getItem(int pSlot) { return this.items.get(pSlot); } @Override - public ItemStack removeItem(int pSlot, int pAmount) { + public @NotNull ItemStack removeItem(int pSlot, int pAmount) { return ContainerHelper.removeItem(this.items, pSlot, pAmount); } @Override - public ItemStack removeItemNoUpdate(int pSlot) { + public @NotNull ItemStack removeItemNoUpdate(int pSlot) { ItemStack itemstack = this.getItemStacks().get(pSlot); if (itemstack.isEmpty()) { return ItemStack.EMPTY; @@ -228,7 +228,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public void setItem(int pSlot, ItemStack pStack) { + public void setItem(int pSlot, @NotNull ItemStack pStack) { this.getItemStacks().set(pSlot, pStack); if (!pStack.isEmpty() && pStack.getCount() > this.getMaxStackSize()) { pStack.setCount(this.getMaxStackSize()); @@ -240,7 +240,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public boolean stillValid(Player pPlayer) { + public boolean stillValid(@NotNull Player pPlayer) { return !this.isRemoved() && this.position().closerThan(pPlayer.position(), 8.0D); } @@ -260,7 +260,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public LazyOptional getCapability(Capability capability, @Nullable Direction facing) { + public @NotNull LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction facing) { if (this.isAlive() && capability == ForgeCapabilities.ITEM_HANDLER) { return itemHandler.cast(); } @@ -280,7 +280,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements } @Override - public void stopOpen(Player pPlayer) { + public void stopOpen(@NotNull Player pPlayer) { this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(pPlayer)); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/EnergyVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/EnergyVehicleEntity.java similarity index 96% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/EnergyVehicleEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/EnergyVehicleEntity.java index 80b0140cf..3dac453a5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/EnergyVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/EnergyVehicleEntity.java @@ -1,4 +1,4 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; import com.atsuishio.superbwarfare.capability.energy.SyncedEntityEnergyStorage; import net.minecraft.nbt.CompoundTag; @@ -15,7 +15,7 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; import org.jetbrains.annotations.NotNull; -public class EnergyVehicleEntity extends VehicleEntity { +public abstract class EnergyVehicleEntity extends VehicleEntity { public static final EntityDataAccessor ENERGY = SynchedEntityData.defineId(EnergyVehicleEntity.class, EntityDataSerializers.INT); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/IHelicopterEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/HelicopterEntity.java similarity index 56% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/IHelicopterEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/HelicopterEntity.java index f516e21a0..d88e76e1a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/IHelicopterEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/HelicopterEntity.java @@ -1,6 +1,6 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; -public interface IHelicopterEntity extends IArmedVehicleEntity { +public interface HelicopterEntity extends ArmedVehicleEntity { float getRotX(float tickDelta); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ILandArmorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java similarity index 60% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ILandArmorEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java index 817f15284..027e7452a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ILandArmorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java @@ -1,8 +1,8 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; import net.minecraft.world.phys.Vec3; -public interface ILandArmorEntity extends IArmedVehicleEntity { +public interface LandArmorEntity extends ArmedVehicleEntity { float turretYRotO(); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java similarity index 98% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java index 8cf894da0..bb3319cff 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java @@ -1,4 +1,4 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.C4Entity; @@ -6,6 +6,7 @@ import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity; import com.atsuishio.superbwarfare.entity.projectile.LaserEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; +import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModTags; @@ -38,7 +39,7 @@ import org.jetbrains.annotations.NotNull; import org.joml.Math; import org.joml.Vector3f; -public class MobileVehicleEntity extends EnergyVehicleEntity { +public abstract class MobileVehicleEntity extends EnergyVehicleEntity { public static final EntityDataAccessor POWER = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.FLOAT); @@ -137,7 +138,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { Entity driver = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_DRIVER_UUID)); if ((verticalCollision)) { - if (this instanceof IHelicopterEntity) { + if (this instanceof HelicopterEntity) { this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (20 * ((lastTickSpeed - 0.3) * (lastTickSpeed - 0.3)))); this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite()); } else if (Mth.abs((float) lastTickVerticalSpeed) > 0.6) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MultiSeatVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MultiSeatVehicleEntity.java new file mode 100644 index 000000000..52d122d31 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MultiSeatVehicleEntity.java @@ -0,0 +1,56 @@ +package com.atsuishio.superbwarfare.entity.vehicle.base; + +import net.minecraft.world.entity.Entity; + +import java.util.List; + +/** + * 拥有多个按顺序排列的座位的载具,每个座位可以为空 + *

+ * 需要为实体自己重写addPassenger、getControllingPassenger、getFirstPassenger、removePassenger等方法 + */ + +public interface MultiSeatVehicleEntity { + + /** + * 获取按顺序排列的成员列表 + * + * @return 按顺序排列的成员列表 + */ + List getOrderedPassengers(); + + /** + * 获取第index个乘客 + * + * @param index 目标座位 + * @return 目标座位的乘客 + */ + + Entity getNthEntity(int index); + + /** + * 尝试切换座位 + * + * @param entity 乘客 + * @param index 目标座位 + * @return 是否切换成功 + */ + + boolean changeSeat(Entity entity, int index); + + /** + * 获取乘客所在座位索引 + * + * @param entity 乘客 + * @return 座位索引 + */ + + int getSeatIndex(Entity entity); + + /** + * 获取座位数量 + * + * @return 座位数量 + */ + int getSeatCount(); +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MultiWeaponVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MultiWeaponVehicleEntity.java similarity index 86% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MultiWeaponVehicleEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MultiWeaponVehicleEntity.java index b08ea9336..b7e8c3723 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MultiWeaponVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MultiWeaponVehicleEntity.java @@ -1,6 +1,6 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; -public interface MultiWeaponVehicleEntity extends IArmedVehicleEntity { +public interface MultiWeaponVehicleEntity extends ArmedVehicleEntity { /** * 检测该槽位是否有可用武器 * diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java similarity index 98% rename from src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java index c409aae5d..34b793ecd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java @@ -1,7 +1,8 @@ -package com.atsuishio.superbwarfare.entity.vehicle; +package com.atsuishio.superbwarfare.entity.vehicle.base; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.VehicleConfig; +import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModItems; @@ -53,7 +54,7 @@ import java.util.List; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; -public class VehicleEntity extends Entity { +public abstract class VehicleEntity extends Entity { public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT); protected static final EntityDataAccessor LAST_ATTACKER_UUID = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.STRING); @@ -119,7 +120,7 @@ public class VehicleEntity extends Entity { } @Override - public InteractionResult interact(Player player, InteractionHand hand) { + public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) { if (player.getVehicle() == this) return InteractionResult.PASS; ItemStack stack = player.getMainHandItem(); @@ -292,7 +293,7 @@ public class VehicleEntity extends Entity { } @Override - protected boolean canAddPassenger(Entity pPassenger) { + protected boolean canAddPassenger(@NotNull Entity pPassenger) { return this.getPassengers().size() < this.getMaxPassengers(); } @@ -489,7 +490,7 @@ public class VehicleEntity extends Entity { } @Override - public Vec3 getDismountLocationForPassenger(LivingEntity passenger) { + public @NotNull Vec3 getDismountLocationForPassenger(LivingEntity passenger) { Vec3 vec3d = getDismountOffset(getBbWidth() * Mth.SQRT_OF_TWO, passenger.getBbWidth() * Mth.SQRT_OF_TWO); double ox = getX() - vec3d.x; double oz = getZ() + vec3d.z; diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java index d914227d3..f3ba57e66 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java @@ -4,6 +4,10 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.ClickHandler; import com.atsuishio.superbwarfare.config.client.DisplayConfig; import com.atsuishio.superbwarfare.entity.vehicle.*; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.network.ModVariables; @@ -275,7 +279,7 @@ public class ClientEventHandler { if (stack.getItem() instanceof GunItem gunItem) { if (gunItem.canUseMelee(stack) && gunMelee == 0 && drawTime < 0.01 && ModKeyMappings.MELEE.isDown() - && !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) + && !(player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) && !holdFireVehicle && !notInGame() && !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit @@ -431,7 +435,7 @@ public class ClientEventHandler { } if ((holdFire || burstFireSize > 0) - && !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) + && !(player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) && !holdFireVehicle && (stack.is(ModTags.Items.NORMAL_GUN) && cantFireTime == 0 @@ -697,7 +701,7 @@ public class ClientEventHandler { holdFireVehicle = false; } - if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) { + if (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) { int rpm = iVehicle.mainGunRpm(); if (rpm == 0) { rpm = 240; @@ -726,7 +730,7 @@ public class ClientEventHandler { } } - public static void playVehicleClientSounds(Player player, IArmedVehicleEntity iVehicle) { + public static void playVehicleClientSounds(Player player, ArmedVehicleEntity iVehicle) { if (iVehicle instanceof SpeedboatEntity speedboat) { float pitch = speedboat.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - speedboat.getEntityData().get(HEAT))); player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch); @@ -778,7 +782,7 @@ public class ClientEventHandler { if (player == null) return; ItemStack stack = player.getMainHandItem(); if (!(stack.getItem() instanceof GunItem gunItem)) return; - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.hidePassenger()) + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.hidePassenger()) return; float pose; @@ -861,7 +865,7 @@ public class ClientEventHandler { cameraYaw = event.getYaw(); cameraRoll = event.getRoll(); - if (player != null && player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) { + if (player != null && player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) { return; } @@ -927,7 +931,7 @@ public class ClientEventHandler { } } - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) { + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) { event.setCanceled(true); } } @@ -1024,7 +1028,7 @@ public class ClientEventHandler { double speed = 1.5 - (0.07 * weight); if (zoom - && !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) + && !(player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) && !notInGame() && drawTime < 0.01 && !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) { @@ -1326,7 +1330,7 @@ public class ClientEventHandler { ItemStack stack = player.getMainHandItem(); - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand(player) && zoomVehicle) { + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand(player) && zoomVehicle) { event.setFOV(event.getFOV() / iArmedVehicle.zoomFov()); return; } @@ -1394,7 +1398,7 @@ public class ClientEventHandler { public static void setPlayerInvisible(RenderPlayerEvent.Pre event) { var otherPlayer = event.getEntity(); - if (otherPlayer.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) { + if (otherPlayer.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) { event.setCanceled(true); } } @@ -1421,7 +1425,7 @@ public class ClientEventHandler { event.setCanceled(true); } - if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player)) { + if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player)) { event.setCanceled(true); } diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java index 3d697dd24..ba1656595 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java @@ -1,6 +1,7 @@ package com.atsuishio.superbwarfare.event; import com.atsuishio.superbwarfare.entity.vehicle.*; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.tools.SeekTool; @@ -22,7 +23,7 @@ import java.util.List; import static com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity.PROPELLER_ROT; import static com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity.DELTA_ROT; -import static com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity.POWER; +import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.POWER; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ClientSoundHandler { diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 819fda8ee..5459bbe13 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -7,9 +7,9 @@ import com.atsuishio.superbwarfare.config.common.GameplayConfig; import com.atsuishio.superbwarfare.entity.ICustomKnockback; import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; -import com.atsuishio.superbwarfare.entity.vehicle.ContainerMobileVehicleEntity; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.network.ModVariables; @@ -54,7 +54,7 @@ public class LivingEventHandler { @SubscribeEvent public static void onEntityAttacked(LivingAttackEvent event) { if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION) && event.getEntity().getVehicle() instanceof VehicleEntity vehicle) { - if (event.getEntity().getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) { + if (event.getEntity().getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) { if (!(event.getSource().is(DamageTypes.EXPLOSION) || event.getSource().is(DamageTypes.PLAYER_EXPLOSION) || event.getSource().is(ModDamageTypes.CUSTOM_EXPLOSION) @@ -101,7 +101,7 @@ public class LivingEventHandler { private static void handleVehicleHurt(LivingHurtEvent event) { var vehicle = event.getEntity().getVehicle(); if (vehicle instanceof VehicleEntity) { - if (vehicle instanceof IArmedVehicleEntity iArmedVehicle) { + if (vehicle instanceof ArmedVehicleEntity iArmedVehicle) { if (iArmedVehicle.hidePassenger()) { if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION)) { event.setCanceled(true); @@ -779,7 +779,7 @@ public class LivingEventHandler { Player player = event.getAttackingPlayer(); if (player == null) return; - if (player.getVehicle() instanceof IArmedVehicleEntity) { + if (player.getVehicle() instanceof ArmedVehicleEntity) { player.giveExperiencePoints(event.getDroppedExperience()); event.setCanceled(true); return; diff --git a/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/JavelinItem.java b/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/JavelinItem.java index 614fd9ad0..d6df891b9 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/JavelinItem.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/JavelinItem.java @@ -5,7 +5,7 @@ import com.atsuishio.superbwarfare.client.PoseTool; import com.atsuishio.superbwarfare.client.renderer.item.JavelinItemRenderer; import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent; import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModSounds; diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java index c1b30e2c7..466a0b30d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.mixins; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.ModKeyMappings; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPlayerEntityMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPlayerEntityMixin.java index 4f01a73c4..b5c1c249d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPlayerEntityMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPlayerEntityMixin.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.mixins; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.mojang.authlib.GameProfile; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.player.AbstractClientPlayer; diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/ExplosionMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/ExplosionMixin.java index 0ba8af383..a323ba2e5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/ExplosionMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/ExplosionMixin.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.mixins; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.world.level.Explosion; import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Final; diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java index 90f3f16ec..65227b842 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java @@ -2,6 +2,8 @@ package com.atsuishio.superbwarfare.mixins; import com.atsuishio.superbwarfare.config.client.VehicleControlConfig; import com.atsuishio.superbwarfare.entity.vehicle.*; +import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModMobEffects; @@ -47,7 +49,7 @@ public class MouseHandlerMixin { return 0; } - if (player.getVehicle() instanceof ICannonEntity) { + if (player.getVehicle() instanceof CannonEntity) { return ClientEventHandler.zoomVehicle ? 0.15 : 0.3; } diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/PlayerEntityMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/PlayerEntityMixin.java index 389cc646a..28f555c73 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/PlayerEntityMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/PlayerEntityMixin.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.mixins; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Pose; diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/ChangeVehicleSeatMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/ChangeVehicleSeatMessage.java index 3ec268e9d..0491ca4de 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/ChangeVehicleSeatMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/ChangeVehicleSeatMessage.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.network.message; -import com.atsuishio.superbwarfare.entity.vehicle.MultiSeatVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiSeatVehicleEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.network.NetworkEvent; diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/LungeMineAttackMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/LungeMineAttackMessage.java index f7e7e08ce..db8f1252c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/LungeMineAttackMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/LungeMineAttackMessage.java @@ -1,7 +1,7 @@ package com.atsuishio.superbwarfare.network.message; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.tools.CustomExplosion; diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/PlayerStopRidingMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/PlayerStopRidingMessage.java index 76f886610..970dc2319 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/PlayerStopRidingMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/PlayerStopRidingMessage.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.network.message; -import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.network.NetworkEvent; diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/SwitchVehicleWeaponMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/SwitchVehicleWeaponMessage.java index 7208302ba..198b24b8d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/SwitchVehicleWeaponMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/SwitchVehicleWeaponMessage.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.network.message; -import com.atsuishio.superbwarfare.entity.vehicle.MultiWeaponVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MultiWeaponVehicleEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleFireMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleFireMessage.java index c74ffa1e4..d6d408c46 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleFireMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleFireMessage.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.network.message; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; @@ -28,7 +28,7 @@ public class VehicleFireMessage { if (context.getSender() != null) { var player = context.getSender(); - if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle) { + if (player.getVehicle() instanceof ArmedVehicleEntity iVehicle) { iVehicle.vehicleShoot(player); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleMovementMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleMovementMessage.java index e350ba5a7..8bf44850d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleMovementMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/VehicleMovementMessage.java @@ -1,6 +1,6 @@ package com.atsuishio.superbwarfare.network.message; -import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.tools.EntityFindUtil; import net.minecraft.network.FriendlyByteBuf; diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/ZoomMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/ZoomMessage.java index 18f75eaee..15336ebf3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/ZoomMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/ZoomMessage.java @@ -1,8 +1,8 @@ package com.atsuishio.superbwarfare.network.message; import com.atsuishio.superbwarfare.ModUtils; -import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.WheelChairEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.network.ModVariables; @@ -45,7 +45,7 @@ public class ZoomMessage { capability.syncPlayerVariables(player); }); - if (player.isPassenger() && player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) { + if (player.isPassenger() && player.getVehicle() instanceof ArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) { SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_IN.get(), 2, 1); } } @@ -57,7 +57,7 @@ public class ZoomMessage { capability.syncPlayerVariables(player); }); - if (player.isPassenger() && player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) { + if (player.isPassenger() && player.getVehicle() instanceof ArmedVehicleEntity && !(player.getVehicle() instanceof WheelChairEntity)) { SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_OUT.get(), 2, 1); } diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java index a1eb5b66d..66b6c0019 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java @@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.tools; import com.atsuishio.superbwarfare.entity.C4Entity; import com.atsuishio.superbwarfare.entity.ClaymoreEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; -import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.Entity;