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