SteamWar/FightSystem
Archiviert
13
1

facingEnemy #160

Manuell gemergt
Lixfel hat 13 Commits von facingEnemy nach master 2020-05-23 16:08:25 +02:00 zusammengeführt
Nur Änderungen aus Commit b800bdad29 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -9,6 +9,7 @@ import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.util.Vector;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
@ -250,10 +251,10 @@ public class Config {
TeamRedPasteZ = TeamBluePasteZ + TeamBluetoReddistanceZ; TeamRedPasteZ = TeamBluePasteZ + TeamBluetoReddistanceZ;
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
double yaw = Math.toDegrees(Math.atan2(TeamBluetoReddistanceZ, TeamBluetoReddistanceX) + Math.PI / 2); //double yaw = Math.toDegrees(Math.atan2(TeamBluetoReddistanceZ, TeamBluetoReddistanceX) + Math.PI / 2);
double pitch = Math.toDegrees(Math.atan2(Math.sqrt(TeamBluetoReddistanceZ * TeamBluetoReddistanceZ + TeamBluetoReddistanceX * TeamBluetoReddistanceX), TeamBluetoReddistanceY)); //double pitch = Math.toDegrees(Math.atan2(Math.sqrt(TeamBluetoReddistanceZ * TeamBluetoReddistanceZ + TeamBluetoReddistanceX * TeamBluetoReddistanceX), TeamBluetoReddistanceY));
double yawInverted = ((yaw + 180) * 180) / 180; //double yawInverted = yaw + 180;
double pitchInverted = ((90 - pitch) * 180) / 180; //double pitchInverted = ((90 - pitch) * 180) / 180;
TeamBlueSpawn = new Location(world, TeamBlueSpawn = new Location(world,
TeamBluePasteX + 0.5 + teamBlueSpawnOffsetX, TeamBluePasteX + 0.5 + teamBlueSpawnOffsetX,
@ -265,6 +266,12 @@ public class Config {
TeamRedCornerY + 0.5 + teamBlueSpawnOffsetY, TeamRedCornerY + 0.5 + teamBlueSpawnOffsetY,
TeamRedPasteZ + 0.5 - teamBlueSpawnOffsetZ); TeamRedPasteZ + 0.5 - teamBlueSpawnOffsetZ);
Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector());
double pitch = v1.angle(v1.clone().setY(0));
double yaw = v1.clone().setY(0).angle(new Vector(1, 0, 0));
double pitchInverted = pitch * -1;
double yawInverted = yaw + 180;
TeamBlueSpawn.setYaw((float) yawInverted); TeamBlueSpawn.setYaw((float) yawInverted);
TeamBlueSpawn.setPitch((float) pitchInverted); TeamBlueSpawn.setPitch((float) pitchInverted);