mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 06:28:55 +00:00
.
This commit is contained in:
1 parent
29b33f3539
commit
9564fda4af
2 files changed
+12
-21
No files matched your search
Binary file not shown.
@@ -35,7 +35,7 @@ public class SiegeEquipment implements Cloneable {
|
|||||||
public Boolean Enabled = false;
|
public Boolean Enabled = false;
|
||||||
public UUID EntityId;
|
public UUID EntityId;
|
||||||
public Entity Entity;
|
public Entity Entity;
|
||||||
public Boolean RotateStandHead = true;
|
|
||||||
public HashMap<Material, CrunchProjectile> Projectiles = new HashMap<Material, CrunchProjectile>() ;
|
public HashMap<Material, CrunchProjectile> Projectiles = new HashMap<Material, CrunchProjectile>() ;
|
||||||
|
|
||||||
public String WorldName;
|
public String WorldName;
|
||||||
@@ -55,7 +55,7 @@ public class SiegeEquipment implements Cloneable {
|
|||||||
public Boolean CycleThroughModelsBeforeFiring = false;
|
public Boolean CycleThroughModelsBeforeFiring = false;
|
||||||
public Boolean RotateSideways = false;
|
public Boolean RotateSideways = false;
|
||||||
public Boolean RotateUpDown = true;
|
public Boolean RotateUpDown = true;
|
||||||
|
public Boolean RotateStandHead = true;
|
||||||
public Boolean HasFired = false;
|
public Boolean HasFired = false;
|
||||||
public Boolean HasReloaded = false;
|
public Boolean HasReloaded = false;
|
||||||
|
|
||||||
@@ -143,39 +143,27 @@ public class SiegeEquipment implements Cloneable {
|
|||||||
float loadedFuel = this.AmmoHolder.LoadedFuel;
|
float loadedFuel = this.AmmoHolder.LoadedFuel;
|
||||||
Material LoadedProjectile = this.AmmoHolder.MaterialName;
|
Material LoadedProjectile = this.AmmoHolder.MaterialName;
|
||||||
|
|
||||||
this.AmmoHolder.LoadedFuel = 0;
|
|
||||||
this.AmmoHolder.LoadedProjectile = 0;
|
|
||||||
this.AmmoHolder.MaterialName = Material.BEDROCK;
|
|
||||||
|
|
||||||
LivingEntity living = (LivingEntity) Entity;
|
LivingEntity living = (LivingEntity) Entity;
|
||||||
if (living == null || living.getEquipment() == null || living.getEquipment().getHelmet() == null || living.getEquipment().getHelmet().getItemMeta() == null) {
|
if (living == null || living.getEquipment() == null || living.getEquipment().getHelmet() == null || living.getEquipment().getHelmet().getItemMeta() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (living.getEquipment().getHelmet().getItemMeta().getCustomModelData() != this.ReadyModelNumber) {
|
if (living.getEquipment().getHelmet().getItemMeta().getCustomModelData() != this.ReadyModelNumber) {
|
||||||
|
player.sendMessage("Cannot fire yet!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.AmmoHolder.LoadedFuel = 0;
|
||||||
|
this.AmmoHolder.LoadedProjectile = 0;
|
||||||
|
this.AmmoHolder.MaterialName = Material.BEDROCK;
|
||||||
|
|
||||||
this.WorldName = Entity.getWorld().getName();
|
this.WorldName = Entity.getWorld().getName();
|
||||||
this.NextShotTime = System.currentTimeMillis() + 1000;
|
this.NextShotTime = System.currentTimeMillis() + 1000;
|
||||||
if (this.CycleThroughModelsBeforeFiring) {
|
if (this.CycleThroughModelsBeforeFiring) {
|
||||||
|
|
||||||
|
|
||||||
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(CrunchSiegeCore.plugin, () -> {
|
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(CrunchSiegeCore.plugin, () -> {
|
||||||
|
|
||||||
|
|
||||||
Random random = new Random();
|
|
||||||
float randomVar = random.nextFloat() * (6 - -6) + -6;
|
|
||||||
Location loc = living.getEyeLocation();
|
|
||||||
Vector direction = Entity.getLocation().getDirection().multiply(XOffset);
|
|
||||||
|
|
||||||
loc.add(direction.multiply(randomVar));
|
|
||||||
loc.setYaw(loc.getYaw() + randomVar);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.NextModelNumber = 0;
|
|
||||||
|
|
||||||
// player.sendMessage("Cannot fire for another " + CrunchSiegeCore.convertTime(this.NextShotTime - System.currentTimeMillis()));
|
|
||||||
//player.sendMessage("task");
|
|
||||||
if (this.HasFired) {
|
if (this.HasFired) {
|
||||||
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
||||||
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(CrunchSiegeCore.plugin, () -> {
|
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(CrunchSiegeCore.plugin, () -> {
|
||||||
@@ -186,6 +174,8 @@ public class SiegeEquipment implements Cloneable {
|
|||||||
this.HasReloaded = false;
|
this.HasReloaded = false;
|
||||||
this.HasFired = false;
|
this.HasFired = false;
|
||||||
this.NextModelNumber = 0;
|
this.NextModelNumber = 0;
|
||||||
|
CrunchSiegeCore.UpdateEntityIdModel(this.Entity, this.ReadyModelNumber, this.WorldName);
|
||||||
|
this.TaskNumber = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//firing stages
|
//firing stages
|
||||||
@@ -211,6 +201,7 @@ public class SiegeEquipment implements Cloneable {
|
|||||||
// player.sendMessage("" + modelData);
|
// player.sendMessage("" + modelData);
|
||||||
CrunchSiegeCore.UpdateEntityIdModel(this.Entity, modelData, this.WorldName);
|
CrunchSiegeCore.UpdateEntityIdModel(this.Entity, modelData, this.WorldName);
|
||||||
if (modelData == this.ModelNumberToFireAt) {
|
if (modelData == this.ModelNumberToFireAt) {
|
||||||
|
// player.sendMessage("firing" + modelData);
|
||||||
Projectiles.get(LoadedProjectile).Shoot(player, this.Entity, this.GetFireLocation(living), loadedFuel * this.VelocityPerFuel);
|
Projectiles.get(LoadedProjectile).Shoot(player, this.Entity, this.GetFireLocation(living), loadedFuel * this.VelocityPerFuel);
|
||||||
}
|
}
|
||||||
this.NextModelNumber += 1;
|
this.NextModelNumber += 1;
|
||||||
|
|||||||
Reference in new issue
Block a user