优化武装载具主驾驶逻辑
This commit is contained in:
parent
a345cdf9e7
commit
f40776a9ac
23 changed files with 301 additions and 253 deletions
|
@ -136,7 +136,6 @@ public class ModUtils {
|
||||||
addNetworkMessage(AdjustZoomFovMessage.class, AdjustZoomFovMessage::encode, AdjustZoomFovMessage::decode, AdjustZoomFovMessage::handler);
|
addNetworkMessage(AdjustZoomFovMessage.class, AdjustZoomFovMessage::encode, AdjustZoomFovMessage::decode, AdjustZoomFovMessage::handler);
|
||||||
addNetworkMessage(AdjustMortarAngleMessage.class, AdjustMortarAngleMessage::encode, AdjustMortarAngleMessage::decode, AdjustMortarAngleMessage::handler);
|
addNetworkMessage(AdjustMortarAngleMessage.class, AdjustMortarAngleMessage::encode, AdjustMortarAngleMessage::decode, AdjustMortarAngleMessage::handler);
|
||||||
addNetworkMessage(InteractMessage.class, InteractMessage::encode, InteractMessage::decode, InteractMessage::handler);
|
addNetworkMessage(InteractMessage.class, InteractMessage::encode, InteractMessage::decode, InteractMessage::handler);
|
||||||
addNetworkMessage(DroneMovementMessage.class, DroneMovementMessage::encode, DroneMovementMessage::decode, DroneMovementMessage::handler);
|
|
||||||
addNetworkMessage(VehicleMovementMessage.class, VehicleMovementMessage::encode, VehicleMovementMessage::decode, VehicleMovementMessage::handler);
|
addNetworkMessage(VehicleMovementMessage.class, VehicleMovementMessage::encode, VehicleMovementMessage::decode, VehicleMovementMessage::handler);
|
||||||
addNetworkMessage(DroneFireMessage.class, DroneFireMessage::encode, DroneFireMessage::decode, DroneFireMessage::handler);
|
addNetworkMessage(DroneFireMessage.class, DroneFireMessage::encode, DroneFireMessage::decode, DroneFireMessage::handler);
|
||||||
addNetworkMessage(SimulationDistanceMessage.class, SimulationDistanceMessage::encode, SimulationDistanceMessage::decode, SimulationDistanceMessage::handle, Optional.of(NetworkDirection.PLAY_TO_CLIENT));
|
addNetworkMessage(SimulationDistanceMessage.class, SimulationDistanceMessage::encode, SimulationDistanceMessage::decode, SimulationDistanceMessage::handle, Optional.of(NetworkDirection.PLAY_TO_CLIENT));
|
||||||
|
|
|
@ -5,7 +5,10 @@ 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.IArmedVehicleEntity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
||||||
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;
|
||||||
|
@ -92,7 +95,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 && !(player.getVehicle() instanceof WheelChairEntity))) {
|
|| (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand())) {
|
||||||
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
@ -104,10 +107,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 ICannonEntity)
|
|| (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && !stack.getItem().isEdible())) {
|
||||||
|| (player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.getFirstPassenger() == player && !stack.getItem().isEdible())
|
|
||||||
|| (player.getVehicle() instanceof Lav150Entity lav150 && lav150.isDriver(player) && !stack.getItem().isEdible())
|
|
||||||
|| (player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player && stack.is(ItemStack.EMPTY.getItem()))) {
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,10 +118,9 @@ public class ClickHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stack.is(ModTags.Items.GUN) && !(player.getVehicle() instanceof ICannonEntity))
|
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 ICannonEntity)
|
|
||||||
|| (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player))
|
|| (player.getVehicle() instanceof IArmedVehicleEntity 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()) {
|
||||||
|
@ -166,11 +165,6 @@ public class ClickHandler {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && ClientEventHandler.zoom) {
|
|
||||||
ClientEventHandler.vehicleFov = Mth.clamp(ClientEventHandler.vehicleFov + 0.4 * scroll, 1, 6);
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
||||||
ClientEventHandler.droneFov = Mth.clamp(ClientEventHandler.droneFov + 0.4 * scroll, 1, 6);
|
ClientEventHandler.droneFov = Mth.clamp(ClientEventHandler.droneFov + 0.4 * scroll, 1, 6);
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
@ -255,9 +249,8 @@ public class ClickHandler {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new SensitivityMessage(false));
|
ModUtils.PACKET_HANDLER.sendToServer(new SensitivityMessage(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stack.is(ModTags.Items.GUN) && !(player.getVehicle() instanceof ICannonEntity))
|
if (stack.is(ModTags.Items.GUN)
|
||||||
|| stack.is(ModItems.MONITOR.get())
|
|| stack.is(ModItems.MONITOR.get())
|
||||||
|| (player.getVehicle() instanceof ICannonEntity)
|
|
||||||
|| (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player))
|
|| (player.getVehicle() instanceof IArmedVehicleEntity 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()) {
|
||||||
|
@ -307,13 +300,10 @@ public class ClickHandler {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneFireMessage(0));
|
ModUtils.PACKET_HANDLER.sendToServer(new DroneFireMessage(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof ICannonEntity) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new VehicleFireMessage(0));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player)) {
|
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.banHand()) {
|
||||||
ClientEventHandler.holdFire = true;
|
ClientEventHandler.holdFireVehicle = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(ModItems.LUNGE_MINE.get())) {
|
if (stack.is(ModItems.LUNGE_MINE.get())) {
|
||||||
|
@ -350,11 +340,18 @@ public class ClickHandler {
|
||||||
public static void handleWeaponFireRelease() {
|
public static void handleWeaponFireRelease() {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new FireMessage(1));
|
ModUtils.PACKET_HANDLER.sendToServer(new FireMessage(1));
|
||||||
ClientEventHandler.holdFire = false;
|
ClientEventHandler.holdFire = false;
|
||||||
|
ClientEventHandler.holdFireVehicle = false;
|
||||||
ClientEventHandler.customRpm = 0;
|
ClientEventHandler.customRpm = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.isDriver(player) && iVehicle.banHand()) {
|
||||||
|
ClientEventHandler.zoomVehicle = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ClientEventHandler.zoom = true;
|
ClientEventHandler.zoom = true;
|
||||||
int level = PerkHelper.getItemPerkLevel(ModPerks.INTELLIGENT_CHIP.get(), stack);
|
int level = PerkHelper.getItemPerkLevel(ModPerks.INTELLIGENT_CHIP.get(), stack);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
|
@ -367,6 +364,7 @@ public class ClickHandler {
|
||||||
public static void handleWeaponZoomRelease() {
|
public static void handleWeaponZoomRelease() {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(1));
|
ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(1));
|
||||||
ClientEventHandler.zoom = false;
|
ClientEventHandler.zoom = false;
|
||||||
|
ClientEventHandler.zoomVehicle = false;
|
||||||
ClientEventHandler.entity = null;
|
ClientEventHandler.entity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,33 +387,9 @@ public class ClickHandler {
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
handleDroneMove(key, state, player);
|
|
||||||
handleVehicleMove(key, state, player);
|
handleVehicleMove(key, state, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleDroneMove(int key, int state, Player player) {
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
|
||||||
if (!stack.is(ModItems.MONITOR.get())) return;
|
|
||||||
if (!stack.getOrCreateTag().getBoolean("Using")) return;
|
|
||||||
if (!stack.getOrCreateTag().getBoolean("Linked")) return;
|
|
||||||
|
|
||||||
var options = Minecraft.getInstance().options;
|
|
||||||
|
|
||||||
if (key == options.keyLeft.getKey().getValue()) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneMovementMessage(0, state == 1));
|
|
||||||
} else if (key == options.keyRight.getKey().getValue()) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneMovementMessage(1, state == 1));
|
|
||||||
} else if (key == options.keyUp.getKey().getValue()) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneMovementMessage(2, state == 1));
|
|
||||||
} else if (key == options.keyDown.getKey().getValue()) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneMovementMessage(3, state == 1));
|
|
||||||
} else if (key == options.keyJump.getKey().getValue()) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneMovementMessage(4, state == 1));
|
|
||||||
} else if (key == options.keyShift.getKey().getValue()) {
|
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneMovementMessage(5, state == 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void handleVehicleMove(int key, int state, Player player) {
|
private static void handleVehicleMove(int key, int state, Player player) {
|
||||||
if (player.getVehicle() != null && player.getVehicle() instanceof MobileVehicleEntity && player.getVehicle().getFirstPassenger() == player) {
|
if (player.getVehicle() != null && player.getVehicle() instanceof MobileVehicleEntity && player.getVehicle().getFirstPassenger() == player) {
|
||||||
var options = Minecraft.getInstance().options;
|
var options = Minecraft.getInstance().options;
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class CannonHudOverlay {
|
||||||
int j = Mth.floor(f * f1);
|
int j = Mth.floor(f * f1);
|
||||||
int k = (w - i) / 2;
|
int k = (w - i) / 2;
|
||||||
int l = (h - j) / 2;
|
int l = (h - j) / 2;
|
||||||
if (ClientEventHandler.zoom) {
|
if (ClientEventHandler.zoomVehicle) {
|
||||||
Entity lookingEntity = TraceTool.findLookingEntity(player, 512);
|
Entity lookingEntity = TraceTool.findLookingEntity(player, 512);
|
||||||
boolean lookAtEntity = false;
|
boolean lookAtEntity = false;
|
||||||
double blockRange = player.position().distanceTo((Vec3.atLowerCornerOf(player.level().clip(
|
double blockRange = player.position().distanceTo((Vec3.atLowerCornerOf(player.level().clip(
|
||||||
|
|
|
@ -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.ICannonEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
||||||
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;
|
||||||
|
@ -56,7 +56,7 @@ 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.getVehicle() != null && player.getVehicle() instanceof ICannonEntity) return;
|
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand()) return;
|
||||||
|
|
||||||
GuiGraphics guiGraphics = event.getGuiGraphics();
|
GuiGraphics guiGraphics = event.getGuiGraphics();
|
||||||
|
|
||||||
|
|
|
@ -2,10 +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.IHelicopterEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.MultiWeaponVehicleEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.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;
|
||||||
|
@ -118,11 +115,15 @@ public class HelicopterHudOverlay {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72) + "KM/H"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72) + "KM/H"),
|
||||||
w / 2 - 140, h / 2, 0x66FF00, false);
|
w / 2 - 140, h / 2, 0x66FF00, false);
|
||||||
|
|
||||||
|
if (mobileVehicle instanceof Ah6Entity ah6Entity) {
|
||||||
if (multiWeaponVehicle.getWeaponType() == 0) {
|
if (multiWeaponVehicle.getWeaponType() == 0) {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "∞" : iHelicopterEntity.getAmmoCount(player))), w / 2 - 160, h / 2 - 60, 0x66FF00, false);
|
double heat = 1 - ah6Entity.heat / 100.0F;
|
||||||
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "∞" : iHelicopterEntity.getAmmoCount(player))), w / 2 - 160, h / 2 - 60, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
|
||||||
} else {
|
} else {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + iHelicopterEntity.getAmmoCount(player)), w / 2 - 160, h / 2 - 60, 0x66FF00, false);
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + iHelicopterEntity.getAmmoCount(player)), w / 2 - 160, h / 2 - 60, 0x66FF00, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("FLARE " + iHelicopterEntity.getDecoy()), w / 2 - 160, h / 2 - 50, 0x66FF00, false);
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("FLARE " + iHelicopterEntity.getDecoy()), w / 2 - 160, h / 2 - 50, 0x66FF00, false);
|
||||||
|
|
||||||
|
@ -160,7 +161,7 @@ public class HelicopterHudOverlay {
|
||||||
|
|
||||||
var cPos = cameraPos.add(lookAngle);
|
var cPos = cameraPos.add(lookAngle);
|
||||||
|
|
||||||
Vec3 p = RenderHelper.worldToScreen(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z).add(mobileVehicle.getViewVector(event.getPartialTick()).scale(192)), ClientEventHandler.zoom ? cPos : cameraPos);
|
Vec3 p = RenderHelper.worldToScreen(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z).add(mobileVehicle.getViewVector(event.getPartialTick()).scale(192)), ClientEventHandler.zoomVehicle ? cPos : cameraPos);
|
||||||
|
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
|
@ -182,11 +183,15 @@ public class HelicopterHudOverlay {
|
||||||
poseStack.translate(x, y, 0);
|
poseStack.translate(x, y, 0);
|
||||||
poseStack.scale(0.75f, 0.75f, 1);
|
poseStack.scale(0.75f, 0.75f, 1);
|
||||||
|
|
||||||
|
if (mobileVehicle instanceof Ah6Entity ah6Entity) {
|
||||||
if (multiWeaponVehicle.getWeaponType() == 0) {
|
if (multiWeaponVehicle.getWeaponType() == 0) {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "∞" : iHelicopterEntity.getAmmoCount(player))), 25, -9, -1, false);
|
double heat = ah6Entity.heat / 100.0F;
|
||||||
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "∞" : iHelicopterEntity.getAmmoCount(player))), 25, -9, Mth.hsvToRgb(0F, (float) heat, 1.0F), false);
|
||||||
} else {
|
} else {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + iHelicopterEntity.getAmmoCount(player)), 25, -9, -1, false);
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + iHelicopterEntity.getAmmoCount(player)), 25, -9, -1, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("FLARE " + iHelicopterEntity.getDecoy()), 25, 1, -1, false);
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("FLARE " + iHelicopterEntity.getDecoy()), 25, 1, -1, false);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
|
@ -2,6 +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.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,6 +56,7 @@ 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.isDriver(player) && iArmedVehicle.banHand()) 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();
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.joml.Math;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||||
|
import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*;
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.HEAT;
|
import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.HEAT;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||||
|
@ -144,6 +145,8 @@ public class LandArmorHudOverlay {
|
||||||
|
|
||||||
double heal = lav150.getHealth() / lav150.getMaxHealth();
|
double heal = lav150.getHealth() / lav150.getMaxHealth();
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(100 * lav150.getHealth() / lav150.getMaxHealth())), w / 2 - 165, h / 2 - 46, Mth.hsvToRgb((float) heal / 3.745318352059925F, 1.0F, 1.0F), false);
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(100 * lav150.getHealth() / lav150.getMaxHealth())), w / 2 - 165, h / 2 - 46, Mth.hsvToRgb((float) heal / 3.745318352059925F, 1.0F, 1.0F), false);
|
||||||
|
|
||||||
|
renderKillIndicator(guiGraphics, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
@ -151,4 +154,30 @@ public class LandArmorHudOverlay {
|
||||||
scopeScale = 0.7f;
|
scopeScale = 0.7f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void renderKillIndicator(GuiGraphics guiGraphics, int w, int h) {
|
||||||
|
float posX = w / 2f - 7.5f + (float) (2 * (java.lang.Math.random() - 0.5f));
|
||||||
|
float posY = h / 2f - 7.5f + (float) (2 * (java.lang.Math.random() - 0.5f));
|
||||||
|
float rate = (40 - KILL_INDICATOR * 5) / 5.5f;
|
||||||
|
|
||||||
|
if (HIT_INDICATOR > 0) {
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/hit_marker.png"), posX, posY, 0, 0, 16, 16, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HEAD_INDICATOR > 0) {
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/headshot_mark.png"), posX, posY, 0, 0, 16, 16, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KILL_INDICATOR > 0) {
|
||||||
|
float posX1 = w / 2f - 7.5f - 2 + rate;
|
||||||
|
float posY1 = h / 2f - 7.5f - 2 + rate;
|
||||||
|
float posX2 = w / 2f - 7.5f + 2 - rate;
|
||||||
|
float posY2 = h / 2f - 7.5f + 2 - rate;
|
||||||
|
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/kill_mark1.png"), posX1, posY1, 0, 0, 16, 16, 16, 16);
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/kill_mark2.png"), posX2, posY1, 0, 0, 16, 16, 16, 16);
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/kill_mark3.png"), posX1, posY2, 0, 0, 16, 16, 16, 16);
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/kill_mark4.png"), posX2, posY2, 0, 0, 16, 16, 16, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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.ICannonEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -28,6 +29,7 @@ public class M79UIOverlay {
|
||||||
|
|
||||||
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.isDriver(player) && iArmedVehicle.banHand()) return;
|
||||||
|
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
RenderSystem.depthMask(false);
|
RenderSystem.depthMask(false);
|
||||||
|
|
|
@ -2,6 +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.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.tools.HudUtil;
|
import com.atsuishio.superbwarfare.tools.HudUtil;
|
||||||
import com.atsuishio.superbwarfare.tools.SeekTool;
|
import com.atsuishio.superbwarfare.tools.SeekTool;
|
||||||
|
@ -37,6 +38,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.isDriver(player) && iArmedVehicle.banHand()) return;
|
||||||
|
|
||||||
Entity idf = SeekTool.seekLivingEntity(player, player.level(), 128, 6);
|
Entity idf = SeekTool.seekLivingEntity(player, player.level(), 128, 6);
|
||||||
if (idf == null) return;
|
if (idf == null) return;
|
||||||
|
|
|
@ -8,9 +8,7 @@ import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
@ -20,10 +18,6 @@ import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||||
public class VehicleMgHudOverlay {
|
public class VehicleMgHudOverlay {
|
||||||
|
|
||||||
|
@ -54,19 +48,11 @@ public class VehicleMgHudOverlay {
|
||||||
int k = (w - i) / 2;
|
int k = (w - i) / 2;
|
||||||
int l = (h - j) / 2;
|
int l = (h - j) / 2;
|
||||||
RenderHelper.preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j);
|
RenderHelper.preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
|
|
||||||
if (ClientEventHandler.vehicleFovLerp > 1.01) {
|
|
||||||
event.getGuiGraphics().blit(ModUtils.loc("textures/screens/drone_fov.png"), w / 2 + 100, h / 2 - 64, 0, 0, 64, 129, 64, 129);
|
|
||||||
GuiGraphics guiGraphics = event.getGuiGraphics();
|
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/drone_fov_move.png"), (float) w / 2 + 100, (float) (h / 2 - 64 - ((ClientEventHandler.vehicleFovLerp - 1) * 23.8)), 0, 0, 64, 129, 64, 129);
|
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##.#").format(ClientEventHandler.vehicleFovLerp) + "x"),
|
|
||||||
w / 2 + 144, h / 2 + 56 - (int) ((ClientEventHandler.vehicleFovLerp - 1) * 23.8), -1, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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() instanceof SpeedboatEntity && ClientEventHandler.zoom && !player.getMainHandItem().is(ModTags.Items.GUN);
|
&& player.getVehicle() instanceof SpeedboatEntity && ClientEventHandler.zoomVehicle && !player.getMainHandItem().is(ModTags.Items.GUN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,14 @@ public class VehicleConfig {
|
||||||
public static ForgeConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_DAMAGE;
|
public static ForgeConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_DAMAGE;
|
||||||
public static ForgeConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_RADIUS;
|
public static ForgeConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_RADIUS;
|
||||||
|
|
||||||
|
public static ForgeConfigSpec.IntValue LAV_150_HP;
|
||||||
|
public static ForgeConfigSpec.IntValue LAV_150_ENERGY_COST;
|
||||||
|
public static ForgeConfigSpec.IntValue LAV_150_MAX_ENERGY;
|
||||||
|
public static ForgeConfigSpec.IntValue LAV_150_CANNON_DAMAGE;
|
||||||
|
public static ForgeConfigSpec.IntValue LAV_150_CANNON_EXPLOSION_DAMAGE;
|
||||||
|
public static ForgeConfigSpec.IntValue LAV_150_CANNON_EXPLOSION_RADIUS;
|
||||||
|
|
||||||
|
|
||||||
public static void init(ForgeConfigSpec.Builder builder) {
|
public static void init(ForgeConfigSpec.Builder builder) {
|
||||||
builder.push("mk_42");
|
builder.push("mk_42");
|
||||||
|
|
||||||
|
@ -111,10 +119,10 @@ public class VehicleConfig {
|
||||||
SPEEDBOAT_ENERGY_COST = builder.defineInRange("speedboat_energy_cost", 16, 0, 2147483647);
|
SPEEDBOAT_ENERGY_COST = builder.defineInRange("speedboat_energy_cost", 16, 0, 2147483647);
|
||||||
|
|
||||||
builder.comment("The max energy storage of Speedboat");
|
builder.comment("The max energy storage of Speedboat");
|
||||||
SPEEDBOAT_MAX_ENERGY = builder.defineInRange("speedboat_max_energy", 1000000, 0, 2147483647);
|
SPEEDBOAT_MAX_ENERGY = builder.defineInRange("speedboat_max_energy", 10000000, 0, 2147483647);
|
||||||
|
|
||||||
builder.comment("The gun damage of Speedboat");
|
builder.comment("The gun damage of Speedboat");
|
||||||
SPEEDBOAT_GUN_DAMAGE = builder.defineInRange("speedboat_gun_damage", 45, 1, 10000000);
|
SPEEDBOAT_GUN_DAMAGE = builder.defineInRange("speedboat_gun_damage", 25, 1, 10000000);
|
||||||
|
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
|
@ -145,6 +153,28 @@ public class VehicleConfig {
|
||||||
AH_6_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("ah_6_rocket_explosion_radius", 5, 1, 10000000);
|
AH_6_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("ah_6_rocket_explosion_radius", 5, 1, 10000000);
|
||||||
|
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
|
builder.push("lav_150");
|
||||||
|
|
||||||
|
builder.comment("The HealthPoint of Lav_150");
|
||||||
|
LAV_150_HP = builder.defineInRange("lav_150_hp", 850, 1, 10000000);
|
||||||
|
|
||||||
|
builder.comment("The energy cost of Lav_150 per tick");
|
||||||
|
LAV_150_ENERGY_COST = builder.defineInRange("lav_150_energy_cost", 64, 0, 2147483647);
|
||||||
|
|
||||||
|
builder.comment("The max energy storage of Lav_150");
|
||||||
|
LAV_150_MAX_ENERGY = builder.defineInRange("lav_150_max_energy", 3000000, 0, 2147483647);
|
||||||
|
|
||||||
|
builder.comment("The cannon damage of Lav_150");
|
||||||
|
LAV_150_CANNON_DAMAGE = builder.defineInRange("lav_150_cannon_damage", 40, 1, 10000000);
|
||||||
|
|
||||||
|
builder.comment("The rocket explosion damage of Lav_150");
|
||||||
|
LAV_150_CANNON_EXPLOSION_DAMAGE = builder.defineInRange("lav_150_cannon_explosion_damage", 12, 1, 10000000);
|
||||||
|
|
||||||
|
builder.comment("The rocket explosion radius of Lav_150");
|
||||||
|
LAV_150_CANNON_EXPLOSION_RADIUS = builder.defineInRange("lav_150_cannon_explosion_radius", 3, 1, 10000000);
|
||||||
|
|
||||||
|
builder.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
@ -78,6 +79,8 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
public int reloadCoolDown;
|
public int reloadCoolDown;
|
||||||
public int decoyReloadCoolDown;
|
public int decoyReloadCoolDown;
|
||||||
public int fireIndex;
|
public int fireIndex;
|
||||||
|
public boolean cannotFire;
|
||||||
|
public int heat;
|
||||||
|
|
||||||
public Ah6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Ah6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.AH_6.get(), world);
|
this(ModEntities.AH_6.get(), world);
|
||||||
|
@ -127,10 +130,10 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false);
|
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false);
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||||
amount *= 2f;
|
amount *= 1f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
||||||
amount *= 3f;
|
amount *= 1.5f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.GUN_FIRE)) {
|
if (source.is(ModDamageTypes.GUN_FIRE)) {
|
||||||
amount *= 0.3f;
|
amount *= 0.3f;
|
||||||
|
@ -138,6 +141,9 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
|
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
|
||||||
amount *= 0.7f;
|
amount *= 0.7f;
|
||||||
}
|
}
|
||||||
|
if (source.is(ModDamageTypes.VEHICLE_STRIKE)) {
|
||||||
|
amount *= 4f;
|
||||||
|
}
|
||||||
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
||||||
this.hurt(0.75f * Math.max(amount - 5, 0));
|
this.hurt(0.75f * Math.max(amount - 5, 0));
|
||||||
return true;
|
return true;
|
||||||
|
@ -148,6 +154,24 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
propellerRotO = this.getPropellerRot();
|
propellerRotO = this.getPropellerRot();
|
||||||
super.baseTick();
|
super.baseTick();
|
||||||
|
|
||||||
|
if (heat > 0) {
|
||||||
|
heat--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (heat < 40) {
|
||||||
|
cannotFire = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity driver = this.getFirstPassenger();
|
||||||
|
if (driver instanceof Player player) {
|
||||||
|
if (heat > 100) {
|
||||||
|
cannotFire = true;
|
||||||
|
if (!player.level().isClientSide() && player instanceof ServerPlayer serverPlayer) {
|
||||||
|
SoundTool.playLocalSound(serverPlayer, ModSounds.MINIGUN_OVERHEAT.get(), 1f, 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
if (reloadCoolDown > 0) {
|
if (reloadCoolDown > 0) {
|
||||||
reloadCoolDown--;
|
reloadCoolDown--;
|
||||||
|
@ -486,6 +510,8 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
Vector4f worldPositionLeft;
|
Vector4f worldPositionLeft;
|
||||||
|
|
||||||
if (entityData.get(WEAPON_TYPE) == 0) {
|
if (entityData.get(WEAPON_TYPE) == 0) {
|
||||||
|
if (this.cannotFire) return;
|
||||||
|
|
||||||
x = 1.15f;
|
x = 1.15f;
|
||||||
y = 0.62f;
|
y = 0.62f;
|
||||||
z = 0.8f;
|
z = 0.8f;
|
||||||
|
@ -656,7 +682,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
@Override
|
@Override
|
||||||
public boolean canShoot(Player player) {
|
public boolean canShoot(Player player) {
|
||||||
if (entityData.get(WEAPON_TYPE) == 0) {
|
if (entityData.get(WEAPON_TYPE) == 0) {
|
||||||
return this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()));
|
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) && !cannotFire;
|
||||||
} else if (entityData.get(WEAPON_TYPE) == 1) {
|
} else if (entityData.get(WEAPON_TYPE) == 1) {
|
||||||
return this.entityData.get(AMMO) > 0;
|
return this.entityData.get(AMMO) > 0;
|
||||||
}
|
}
|
||||||
|
@ -668,6 +694,21 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
return this.entityData.get(AMMO);
|
return this.entityData.get(AMMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean banHand() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hidePassenger() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int zoomFov() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getRotX(float tickDelta) {
|
public float getRotX(float tickDelta) {
|
||||||
return this.getPitch(tickDelta);
|
return this.getPitch(tickDelta);
|
||||||
|
|
|
@ -511,4 +511,19 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
public int getAmmoCount(Player player) {
|
public int getAmmoCount(Player player) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean banHand() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hidePassenger() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int zoomFov() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class EnergyVehicleEntity extends VehicleEntity implements IChargeEntity
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
this.entityData.define(ENERGY, this.getMaxEnergy());
|
this.entityData.define(ENERGY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,4 +13,7 @@ public interface IArmedVehicleEntity {
|
||||||
boolean canShoot(Player player);
|
boolean canShoot(Player player);
|
||||||
|
|
||||||
int getAmmoCount(Player player);
|
int getAmmoCount(Player player);
|
||||||
|
boolean banHand();
|
||||||
|
boolean hidePassenger();
|
||||||
|
int zoomFov();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
|
|
||||||
public static final float MAX_HEALTH = 850;
|
public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get();
|
||||||
public static final int MAX_ENERGY = 2000000;
|
public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get();
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public float turretYRot;
|
public float turretYRot;
|
||||||
|
@ -124,17 +124,21 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false);
|
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false);
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||||
amount *= 2f;
|
amount *= 1.5f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
||||||
amount *= 3f;
|
amount *= 2.5f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.GUN_FIRE)) {
|
if (source.is(ModDamageTypes.GUN_FIRE)) {
|
||||||
amount *= 0.4f;
|
amount *= 0.4f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
|
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
|
||||||
|
amount *= 0.6f;
|
||||||
|
}
|
||||||
|
if (source.is(ModDamageTypes.VEHICLE_STRIKE)) {
|
||||||
amount *= 0.7f;
|
amount *= 0.7f;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
||||||
this.hurt(0.5f * Math.max(amount - 15, 0));
|
this.hurt(0.5f * Math.max(amount - 15, 0));
|
||||||
|
|
||||||
|
@ -258,9 +262,9 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
|
|
||||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||||
SmallCannonShellEntity smallCannonShell = new SmallCannonShellEntity(player, this.level(),
|
SmallCannonShellEntity smallCannonShell = new SmallCannonShellEntity(player, this.level(),
|
||||||
36,
|
VehicleConfig.LAV_150_CANNON_DAMAGE.get(),
|
||||||
22,
|
VehicleConfig.LAV_150_CANNON_EXPLOSION_DAMAGE.get(),
|
||||||
3f);
|
VehicleConfig.LAV_150_CANNON_EXPLOSION_RADIUS.get());
|
||||||
|
|
||||||
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 22,
|
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 22,
|
||||||
|
@ -348,7 +352,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backInputDown) {
|
if (backInputDown) {
|
||||||
this.entityData.set(POWER, this.entityData.get(POWER) - 0.005f);
|
this.entityData.set(POWER, this.entityData.get(POWER) - 0.008f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rightInputDown) {
|
if (rightInputDown) {
|
||||||
|
@ -384,7 +388,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
|
|
||||||
if (this.isInWater() || onGround()) {
|
if (this.isInWater() || onGround()) {
|
||||||
this.setYRot((float) (this.getYRot() - Math.max(10 * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
|
this.setYRot((float) (this.getYRot() - Math.max(10 * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(Mth.sin(-this.getYRot() * 0.017453292F) * (isInWater() ? 0.3f : 1) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (isInWater() ? 0.3f : 1) * this.entityData.get(POWER)));
|
this.setDeltaMovement(this.getDeltaMovement().add(Mth.sin(-this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +599,6 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
@Override
|
@Override
|
||||||
public boolean canShoot(Player player) {
|
public boolean canShoot(Player player) {
|
||||||
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())))
|
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())))
|
||||||
&& !player.getMainHandItem().is(ModTags.Items.GUN)
|
|
||||||
&& !cannotFire;
|
&& !cannotFire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,4 +606,19 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
public int getAmmoCount(Player player) {
|
public int getAmmoCount(Player player) {
|
||||||
return this.entityData.get(AMMO);
|
return this.entityData.get(AMMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean banHand() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hidePassenger() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int zoomFov() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState movementPredicate(AnimationState<Mk42Entity> event) {
|
private PlayState movementPredicate(AnimationState<Mk42Entity> event) {
|
||||||
if (this.entityData.get(COOL_DOWN) > 10) {
|
if (this.entityData.get(COOL_DOWN) > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire"));
|
||||||
}
|
}
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mk42.idle"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mk42.idle"));
|
||||||
|
@ -344,4 +344,19 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean banHand() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hidePassenger() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int zoomFov() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,4 +439,19 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean banHand() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hidePassenger() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int zoomFov() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,6 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
|
||||||
@Override
|
@Override
|
||||||
public boolean canShoot(Player player) {
|
public boolean canShoot(Player player) {
|
||||||
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())))
|
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())))
|
||||||
&& !player.getMainHandItem().is(ModTags.Items.GUN)
|
|
||||||
&& !cannotFire;
|
&& !cannotFire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,4 +520,19 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
|
||||||
public int getAmmoCount(Player player) {
|
public int getAmmoCount(Player player) {
|
||||||
return this.entityData.get(AMMO);
|
return this.entityData.get(AMMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean banHand() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hidePassenger() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int zoomFov() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +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.DroneEntity;
|
import com.atsuishio.superbwarfare.entity.DroneEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
|
||||||
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;
|
||||||
|
@ -124,6 +127,9 @@ public class ClientEventHandler {
|
||||||
public static boolean holdFire = false;
|
public static boolean holdFire = false;
|
||||||
|
|
||||||
public static boolean zoom = false;
|
public static boolean zoom = false;
|
||||||
|
public static boolean holdFireVehicle = false;
|
||||||
|
|
||||||
|
public static boolean zoomVehicle = false;
|
||||||
public static int burstFireSize = 0;
|
public static int burstFireSize = 0;
|
||||||
|
|
||||||
public static int customRpm = 0;
|
public static int customRpm = 0;
|
||||||
|
@ -141,8 +147,6 @@ public class ClientEventHandler {
|
||||||
public static double shakeAmplitude = 0;
|
public static double shakeAmplitude = 0;
|
||||||
public static double[] shakePos = {0, 0, 0};
|
public static double[] shakePos = {0, 0, 0};
|
||||||
public static double shakeType = 0;
|
public static double shakeType = 0;
|
||||||
public static double vehicleFov = 1;
|
|
||||||
public static double vehicleFovLerp = 1;
|
|
||||||
public static int lungeAttack;
|
public static int lungeAttack;
|
||||||
public static int lungeDraw;
|
public static int lungeDraw;
|
||||||
public static int lungeSprint;
|
public static int lungeSprint;
|
||||||
|
@ -382,7 +386,8 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((holdFire || burstFireSize > 0)
|
if ((holdFire || burstFireSize > 0)
|
||||||
&& !((player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.isDriver(player)) || player.getVehicle() instanceof Lav150Entity)
|
&& !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand())
|
||||||
|
&& !holdFireVehicle
|
||||||
&& (stack.is(ModTags.Items.NORMAL_GUN)
|
&& (stack.is(ModTags.Items.NORMAL_GUN)
|
||||||
&& cantFireTime == 0
|
&& cantFireTime == 0
|
||||||
&& drawTime < 0.01
|
&& drawTime < 0.01
|
||||||
|
@ -642,14 +647,9 @@ public class ClientEventHandler {
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
if (level == null) return;
|
if (level == null) return;
|
||||||
|
|
||||||
if (player.getMainHandItem().getItem() instanceof GunItem) {
|
|
||||||
clientTimerVehicle.stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notInGame()) {
|
if (notInGame()) {
|
||||||
clientTimerVehicle.stop();
|
clientTimerVehicle.stop();
|
||||||
holdFire = false;
|
holdFireVehicle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) {
|
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && iVehicle.canShoot(player)) {
|
||||||
|
@ -661,7 +661,7 @@ public class ClientEventHandler {
|
||||||
double rps = (double) rpm / 60;
|
double rps = (double) rpm / 60;
|
||||||
int cooldown = (int) (1000 / rps);
|
int cooldown = (int) (1000 / rps);
|
||||||
|
|
||||||
if ((holdFire)) {
|
if ((holdFireVehicle)) {
|
||||||
if (!clientTimerVehicle.started()) {
|
if (!clientTimerVehicle.started()) {
|
||||||
clientTimerVehicle.start();
|
clientTimerVehicle.start();
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new VehicleFireMessage(0));
|
ModUtils.PACKET_HANDLER.sendToServer(new VehicleFireMessage(0));
|
||||||
|
@ -683,8 +683,10 @@ public class ClientEventHandler {
|
||||||
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
||||||
}
|
}
|
||||||
if (iVehicle instanceof Ah6Entity ah6Entity) {
|
if (iVehicle instanceof Ah6Entity ah6Entity) {
|
||||||
|
float pitch = ah6Entity.heat <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - ah6Entity.heat));
|
||||||
if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 0) {
|
if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 0) {
|
||||||
player.playSound(ModSounds.HELICOPTER_CANNON_FIRE_1P.get(), 1f, 1);
|
ah6Entity.heat += 5;
|
||||||
|
player.playSound(ModSounds.HELICOPTER_CANNON_FIRE_1P.get(), 1f, pitch);
|
||||||
} else if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 1) {
|
} else if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 1) {
|
||||||
player.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_1P.get(), 1f, 1);
|
player.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_1P.get(), 1f, 1);
|
||||||
}
|
}
|
||||||
|
@ -702,7 +704,7 @@ public class ClientEventHandler {
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
if (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity) return;
|
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.hidePassenger()) return;
|
||||||
|
|
||||||
float pose;
|
float pose;
|
||||||
float times = 2 * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8);
|
float times = 2 * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8);
|
||||||
|
@ -741,7 +743,6 @@ public class ClientEventHandler {
|
||||||
public static void computeCameraAngles(ViewportEvent.ComputeCameraAngles event) {
|
public static void computeCameraAngles(ViewportEvent.ComputeCameraAngles event) {
|
||||||
ClientLevel level = Minecraft.getInstance().level;
|
ClientLevel level = Minecraft.getInstance().level;
|
||||||
Entity entity = event.getCamera().getEntity();
|
Entity entity = event.getCamera().getEntity();
|
||||||
handlePlayerCamera(event);
|
|
||||||
|
|
||||||
if (!(entity instanceof LivingEntity living)) return;
|
if (!(entity instanceof LivingEntity living)) return;
|
||||||
ItemStack stack = living.getMainHandItem();
|
ItemStack stack = living.getMainHandItem();
|
||||||
|
@ -756,20 +757,6 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level != null && stack.is(ModTags.Items.GUN)) {
|
|
||||||
handleWeaponSway(living);
|
|
||||||
handleWeaponMove(living);
|
|
||||||
handleWeaponZoom(living);
|
|
||||||
handlePlayerBreath(living);
|
|
||||||
handleWeaponFire(event, living);
|
|
||||||
handleWeaponShell();
|
|
||||||
handleGunRecoil();
|
|
||||||
handleBowPullAnimation(living);
|
|
||||||
handleWeaponDraw(living);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleShockCamera(event, living);
|
|
||||||
|
|
||||||
float times = Minecraft.getInstance().getDeltaFrameTime();
|
float times = Minecraft.getInstance().getDeltaFrameTime();
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
|
|
||||||
|
@ -794,6 +781,23 @@ public class ClientEventHandler {
|
||||||
event.setRoll((float) (roll + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * (onVehicle ? 0.15 : 1))));
|
event.setRoll((float) (roll + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * (onVehicle ? 0.15 : 1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player != null && player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand()) return;
|
||||||
|
|
||||||
|
if (level != null && stack.is(ModTags.Items.GUN)) {
|
||||||
|
handleWeaponSway(living);
|
||||||
|
handleWeaponMove(living);
|
||||||
|
handleWeaponZoom(living);
|
||||||
|
handlePlayerBreath(living);
|
||||||
|
handleWeaponFire(event, living);
|
||||||
|
handleWeaponShell();
|
||||||
|
handleGunRecoil();
|
||||||
|
handleBowPullAnimation(living);
|
||||||
|
handleWeaponDraw(living);
|
||||||
|
handlePlayerCamera(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleShockCamera(event, living);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleDroneCamera(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
|
private static void handleDroneCamera(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
|
||||||
|
@ -842,15 +846,7 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof ICannonEntity || player.getVehicle() instanceof Lav150Entity) {
|
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand()) {
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.getFirstPassenger() == player && !stack.getItem().isEdible()) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player) && ClientEventHandler.zoom && stack.is(ItemStack.EMPTY.getItem())) {
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -946,7 +942,9 @@ public class ClientEventHandler {
|
||||||
double weight = GunsTool.getGunDoubleTag(stack, "Weight") + GunsTool.getGunDoubleTag(stack, "CustomWeight");
|
double weight = GunsTool.getGunDoubleTag(stack, "Weight") + GunsTool.getGunDoubleTag(stack, "CustomWeight");
|
||||||
double speed = 1.5 - (0.07 * weight);
|
double speed = 1.5 - (0.07 * weight);
|
||||||
|
|
||||||
if (zoom && !notInGame()
|
if (zoom
|
||||||
|
&& !(player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand())
|
||||||
|
&& !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) {
|
||||||
if (Minecraft.getInstance().player != null) {
|
if (Minecraft.getInstance().player != null) {
|
||||||
|
@ -1202,7 +1200,6 @@ public class ClientEventHandler {
|
||||||
angle = Math.atan(Mth.abs((float) cameraLocation) / (lookDistance + 2.9)) * Mth.RAD_TO_DEG;
|
angle = Math.atan(Mth.abs((float) cameraLocation) / (lookDistance + 2.9)) * Mth.RAD_TO_DEG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getMainHandItem().is(ModTags.Items.GUN) || player.getMainHandItem().is(ModItems.LUNGE_MINE.get())) {
|
|
||||||
event.setPitch((float) (pitch + cameraRot[0] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.2 : 0) * turnRot[0] + 3 * velocityY));
|
event.setPitch((float) (pitch + cameraRot[0] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.2 : 0) * turnRot[0] + 3 * velocityY));
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK) {
|
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK) {
|
||||||
event.setYaw((float) (yaw + cameraRot[1] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.8 : 0) * turnRot[1] - (cameraLocation > 0 ? 1 : -1) * angle * zoomPos));
|
event.setYaw((float) (yaw + cameraRot[1] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.8 : 0) * turnRot[1] - (cameraLocation > 0 ? 1 : -1) * angle * zoomPos));
|
||||||
|
@ -1212,7 +1209,6 @@ public class ClientEventHandler {
|
||||||
|
|
||||||
event.setRoll((float) (roll + cameraRot[2] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.35 : 0) * turnRot[2]));
|
event.setRoll((float) (roll + cameraRot[2] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.35 : 0) * turnRot[2]));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static void handleBowPullAnimation(LivingEntity entity) {
|
private static void handleBowPullAnimation(LivingEntity entity) {
|
||||||
float times = 4 * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8);
|
float times = 4 * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8);
|
||||||
|
@ -1245,18 +1241,8 @@ public class ClientEventHandler {
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (player.isPassenger() && player.getVehicle() instanceof ICannonEntity && zoom) {
|
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand() && zoomVehicle) {
|
||||||
event.setFOV(event.getFOV() / 5);
|
event.setFOV(event.getFOV() / iArmedVehicle.zoomFov());
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.getFirstPassenger() == player && zoom) {
|
|
||||||
event.setFOV(event.getFOV() / 3);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Lav150Entity && zoom) {
|
|
||||||
event.setFOV(event.getFOV() / 3);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,11 +1291,6 @@ public class ClientEventHandler {
|
||||||
event.setFOV(event.getFOV() / droneFovLerp);
|
event.setFOV(event.getFOV() / droneFovLerp);
|
||||||
fov = event.getFOV();
|
fov = event.getFOV();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity && !(player.getVehicle() instanceof ICannonEntity) && zoom) {
|
|
||||||
vehicleFovLerp = Mth.lerp(0.1 * Minecraft.getInstance().getDeltaFrameTime(), vehicleFovLerp, vehicleFov);
|
|
||||||
event.setFOV(event.getFOV() / vehicleFovLerp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void look(Player player, Vec3 pTarget) {
|
public static void look(Player player, Vec3 pTarget) {
|
||||||
|
@ -1328,7 +1309,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 ICannonEntity || otherPlayer.getVehicle() instanceof Lav150Entity) {
|
if (otherPlayer.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger()) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1351,19 +1332,11 @@ public class ClientEventHandler {
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IHelicopterEntity iHelicopterEntity && iHelicopterEntity.isDriver(player)) {
|
if (stack.getItem() instanceof GunItem) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Lav150Entity) {
|
if (player.getVehicle() instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player)) {
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getVehicle() instanceof SpeedboatEntity && zoom) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.GUN) || (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity)) {
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class CameraMixin {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if ((player.getVehicle() != null && player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player) && ClientEventHandler.zoom && stack.is(ItemStack.EMPTY.getItem())) {
|
if ((player.getVehicle() != null && player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player) && ClientEventHandler.zoomVehicle && stack.is(ItemStack.EMPTY.getItem())) {
|
||||||
float yRot = boat.getYRot();
|
float yRot = boat.getYRot();
|
||||||
if (yRot < 0) {
|
if (yRot < 0) {
|
||||||
yRot += 360;
|
yRot += 360;
|
||||||
|
@ -117,7 +117,7 @@ public abstract class CameraMixin {
|
||||||
move(-getMaxZoom(16), 1.3, 0.0);
|
move(-getMaxZoom(16), 1.3, 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (thirdPerson && entity.getVehicle() instanceof SpeedboatEntity && !ClientEventHandler.zoom) {
|
if (thirdPerson && entity.getVehicle() instanceof SpeedboatEntity && !ClientEventHandler.zoomVehicle) {
|
||||||
move(-getMaxZoom(3), 1, 0.0);
|
move(-getMaxZoom(3), 1, 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public abstract class CameraMixin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoom) {
|
if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoomVehicle) {
|
||||||
move(-getMaxZoom(2.5), 0.75, 0.0);
|
move(-getMaxZoom(2.5), 0.75, 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
package com.atsuishio.superbwarfare.mixins;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
|
@ -20,7 +18,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.droneFovLerp;
|
import static com.atsuishio.superbwarfare.event.ClientEventHandler.droneFovLerp;
|
||||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.vehicleFovLerp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: MrCrayfish
|
* Author: MrCrayfish
|
||||||
|
@ -42,25 +39,21 @@ public class MouseHandlerMixin {
|
||||||
ItemStack stack = mc.player.getMainHandItem();
|
ItemStack stack = mc.player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getVehicle() instanceof ICannonEntity) {
|
if (player.getVehicle() instanceof ICannonEntity) {
|
||||||
return ClientEventHandler.zoom ? 0.15 : 0.3;
|
return ClientEventHandler.zoomVehicle ? 0.15 : 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) {
|
// if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) {
|
||||||
return 0.24;
|
// return 0.24;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Lav150Entity) {
|
if (player.getVehicle() instanceof Lav150Entity) {
|
||||||
return ClientEventHandler.zoom ? 0.23 : 0.28;
|
return ClientEventHandler.zoomVehicle ? 0.23 : 0.28;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
||||||
return 0.33 / (1 + 0.08 * (droneFovLerp - 1));
|
return 0.33 / (1 + 0.08 * (droneFovLerp - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof IArmedVehicleEntity iVehicle && iVehicle.isDriver(player) && ClientEventHandler.zoom) {
|
|
||||||
return 0.33 / (1 + 0.08 * (vehicleFovLerp - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stack.is(ModTags.Items.GUN)) {
|
if (!stack.is(ModTags.Items.GUN)) {
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.network.message;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public class DroneMovementMessage {
|
|
||||||
|
|
||||||
private final int direction;
|
|
||||||
private final boolean clicked;
|
|
||||||
|
|
||||||
public DroneMovementMessage(int direction, boolean clicked) {
|
|
||||||
this.direction = direction;
|
|
||||||
this.clicked = clicked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DroneMovementMessage decode(FriendlyByteBuf buffer) {
|
|
||||||
return new DroneMovementMessage(buffer.readInt(), buffer.readBoolean());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void encode(DroneMovementMessage message, FriendlyByteBuf buffer) {
|
|
||||||
buffer.writeInt(message.direction);
|
|
||||||
buffer.writeBoolean(message.clicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handler(DroneMovementMessage message, Supplier<NetworkEvent.Context> contextSupplier) {
|
|
||||||
NetworkEvent.Context context = contextSupplier.get();
|
|
||||||
context.enqueueWork(() -> {
|
|
||||||
if (context.getSender() != null) {
|
|
||||||
Player player = context.getSender();
|
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
|
||||||
|
|
||||||
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
|
||||||
var drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
|
||||||
if (drone != null) {
|
|
||||||
switch (message.direction) {
|
|
||||||
case 0:
|
|
||||||
drone.leftInputDown = message.clicked;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
drone.rightInputDown = message.clicked;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
drone.forwardInputDown = message.clicked;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
drone.backInputDown = message.clicked;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
drone.upInputDown = message.clicked;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
drone.downInputDown = message.clicked;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
context.setPacketHandled(true);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue