diff --git a/bin/CrunchProjectiles/ExplosiveProjectile.class b/bin/CrunchProjectiles/ExplosiveProjectile.class index 4701b85..0b8be6d 100644 Binary files a/bin/CrunchProjectiles/ExplosiveProjectile.class and b/bin/CrunchProjectiles/ExplosiveProjectile.class differ diff --git a/bin/siegeCore/ClickHandler.class b/bin/siegeCore/ClickHandler.class index 4e0caad..0724e61 100644 Binary files a/bin/siegeCore/ClickHandler.class and b/bin/siegeCore/ClickHandler.class differ diff --git a/bin/siegeCore/CrunchSiegeCore.class b/bin/siegeCore/CrunchSiegeCore.class index df043cc..0ff4515 100644 Binary files a/bin/siegeCore/CrunchSiegeCore.class and b/bin/siegeCore/CrunchSiegeCore.class differ diff --git a/bin/siegeCore/SiegeEquipment.class b/bin/siegeCore/SiegeEquipment.class index af03249..fec28a3 100644 Binary files a/bin/siegeCore/SiegeEquipment.class and b/bin/siegeCore/SiegeEquipment.class differ diff --git a/src/CrunchProjectiles/ExplosiveProjectile.java b/src/CrunchProjectiles/ExplosiveProjectile.java index 039e34a..f754ad3 100644 --- a/src/CrunchProjectiles/ExplosiveProjectile.java +++ b/src/CrunchProjectiles/ExplosiveProjectile.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; @@ -32,7 +33,7 @@ public class ExplosiveProjectile implements CrunchProjectile { public Particle ParticleType = Particle.EXPLOSION_LARGE; public Sound SoundType = Sound.ENTITY_GENERIC_EXPLODE; private boolean PlaySound = true; - + public Boolean AlertOnLanding = false; @Override public void Shoot(Player player, Entity entity, Location loc, Float velocity) { PlaySound = true; @@ -41,23 +42,26 @@ public class ExplosiveProjectile implements CrunchProjectile { if (DelayedFire) { baseDelay += DelayTime; Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> { - CreateEntity(entity, loc, velocity); + CreateEntity(entity, loc, velocity, player); }, (long) baseDelay); } else { - CreateEntity(entity,loc, velocity); + CreateEntity(entity,loc, velocity, player); } // } } } - private void CreateEntity(Entity entity, Location loc, Float velocity) { + private void CreateEntity(Entity entity, Location loc, Float velocity, Player player) { LivingEntity living = (LivingEntity) entity; World world = entity.getLocation().getWorld(); Entity tnt = world.spawnEntity(loc, EntityType.SNOWBALL); + Snowball ball = (Snowball) tnt; + ball.setShooter(player); ClickHandler.projectiles.put(tnt.getUniqueId(), this); + if (Inaccuracy != 0f) { tnt.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()) .subtract(Randomise())); diff --git a/src/siegeCore/ClickHandler.java b/src/siegeCore/ClickHandler.java index 255bc80..9f39de3 100644 --- a/src/siegeCore/ClickHandler.java +++ b/src/siegeCore/ClickHandler.java @@ -86,6 +86,11 @@ public class ClickHandler implements Listener { if ((event.getEntity() instanceof Snowball) && projectiles.containsKey(event.getEntity().getUniqueId())) { ExplosiveProjectile proj = projectiles.get(event.getEntity().getUniqueId()); Entity snowball = event.getEntity(); + Snowball ball = (Snowball) snowball; + Player player = (Player) ball.getShooter(); + if (player != null) { + player.sendMessage("Distance to impact: " + player.getLocation().distance(ball.getLocation())); + } Location loc = snowball.getLocation(); World world = event.getEntity().getWorld(); // world.createExplosion(loc, proj.Radius, proj.DoFire); diff --git a/src/siegeCore/CrunchSiegeCore.java b/src/siegeCore/CrunchSiegeCore.java index e25b6f8..4f72b9a 100644 --- a/src/siegeCore/CrunchSiegeCore.java +++ b/src/siegeCore/CrunchSiegeCore.java @@ -305,15 +305,37 @@ public class CrunchSiegeCore extends JavaPlugin { return false; } l.setY(l.getY() + 1); - l.setY(l.getY() + equip.PlacementOffsetY); + l.setDirection(player.getFacing().getDirection()); - Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND); - + + // + ItemStack item = new ItemStack(Material.CARVED_PUMPKIN); ItemMeta meta = item.getItemMeta(); + equip.AmmoHolder = new EquipmentMagazine(); - + if (equip.HaseBaseStand) { + Location l2 = l; + l2.setY(l.getY() + equip.BaseStandOffset); + Entity entity3 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND); + LivingEntity ent = (LivingEntity) entity3; + ArmorStand stand = (ArmorStand) ent; + meta.setCustomModelData(equip.BaseStandModelNumber); + stand.addEquipmentLock(EquipmentSlot.HEAD, LockType.REMOVING_OR_CHANGING); + stand.addEquipmentLock(EquipmentSlot.LEGS, LockType.ADDING_OR_CHANGING); + stand.addEquipmentLock(EquipmentSlot.CHEST, LockType.ADDING_OR_CHANGING); + stand.addEquipmentLock(EquipmentSlot.FEET, LockType.ADDING_OR_CHANGING); + stand.setBasePlate(false); + // stand.setSmall(true); + item.setItemMeta(meta); + stand.setInvisible(equip.AllowInvisibleStand); + ent.getEquipment().setHelmet(item); + stand.setGravity(false); + stand.setMarker(true); + } + l.setY(l.getY() + equip.PlacementOffsetY); + Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND); meta.setCustomModelData(equip.ReadyModelNumber); meta.setDisplayName("§e" + equip.EquipmentName +" spawn item"); List Lore = new ArrayList(); @@ -321,6 +343,7 @@ public class CrunchSiegeCore extends JavaPlugin { meta.setLore(Lore); item.setItemMeta(meta); + // entity3.addPassenger(entity2); LivingEntity ent = (LivingEntity) entity2; ArmorStand stand = (ArmorStand) ent; @@ -334,9 +357,9 @@ public class CrunchSiegeCore extends JavaPlugin { stand.setBasePlate(false); ent.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 2000000, 1)); // stand.setSmall(true); - if (equip.AllowInvisibleStand) { - stand.setInvisible(true); - } + + stand.setInvisible(equip.AllowInvisibleStand); + stand.setGravity(false); //stand.setSmall(true); ent.getEquipment().setHelmet(item); diff --git a/src/siegeCore/SiegeEquipment.java b/src/siegeCore/SiegeEquipment.java index 699bc6c..9315a11 100644 --- a/src/siegeCore/SiegeEquipment.java +++ b/src/siegeCore/SiegeEquipment.java @@ -42,6 +42,7 @@ public class SiegeEquipment implements Cloneable { public String EquipmentName = "Cannon"; public int XOffset = 7; public int YOffset = 0; + public int PitchOffset = -90; public int MaxFuel = 5; public double PlacementOffsetY = 0; public float VelocityPerFuel = 0.75f; @@ -60,6 +61,9 @@ public class SiegeEquipment implements Cloneable { public Boolean HasFired = false; public Boolean HasReloaded = false; public Boolean AllowInvisibleStand = true; + public Boolean HaseBaseStand = false; + public double BaseStandOffset = 0; + public int BaseStandModelNumber = 147; public int TaskNumber; public int ReadyModelNumber; @@ -129,7 +133,7 @@ public class SiegeEquipment implements Cloneable { else { loc.setY(loc.getY() - this.YOffset); } - + loc.setPitch(loc.getPitch() + this.PitchOffset); return loc; }