mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-04 14:38:53 +00:00
bool for model cycling
This commit is contained in:
1 parent
d7b303d5ea
commit
d6a699573a
6 files changed
+19
-7
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -108,7 +108,9 @@ public class ClickHandler implements Listener {
|
|||||||
|
|
||||||
public void Shoot(Player player) {
|
public void Shoot(Player player) {
|
||||||
for (Entity ent : CrunchSiegeCore.TrackedStands.get(player.getUniqueId())){{
|
for (Entity ent : CrunchSiegeCore.TrackedStands.get(player.getUniqueId())){{
|
||||||
|
if (ent == null || ent.isDead()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
double distance = player.getLocation().distance(ent.getLocation());
|
double distance = player.getLocation().distance(ent.getLocation());
|
||||||
if (distance >= 250) {
|
if (distance >= 250) {
|
||||||
player.sendMessage("Too far away to fire");
|
player.sendMessage("Too far away to fire");
|
||||||
@@ -130,20 +132,20 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
LivingEntity living = (LivingEntity) ent;
|
LivingEntity living = (LivingEntity) ent;
|
||||||
Location loc = living.getEyeLocation();
|
Location loc = living.getEyeLocation();
|
||||||
loc.setPitch(-30);
|
|
||||||
loc.setY(loc.getY() + 2);
|
|
||||||
loc.getPitch();
|
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
|
||||||
float randomVar = random.nextFloat() * (7 - -7) + -7;
|
float randomVar = random.nextFloat() * (7 - -7) + -7;
|
||||||
loc.setYaw(loc.getYaw() + randomVar);
|
|
||||||
siege.NextModelNumber = 0;
|
siege.NextModelNumber = 0;
|
||||||
siege.location = loc;
|
siege.location = loc;
|
||||||
siege.NextShotTime = System.currentTimeMillis() + 6000;
|
siege.NextShotTime = System.currentTimeMillis() + 6000;
|
||||||
player.sendMessage("Cannot fire for another " + CrunchSiegeCore.convertTime(siege.NextShotTime - System.currentTimeMillis()));
|
player.sendMessage("Cannot fire for another " + CrunchSiegeCore.convertTime(siege.NextShotTime - System.currentTimeMillis()));
|
||||||
siege.WorldName = ent.getWorld().getName();
|
siege.WorldName = ent.getWorld().getName();
|
||||||
Bukkit.getServer().getWorld(siege.WorldName).playSound(siege.location, Sound.ENTITY_BAT_DEATH, 20, 2);
|
Bukkit.getServer().getWorld(siege.WorldName).playSound(siege.location, Sound.ENTITY_BAT_DEATH, 20, 2);
|
||||||
|
if (siege.CycleThroughModelsBeforeFiring) {
|
||||||
|
|
||||||
|
|
||||||
siege.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(CrunchSiegeCore.plugin, () -> {
|
siege.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(CrunchSiegeCore.plugin, () -> {
|
||||||
//player.sendMessage("task");
|
//player.sendMessage("task");
|
||||||
if (siege.HasFired) {
|
if (siege.HasFired) {
|
||||||
@@ -194,6 +196,13 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0, siege.MillisecondsBetweenFiringStages);
|
}, 0, siege.MillisecondsBetweenFiringStages);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Entity tnt = Bukkit.getServer().getWorld(siege.WorldName).spawnEntity(loc, EntityType.SNOWBALL);
|
||||||
|
|
||||||
|
projectiles.put(tnt.getUniqueId(), siege.projectile);
|
||||||
|
tnt.setVelocity(loc.getDirection().multiply(siege.Velocity));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class CrunchSiegeCore extends JavaPlugin {
|
|||||||
|
|
||||||
public static void CreateTrebuchet(Player player) {
|
public static void CreateTrebuchet(Player player) {
|
||||||
Location l = player.getLocation();
|
Location l = player.getLocation();
|
||||||
|
l.setY(l.getY() - 1);
|
||||||
Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||||
SiegeEquipment equip = new SiegeEquipment(entity2.getUniqueId());
|
SiegeEquipment equip = new SiegeEquipment(entity2.getUniqueId());
|
||||||
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
||||||
@@ -111,10 +112,12 @@ public class CrunchSiegeCore extends JavaPlugin {
|
|||||||
equip.FiringModelNumbers = new ArrayList<>(Arrays.asList(
|
equip.FiringModelNumbers = new ArrayList<>(Arrays.asList(
|
||||||
123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139
|
123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139
|
||||||
));
|
));
|
||||||
|
equip.CycleThroughModelsBeforeFiring = false;
|
||||||
equip.Entity = entity2;
|
equip.Entity = entity2;
|
||||||
|
|
||||||
entity2.setCustomName("Trebuchet");
|
entity2.setCustomName("Trebuchet");
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
meta.setCustomModelData(equip.ReadyModelNumber);
|
meta.setCustomModelData(equip.ReadyModelNumber);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class SiegeEquipment {
|
|||||||
public String WorldName;
|
public String WorldName;
|
||||||
|
|
||||||
public int FuseTime;
|
public int FuseTime;
|
||||||
public double Velocity = 1;
|
public double Velocity = 3;
|
||||||
public long NextShotTime = System.currentTimeMillis();
|
public long NextShotTime = System.currentTimeMillis();
|
||||||
|
|
||||||
public int MillisecondsBetweenFiringStages;
|
public int MillisecondsBetweenFiringStages;
|
||||||
@@ -29,7 +29,7 @@ public class SiegeEquipment {
|
|||||||
public int MillisecondsToLoad;
|
public int MillisecondsToLoad;
|
||||||
public Location location;
|
public Location location;
|
||||||
public int ModelNumberToFireAt;
|
public int ModelNumberToFireAt;
|
||||||
|
public Boolean CycleThroughModelsBeforeFiring = false;
|
||||||
public Boolean RotateSideways = false;
|
public Boolean RotateSideways = false;
|
||||||
public Boolean RoateUpDown = true;
|
public Boolean RoateUpDown = true;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user