重构载具相关文件结构
This commit is contained in:
parent
296f8d30e6
commit
f722c6a90c
65 changed files with 304 additions and 172 deletions
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.block;
|
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.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.block;
|
package com.atsuishio.superbwarfare.block;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
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.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -99,7 +99,7 @@ public class JumpPadBlock extends Block {
|
||||||
super.entityInside(blockstate, level, pos, entity);
|
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.isShiftKeyDown()) {
|
||||||
if (entity.onGround()) {
|
if (entity.onGround()) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.atsuishio.superbwarfare.compat.CompatHolder;
|
||||||
import com.atsuishio.superbwarfare.compat.clothconfig.ClothConfigHelper;
|
import com.atsuishio.superbwarfare.compat.clothconfig.ClothConfigHelper;
|
||||||
import com.atsuishio.superbwarfare.config.client.ReloadConfig;
|
import com.atsuishio.superbwarfare.config.client.ReloadConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
|
@ -94,7 +94,7 @@ public class ClickHandler {
|
||||||
int button = event.getButton();
|
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())
|
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) {
|
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class ClickHandler {
|
||||||
|
|
||||||
if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) {
|
if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) {
|
||||||
if (stack.is(ModTags.Items.GUN)
|
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);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class ClickHandler {
|
||||||
if (stack.is(ModTags.Items.GUN)
|
if (stack.is(ModTags.Items.GUN)
|
||||||
|| stack.is(ModItems.MONITOR.get())
|
|| stack.is(ModItems.MONITOR.get())
|
||||||
|| stack.is(ModItems.LUNGE_MINE.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()))) {
|
|| (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get()))) {
|
||||||
if (button == ModKeyMappings.FIRE.getKey().getValue()) {
|
if (button == ModKeyMappings.FIRE.getKey().getValue()) {
|
||||||
handleWeaponFirePress(player, stack);
|
handleWeaponFirePress(player, stack);
|
||||||
|
@ -266,7 +266,7 @@ public class ClickHandler {
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.GUN)
|
if (stack.is(ModTags.Items.GUN)
|
||||||
|| stack.is(ModItems.MONITOR.get())
|
|| 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()))) {
|
|| (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get()))) {
|
||||||
if (key == ModKeyMappings.FIRE.getKey().getValue()) {
|
if (key == ModKeyMappings.FIRE.getKey().getValue()) {
|
||||||
handleWeaponFirePress(player, stack);
|
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)) {
|
if (iVehicle.isDriver(player)) {
|
||||||
ClientEventHandler.holdFireVehicle = true;
|
ClientEventHandler.holdFireVehicle = true;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ public class ClickHandler {
|
||||||
ClientEventHandler.holdFire = true;
|
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"))
|
if ((!(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
||||||
&& !GunsTool.getGunBooleanTag(stack, "Reloading")
|
&& !GunsTool.getGunBooleanTag(stack, "Reloading")
|
||||||
&& !GunsTool.getGunBooleanTag(stack, "Charging")
|
&& !GunsTool.getGunBooleanTag(stack, "Charging")
|
||||||
|
@ -382,7 +382,7 @@ public class ClickHandler {
|
||||||
public static void handleWeaponZoomPress(Player player, ItemStack stack) {
|
public static void handleWeaponZoomPress(Player player, ItemStack stack) {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(0));
|
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)) {
|
if (iVehicle.isDriver(player)) {
|
||||||
ClientEventHandler.zoomVehicle = true;
|
ClientEventHandler.zoomVehicle = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.model.entity;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
|
@ -31,7 +31,7 @@ public class ProjectileEntityModel extends GeoModel<ProjectileEntity> {
|
||||||
|| player.getMainHandItem().is(ModItems.GLOCK_17.get())
|
|| player.getMainHandItem().is(ModItems.GLOCK_17.get())
|
||||||
|| player.getMainHandItem().is(ModItems.GLOCK_18.get())
|
|| player.getMainHandItem().is(ModItems.GLOCK_18.get())
|
||||||
|| player.getMainHandItem().is(ModItems.BOCEK.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");
|
return ModUtils.loc("geo/projectile_entity.geo.json");
|
||||||
} else {
|
} else {
|
||||||
return ModUtils.loc("geo/projectile_entity2.geo.json");
|
return ModUtils.loc("geo/projectile_entity2.geo.json");
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.tools.FormatTool;
|
import com.atsuishio.superbwarfare.tools.FormatTool;
|
||||||
import com.atsuishio.superbwarfare.tools.TraceTool;
|
import com.atsuishio.superbwarfare.tools.TraceTool;
|
||||||
|
@ -127,6 +127,6 @@ public class CannonHudOverlay {
|
||||||
private static boolean shouldRenderCrossHair(Player player) {
|
private static boolean shouldRenderCrossHair(Player player) {
|
||||||
if (player == null) return false;
|
if (player == null) return false;
|
||||||
return !player.isSpectator()
|
return !player.isSpectator()
|
||||||
&& (player.getVehicle() != null && (player.getVehicle() instanceof ICannonEntity));
|
&& (player.getVehicle() != null && (player.getVehicle() instanceof CannonEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.client.overlay;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
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)
|
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit)
|
||||||
return;
|
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();
|
GuiGraphics guiGraphics = event.getGuiGraphics();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.client.overlay;
|
package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||||
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
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)
|
if (player != null && player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit)
|
||||||
return;
|
return;
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
||||||
return;
|
return;
|
||||||
if (!shouldRenderCrossHair(player)) return;
|
if (!shouldRenderCrossHair(player)) return;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class GrenadeLauncherOverlay {
|
||||||
if (player == null) return false;
|
if (player == null) return false;
|
||||||
return !player.isSpectator()
|
return !player.isSpectator()
|
||||||
&& (player.getMainHandItem().getItem() == ModItems.M_79.get() || player.getMainHandItem().getItem() == ModItems.SECONDARY_CATACLYSM.get())
|
&& (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;
|
&& !ClientEventHandler.zoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,11 @@ package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.RenderHelper;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
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)
|
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit)
|
||||||
return;
|
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.pushPose();
|
||||||
|
|
||||||
poseStack.translate(-6 * ClientEventHandler.turnRot[1], -6 * ClientEventHandler.turnRot[0], 0);
|
poseStack.translate(-6 * ClientEventHandler.turnRot[1], -6 * ClientEventHandler.turnRot[0], 0);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.RenderHelper;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
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)
|
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit)
|
||||||
return;
|
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) {
|
if ((stack.getItem() == ModItems.JAVELIN.get() && !stack.getOrCreateTag().getBoolean("HoloHidden")) && Minecraft.getInstance().options.getCameraType().isFirstPerson() && ClientEventHandler.zoom) {
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.client.KillMessageConfig;
|
import com.atsuishio.superbwarfare.config.client.KillMessageConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.event.KillMessageHandler;
|
import com.atsuishio.superbwarfare.event.KillMessageHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -178,7 +178,7 @@ public class KillMessageOverlay {
|
||||||
|
|
||||||
if (player != null && player.getVehicle() instanceof VehicleEntity vehicleEntity) {
|
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;
|
renderItem = true;
|
||||||
|
|
||||||
ResourceLocation resourceLocation = vehicleEntity.getVehicleIcon();
|
ResourceLocation resourceLocation = vehicleEntity.getVehicleIcon();
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.RenderHelper;
|
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.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.tools.SeekTool;
|
import com.atsuishio.superbwarfare.tools.SeekTool;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
@ -37,7 +37,7 @@ public class RedTriangleOverlay {
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModItems.RPG.get())) return;
|
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;
|
return;
|
||||||
|
|
||||||
Entity idf = SeekTool.seekLivingEntity(player, player.level(), 128, 6);
|
Entity idf = SeekTool.seekLivingEntity(player, player.level(), 128, 6);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.RenderHelper;
|
import com.atsuishio.superbwarfare.client.RenderHelper;
|
||||||
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.tools.FormatTool;
|
import com.atsuishio.superbwarfare.tools.FormatTool;
|
||||||
|
@ -95,7 +96,7 @@ public class VehicleHudOverlay {
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
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;
|
boolean iCharge = iVehicle instanceof EnergyVehicleEntity;
|
||||||
|
|
||||||
// 渲染当前弹药量
|
// 渲染当前弹药量
|
||||||
|
@ -104,7 +105,7 @@ public class VehicleHudOverlay {
|
||||||
float v = h / 1.5f - (iCharge ? 42 : 29) / 1.5f;
|
float v = h / 1.5f - (iCharge ? 42 : 29) / 1.5f;
|
||||||
|
|
||||||
if (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))
|
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))
|
|| (iVehicle instanceof Ah6Entity ah6Entity && ah6Entity.getWeaponType(0) == 1))
|
||||||
) {
|
) {
|
||||||
event.getGuiGraphics().drawString(
|
event.getGuiGraphics().drawString(
|
||||||
|
@ -146,11 +147,11 @@ public class VehicleHudOverlay {
|
||||||
return !player.isSpectator() && (player.getVehicle() != null && player.getVehicle() instanceof VehicleEntity);
|
return !player.isSpectator() && (player.getVehicle() != null && player.getVehicle() instanceof VehicleEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getVehicleAmmoType(ItemStack stack, IArmedVehicleEntity iVehicle) {
|
private static String getVehicleAmmoType(ItemStack stack, ArmedVehicleEntity iVehicle) {
|
||||||
if (stack.getItem() == ModItems.AP_5_INCHES.get() && iVehicle instanceof ICannonEntity) {
|
if (stack.getItem() == ModItems.AP_5_INCHES.get() && iVehicle instanceof CannonEntity) {
|
||||||
return Component.translatable("des.superbwarfare.tips.ammo_type.ap").getString();
|
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();
|
return Component.translatable("des.superbwarfare.tips.ammo_type.he").getString();
|
||||||
}
|
}
|
||||||
if (iVehicle instanceof SpeedboatEntity) {
|
if (iVehicle instanceof SpeedboatEntity) {
|
||||||
|
@ -185,7 +186,7 @@ public class VehicleHudOverlay {
|
||||||
|
|
||||||
if (player == null) return;
|
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 MultiWeaponVehicleEntity multiWeaponVehicle
|
||||||
&& iLand instanceof MobileVehicleEntity mobileVehicle) {
|
&& iLand instanceof MobileVehicleEntity mobileVehicle) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.client.overlay;
|
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.FormatTool;
|
||||||
import com.atsuishio.superbwarfare.tools.TraceTool;
|
import com.atsuishio.superbwarfare.tools.TraceTool;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.client.screens;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.block.entity.FuMO25BlockEntity;
|
import com.atsuishio.superbwarfare.block.entity.FuMO25BlockEntity;
|
||||||
import com.atsuishio.superbwarfare.client.RenderHelper;
|
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.menu.FuMO25Menu;
|
||||||
import com.atsuishio.superbwarfare.network.message.RadarChangeModeMessage;
|
import com.atsuishio.superbwarfare.network.message.RadarChangeModeMessage;
|
||||||
import com.atsuishio.superbwarfare.network.message.RadarSetParametersMessage;
|
import com.atsuishio.superbwarfare.network.message.RadarSetParametersMessage;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.compat.jade;
|
||||||
import com.atsuishio.superbwarfare.block.ContainerBlock;
|
import com.atsuishio.superbwarfare.block.ContainerBlock;
|
||||||
import com.atsuishio.superbwarfare.compat.jade.providers.ContainerEntityProvider;
|
import com.atsuishio.superbwarfare.compat.jade.providers.ContainerEntityProvider;
|
||||||
import com.atsuishio.superbwarfare.compat.jade.providers.VehicleHealthProvider;
|
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.IWailaClientRegistration;
|
||||||
import snownee.jade.api.IWailaCommonRegistration;
|
import snownee.jade.api.IWailaCommonRegistration;
|
||||||
import snownee.jade.api.IWailaPlugin;
|
import snownee.jade.api.IWailaPlugin;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.compat.jade.providers;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.compat.jade.elements.WrenchHealthElement;
|
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 net.minecraft.resources.ResourceLocation;
|
||||||
import snownee.jade.api.EntityAccessor;
|
import snownee.jade.api.EntityAccessor;
|
||||||
import snownee.jade.api.IEntityComponentProvider;
|
import snownee.jade.api.IEntityComponentProvider;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.entity;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
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.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.entity;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
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.init.*;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.gui.RangeHelper;
|
import com.atsuishio.superbwarfare.client.gui.RangeHelper;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
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.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
@ -36,6 +36,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||||
|
@ -120,7 +121,7 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, AnimatedEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.getItem() instanceof MortarShell shell && !player.isShiftKeyDown() && this.entityData.get(FIRE_TIME) == 0) {
|
if (stack.getItem() instanceof MortarShell shell && !player.isShiftKeyDown() && this.entityData.get(FIRE_TIME) == 0) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.AnimatedEntity;
|
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.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
|
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.ChunkLoadTool;
|
import com.atsuishio.superbwarfare.tools.ChunkLoadTool;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.AnimatedEntity;
|
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.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.block.BarbedWireBlock;
|
import com.atsuishio.superbwarfare.block.BarbedWireBlock;
|
||||||
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
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.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.Transcript;
|
import com.atsuishio.superbwarfare.item.Transcript;
|
||||||
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
|
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
|
||||||
|
|
|
@ -6,6 +6,10 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -61,7 +65,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
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);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get();
|
public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get();
|
||||||
|
@ -667,7 +671,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
Vec3 vec3d = getDismountOffset(getBbWidth() * Mth.SQRT_OF_TWO, passenger.getBbWidth() * Mth.SQRT_OF_TWO);
|
||||||
double ox = getX() + vec3d.x;
|
double ox = getX() + vec3d.x;
|
||||||
int i = this.getOrderedPassengers().indexOf(passenger);
|
int i = this.getOrderedPassengers().indexOf(passenger);
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
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.NetworkHooks;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
|
@ -55,7 +58,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, ICannonEntity {
|
public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, CannonEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> LASER_LEFT_LENGTH = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> LASER_LEFT_LENGTH = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
@ -109,7 +112,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) {
|
if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) {
|
||||||
|
|
|
@ -6,6 +6,9 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -56,7 +59,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
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<Integer> FIRE_ANIM = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity;
|
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.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -287,7 +288,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (stack.getItem() == ModItems.MONITOR.get()) {
|
if (stack.getItem() == ModItems.MONITOR.get()) {
|
||||||
if (!player.isCrouching()) {
|
if (!player.isCrouching()) {
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle;
|
|
||||||
|
|
||||||
public interface ICannonEntity extends IArmedVehicleEntity {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle;
|
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
||||||
|
@ -35,6 +36,7 @@ import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
|
@ -166,7 +168,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (player.isCrouching()) {
|
if (player.isCrouching()) {
|
||||||
if (stack.is(ModItems.CROWBAR.get()) && (getOwner() == null || player == getOwner())) {
|
if (stack.is(ModItems.CROWBAR.get()) && (getOwner() == null || player == getOwner())) {
|
||||||
|
|
|
@ -5,6 +5,9 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -58,7 +61,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
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<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
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.NetworkHooks;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
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.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntity {
|
public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
@ -91,7 +94,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) {
|
if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
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.NetworkHooks;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
|
@ -51,7 +54,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEntity {
|
public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> TYPE = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> TYPE = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
|
||||||
|
@ -96,7 +99,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) {
|
if (player.getMainHandItem().getItem() == ModItems.FIRING_PARAMETERS.get() && player.isCrouching()) {
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle;
|
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MultiSeatVehicleEntity {
|
|
||||||
List<Entity> getOrderedPassengers();
|
|
||||||
|
|
||||||
Entity getNthEntity(int index);
|
|
||||||
|
|
||||||
boolean changeSeat(Entity entity, int index);
|
|
||||||
|
|
||||||
int getSeatIndex(Entity entity);
|
|
||||||
|
|
||||||
int getSeatCount();
|
|
||||||
}
|
|
|
@ -4,6 +4,8 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
|
@ -49,7 +51,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
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<Integer> FIRE_ANIM = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
|
@ -107,7 +108,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (player.getMainHandItem().is(Items.MELON) && !entityData.get(MELON)) {
|
||||||
entityData.set(MELON, true);
|
entityData.set(MELON, true);
|
||||||
player.getMainHandItem().shrink(1);
|
player.getMainHandItem().shrink(1);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
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.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
|
|
@ -4,6 +4,9 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -62,7 +65,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
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<Integer> FIRE_ANIM = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle;
|
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
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.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
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.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
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<Integer> AMMO = SynchedEntityData.defineId(Yx100GunEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Yx100GunEntity.class, EntityDataSerializers.INT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
|
@ -56,7 +59,7 @@ public class Yx100GunEntity extends VehicleEntity implements GeoEntity, ICannonE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
return super.interact(player, hand);
|
return super.interact(player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||||
|
|
||||||
|
public interface CannonEntity extends ArmedVehicleEntity {
|
||||||
|
|
||||||
|
}
|
|
@ -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.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.menu.VehicleMenu;
|
import com.atsuishio.superbwarfare.menu.VehicleMenu;
|
||||||
|
@ -29,11 +29,11 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Math;
|
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;
|
public static final int CONTAINER_SIZE = 102;
|
||||||
|
|
||||||
private NonNullList<ItemStack> items = NonNullList.withSize(CONTAINER_SIZE, ItemStack.EMPTY);
|
private final NonNullList<ItemStack> items = NonNullList.withSize(CONTAINER_SIZE, ItemStack.EMPTY);
|
||||||
private LazyOptional<?> itemHandler = LazyOptional.of(() -> new InvWrapper(this));
|
private LazyOptional<?> itemHandler = LazyOptional.of(() -> new InvWrapper(this));
|
||||||
|
|
||||||
public ContainerMobileVehicleEntity(EntityType<?> pEntityType, Level pLevel) {
|
public ContainerMobileVehicleEntity(EntityType<?> pEntityType, Level pLevel) {
|
||||||
|
@ -58,7 +58,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
if (player.getVehicle() == this) return InteractionResult.PASS;
|
if (player.getVehicle() == this) return InteractionResult.PASS;
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
@ -71,7 +71,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(RemovalReason pReason) {
|
public void remove(@NotNull RemovalReason pReason) {
|
||||||
if (!this.level().isClientSide && pReason != RemovalReason.DISCARDED) {
|
if (!this.level().isClientSide && pReason != RemovalReason.DISCARDED) {
|
||||||
Containers.dropContents(this.level(), this, this);
|
Containers.dropContents(this.level(), this, this);
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NonNullList<ItemStack> getItemStacks() {
|
public @NotNull NonNullList<ItemStack> getItemStacks() {
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,17 +207,17 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(int pSlot) {
|
public @NotNull ItemStack getItem(int pSlot) {
|
||||||
return this.items.get(pSlot);
|
return this.items.get(pSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItem(int pSlot, int pAmount) {
|
public @NotNull ItemStack removeItem(int pSlot, int pAmount) {
|
||||||
return ContainerHelper.removeItem(this.items, pSlot, pAmount);
|
return ContainerHelper.removeItem(this.items, pSlot, pAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItemNoUpdate(int pSlot) {
|
public @NotNull ItemStack removeItemNoUpdate(int pSlot) {
|
||||||
ItemStack itemstack = this.getItemStacks().get(pSlot);
|
ItemStack itemstack = this.getItemStacks().get(pSlot);
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
|
@ -228,7 +228,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItem(int pSlot, ItemStack pStack) {
|
public void setItem(int pSlot, @NotNull ItemStack pStack) {
|
||||||
this.getItemStacks().set(pSlot, pStack);
|
this.getItemStacks().set(pSlot, pStack);
|
||||||
if (!pStack.isEmpty() && pStack.getCount() > this.getMaxStackSize()) {
|
if (!pStack.isEmpty() && pStack.getCount() > this.getMaxStackSize()) {
|
||||||
pStack.setCount(this.getMaxStackSize());
|
pStack.setCount(this.getMaxStackSize());
|
||||||
|
@ -240,7 +240,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stillValid(Player pPlayer) {
|
public boolean stillValid(@NotNull Player pPlayer) {
|
||||||
return !this.isRemoved() && this.position().closerThan(pPlayer.position(), 8.0D);
|
return !this.isRemoved() && this.position().closerThan(pPlayer.position(), 8.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) {
|
public <T> @NotNull LazyOptional<T> getCapability(@NotNull Capability<T> capability, @Nullable Direction facing) {
|
||||||
if (this.isAlive() && capability == ForgeCapabilities.ITEM_HANDLER) {
|
if (this.isAlive() && capability == ForgeCapabilities.ITEM_HANDLER) {
|
||||||
return itemHandler.cast();
|
return itemHandler.cast();
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopOpen(Player pPlayer) {
|
public void stopOpen(@NotNull Player pPlayer) {
|
||||||
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(pPlayer));
|
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(pPlayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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 com.atsuishio.superbwarfare.capability.energy.SyncedEntityEnergyStorage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -15,7 +15,7 @@ import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EnergyVehicleEntity extends VehicleEntity {
|
public abstract class EnergyVehicleEntity extends VehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> ENERGY = SynchedEntityData.defineId(EnergyVehicleEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> ENERGY = SynchedEntityData.defineId(EnergyVehicleEntity.class, EntityDataSerializers.INT);
|
||||||
|
|
|
@ -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);
|
float getRotX(float tickDelta);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle;
|
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||||
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public interface ILandArmorEntity extends IArmedVehicleEntity {
|
public interface LandArmorEntity extends ArmedVehicleEntity {
|
||||||
|
|
||||||
float turretYRotO();
|
float turretYRotO();
|
||||||
|
|
|
@ -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.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.C4Entity;
|
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.FlareDecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
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.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
|
@ -38,7 +39,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
public class MobileVehicleEntity extends EnergyVehicleEntity {
|
public abstract class MobileVehicleEntity extends EnergyVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> POWER = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> 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));
|
Entity driver = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_DRIVER_UUID));
|
||||||
|
|
||||||
if ((verticalCollision)) {
|
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.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());
|
this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
||||||
} else if (Mth.abs((float) lastTickVerticalSpeed) > 0.6) {
|
} else if (Mth.abs((float) lastTickVerticalSpeed) > 0.6) {
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拥有多个按顺序排列的座位的载具,每个座位可以为空
|
||||||
|
* <p>
|
||||||
|
* 需要为实体自己重写addPassenger、getControllingPassenger、getFirstPassenger、removePassenger等方法
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface MultiSeatVehicleEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取按顺序排列的成员列表
|
||||||
|
*
|
||||||
|
* @return 按顺序排列的成员列表
|
||||||
|
*/
|
||||||
|
List<Entity> 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();
|
||||||
|
}
|
|
@ -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 {
|
||||||
/**
|
/**
|
||||||
* 检测该槽位是否有可用武器
|
* 检测该槽位是否有可用武器
|
||||||
*
|
*
|
|
@ -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.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
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.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -53,7 +54,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class VehicleEntity extends Entity {
|
public abstract class VehicleEntity extends Entity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
||||||
protected static final EntityDataAccessor<String> LAST_ATTACKER_UUID = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.STRING);
|
protected static final EntityDataAccessor<String> LAST_ATTACKER_UUID = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.STRING);
|
||||||
|
@ -119,7 +120,7 @@ public class VehicleEntity extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
if (player.getVehicle() == this) return InteractionResult.PASS;
|
if (player.getVehicle() == this) return InteractionResult.PASS;
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
@ -292,7 +293,7 @@ public class VehicleEntity extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canAddPassenger(Entity pPassenger) {
|
protected boolean canAddPassenger(@NotNull Entity pPassenger) {
|
||||||
return this.getPassengers().size() < this.getMaxPassengers();
|
return this.getPassengers().size() < this.getMaxPassengers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +490,7 @@ public class VehicleEntity extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
Vec3 vec3d = getDismountOffset(getBbWidth() * Mth.SQRT_OF_TWO, passenger.getBbWidth() * Mth.SQRT_OF_TWO);
|
||||||
double ox = getX() - vec3d.x;
|
double ox = getX() - vec3d.x;
|
||||||
double oz = getZ() + vec3d.z;
|
double oz = getZ() + vec3d.z;
|
|
@ -4,6 +4,10 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.ClickHandler;
|
import com.atsuishio.superbwarfare.client.ClickHandler;
|
||||||
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
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.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
|
@ -275,7 +279,7 @@ public class ClientEventHandler {
|
||||||
if (stack.getItem() instanceof GunItem gunItem) {
|
if (stack.getItem() instanceof GunItem gunItem) {
|
||||||
if (gunItem.canUseMelee(stack) && gunMelee == 0 && drawTime < 0.01
|
if (gunItem.canUseMelee(stack) && gunMelee == 0 && drawTime < 0.01
|
||||||
&& ModKeyMappings.MELEE.isDown()
|
&& ModKeyMappings.MELEE.isDown()
|
||||||
&& !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
&& !(player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
||||||
&& !holdFireVehicle
|
&& !holdFireVehicle
|
||||||
&& !notInGame()
|
&& !notInGame()
|
||||||
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit
|
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit
|
||||||
|
@ -431,7 +435,7 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((holdFire || burstFireSize > 0)
|
if ((holdFire || burstFireSize > 0)
|
||||||
&& !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
&& !(player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
||||||
&& !holdFireVehicle
|
&& !holdFireVehicle
|
||||||
&& (stack.is(ModTags.Items.NORMAL_GUN)
|
&& (stack.is(ModTags.Items.NORMAL_GUN)
|
||||||
&& cantFireTime == 0
|
&& cantFireTime == 0
|
||||||
|
@ -697,7 +701,7 @@ public class ClientEventHandler {
|
||||||
holdFireVehicle = false;
|
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();
|
int rpm = iVehicle.mainGunRpm();
|
||||||
if (rpm == 0) {
|
if (rpm == 0) {
|
||||||
rpm = 240;
|
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) {
|
if (iVehicle instanceof SpeedboatEntity speedboat) {
|
||||||
float pitch = speedboat.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - speedboat.getEntityData().get(HEAT)));
|
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);
|
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
|
||||||
|
@ -778,7 +782,7 @@ public class ClientEventHandler {
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!(stack.getItem() instanceof GunItem gunItem)) return;
|
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;
|
return;
|
||||||
|
|
||||||
float pose;
|
float pose;
|
||||||
|
@ -861,7 +865,7 @@ public class ClientEventHandler {
|
||||||
cameraYaw = event.getYaw();
|
cameraYaw = event.getYaw();
|
||||||
cameraRoll = event.getRoll();
|
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;
|
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);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1028,7 @@ public class ClientEventHandler {
|
||||||
double speed = 1.5 - (0.07 * weight);
|
double speed = 1.5 - (0.07 * weight);
|
||||||
|
|
||||||
if (zoom
|
if (zoom
|
||||||
&& !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
&& !(player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
|
||||||
&& !notInGame()
|
&& !notInGame()
|
||||||
&& drawTime < 0.01
|
&& drawTime < 0.01
|
||||||
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) {
|
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) {
|
||||||
|
@ -1326,7 +1330,7 @@ public class ClientEventHandler {
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
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());
|
event.setFOV(event.getFOV() / iArmedVehicle.zoomFov());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1394,7 +1398,7 @@ public class ClientEventHandler {
|
||||||
public static void setPlayerInvisible(RenderPlayerEvent.Pre event) {
|
public static void setPlayerInvisible(RenderPlayerEvent.Pre event) {
|
||||||
var otherPlayer = event.getEntity();
|
var otherPlayer = event.getEntity();
|
||||||
|
|
||||||
if (otherPlayer.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) {
|
if (otherPlayer.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1425,7 @@ public class ClientEventHandler {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player)) {
|
if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.event;
|
package com.atsuishio.superbwarfare.event;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
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.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.tools.SeekTool;
|
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.Ah6Entity.PROPELLER_ROT;
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity.DELTA_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)
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
|
||||||
public class ClientSoundHandler {
|
public class ClientSoundHandler {
|
||||||
|
|
|
@ -7,9 +7,9 @@ import com.atsuishio.superbwarfare.config.common.GameplayConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.ContainerMobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
|
@ -54,7 +54,7 @@ public class LivingEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onEntityAttacked(LivingAttackEvent event) {
|
public static void onEntityAttacked(LivingAttackEvent event) {
|
||||||
if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION) && event.getEntity().getVehicle() instanceof VehicleEntity vehicle) {
|
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)
|
if (!(event.getSource().is(DamageTypes.EXPLOSION)
|
||||||
|| event.getSource().is(DamageTypes.PLAYER_EXPLOSION)
|
|| event.getSource().is(DamageTypes.PLAYER_EXPLOSION)
|
||||||
|| event.getSource().is(ModDamageTypes.CUSTOM_EXPLOSION)
|
|| event.getSource().is(ModDamageTypes.CUSTOM_EXPLOSION)
|
||||||
|
@ -101,7 +101,7 @@ public class LivingEventHandler {
|
||||||
private static void handleVehicleHurt(LivingHurtEvent event) {
|
private static void handleVehicleHurt(LivingHurtEvent event) {
|
||||||
var vehicle = event.getEntity().getVehicle();
|
var vehicle = event.getEntity().getVehicle();
|
||||||
if (vehicle instanceof VehicleEntity) {
|
if (vehicle instanceof VehicleEntity) {
|
||||||
if (vehicle instanceof IArmedVehicleEntity iArmedVehicle) {
|
if (vehicle instanceof ArmedVehicleEntity iArmedVehicle) {
|
||||||
if (iArmedVehicle.hidePassenger()) {
|
if (iArmedVehicle.hidePassenger()) {
|
||||||
if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION)) {
|
if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
@ -779,7 +779,7 @@ public class LivingEventHandler {
|
||||||
Player player = event.getAttackingPlayer();
|
Player player = event.getAttackingPlayer();
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity) {
|
if (player.getVehicle() instanceof ArmedVehicleEntity) {
|
||||||
player.giveExperiencePoints(event.getDroppedExperience());
|
player.giveExperiencePoints(event.getDroppedExperience());
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.atsuishio.superbwarfare.client.PoseTool;
|
||||||
import com.atsuishio.superbwarfare.client.renderer.item.JavelinItemRenderer;
|
import com.atsuishio.superbwarfare.client.renderer.item.JavelinItemRenderer;
|
||||||
import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent;
|
import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
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 com.atsuishio.superbwarfare.init.ModKeyMappings;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
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 com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.player.AbstractClientPlayer;
|
import net.minecraft.client.player.AbstractClientPlayer;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
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.level.Explosion;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.atsuishio.superbwarfare.mixins;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
|
import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
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.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
||||||
|
@ -47,7 +49,7 @@ public class MouseHandlerMixin {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof ICannonEntity) {
|
if (player.getVehicle() instanceof CannonEntity) {
|
||||||
return ClientEventHandler.zoomVehicle ? 0.15 : 0.3;
|
return ClientEventHandler.zoomVehicle ? 0.15 : 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
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.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.Pose;
|
import net.minecraft.world.entity.Pose;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
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.network.FriendlyByteBuf;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
package com.atsuishio.superbwarfare.network.message;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
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.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
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.network.FriendlyByteBuf;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
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.network.FriendlyByteBuf;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
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.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class VehicleFireMessage {
|
||||||
if (context.getSender() != null) {
|
if (context.getSender() != null) {
|
||||||
var player = context.getSender();
|
var player = context.getSender();
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle) {
|
if (player.getVehicle() instanceof ArmedVehicleEntity iVehicle) {
|
||||||
iVehicle.vehicleShoot(player);
|
iVehicle.vehicleShoot(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
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.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
package com.atsuishio.superbwarfare.network.message;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
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.WheelChairEntity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
|
@ -45,7 +45,7 @@ public class ZoomMessage {
|
||||||
capability.syncPlayerVariables(player);
|
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);
|
SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_IN.get(), 2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class ZoomMessage {
|
||||||
capability.syncPlayerVariables(player);
|
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);
|
SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_OUT.get(), 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.tools;
|
||||||
import com.atsuishio.superbwarfare.entity.C4Entity;
|
import com.atsuishio.superbwarfare.entity.C4Entity;
|
||||||
import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
|
import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
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.core.BlockPos;
|
||||||
import net.minecraft.world.entity.AreaEffectCloud;
|
import net.minecraft.world.entity.AreaEffectCloud;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
Loading…
Add table
Reference in a new issue