mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 14:38:53 +00:00
stuff
This commit is contained in:
1 parent
129839368b
commit
c7587c7ea8
8 files changed
+97
-24
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
package CrunchProjectiles;
|
package CrunchProjectiles;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package CrunchProjectiles;
|
package CrunchProjectiles;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
@@ -16,25 +18,53 @@ public class EntityProjectile implements CrunchProjectile{
|
|||||||
|
|
||||||
public int EntityCount = 20;
|
public int EntityCount = 20;
|
||||||
public int ArrowOnlyDamage = 6;
|
public int ArrowOnlyDamage = 6;
|
||||||
|
public Boolean DelayedFire = false;
|
||||||
|
public int DelayTime = 6;
|
||||||
public EntityType EntityTyp = EntityType.ARROW;
|
public EntityType EntityTyp = EntityType.ARROW;
|
||||||
|
public float Inaccuracy = 0.2f;
|
||||||
|
public Particle ParticleType = Particle.EXPLOSION_LARGE;
|
||||||
|
public Sound SoundType = Sound.ENTITY_GENERIC_EXPLODE;
|
||||||
@Override
|
@Override
|
||||||
public void Shoot(Player player, Entity entity, Location loc, Float velocity) {
|
public void Shoot(Player player, Entity entity, Location loc, Float velocity) {
|
||||||
|
int baseDelay = 0;
|
||||||
for (int i = 0; i < EntityCount; i++) {
|
for (int i = 0; i < EntityCount; i++) {
|
||||||
World world = entity.getLocation().getWorld();
|
if (DelayedFire) {
|
||||||
|
baseDelay += DelayTime;
|
||||||
Entity arrow = world.spawnEntity(loc, EntityTyp);
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
|
||||||
arrow.setVelocity(loc.getDirection().multiply(velocity).add(new Vector(CrunchSiegeCore.random.nextDouble(), CrunchSiegeCore.random.nextDouble(), CrunchSiegeCore.random.nextDouble())
|
CreateEntity(entity, loc, velocity);
|
||||||
.subtract(new Vector(CrunchSiegeCore.random.nextDouble(), CrunchSiegeCore.random.nextDouble(), CrunchSiegeCore.random.nextDouble()))));
|
}, (long) baseDelay);
|
||||||
if (arrow instanceof Arrow) {
|
|
||||||
Arrow arr = (Arrow) arrow;
|
|
||||||
arr.setDamage(8);
|
|
||||||
}
|
}
|
||||||
// MiscDisguise miscDisguise = new MiscDisguise(DisguiseType.DROPPED_ITEM, Material.IRON_NUGGET);
|
else {
|
||||||
// DisguiseAPI.disguiseEntity(arrow, miscDisguise);
|
CreateEntity(entity, loc, velocity);
|
||||||
world.playSound(entity.getLocation(), Sound.ITEM_CROSSBOW_SHOOT, 20, 2);
|
}
|
||||||
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void CreateEntity(Entity entity, Location loc, Float velocity) {
|
||||||
|
World world = entity.getLocation().getWorld();
|
||||||
|
|
||||||
|
Entity arrow = world.spawnEntity(loc, EntityTyp);
|
||||||
|
if (Inaccuracy != 0f) {
|
||||||
|
arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise())
|
||||||
|
.subtract(Randomise()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
arrow.setVelocity(loc.getDirection().multiply(velocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arrow instanceof Arrow) {
|
||||||
|
Arrow arr = (Arrow) arrow;
|
||||||
|
arr.setDamage(8);
|
||||||
|
}
|
||||||
|
// MiscDisguise miscDisguise = new MiscDisguise(DisguiseType.DROPPED_ITEM, Material.IRON_NUGGET);
|
||||||
|
// DisguiseAPI.disguiseEntity(arrow, miscDisguise);
|
||||||
|
world.playSound(loc, this.SoundType, 20, 2);
|
||||||
|
world.spawnParticle(this.ParticleType, loc.getX(), loc.getY(), loc.getZ(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector Randomise() {
|
||||||
|
return new Vector(CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1),CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1),CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package CrunchProjectiles;
|
package CrunchProjectiles;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@@ -9,6 +10,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import siegeCore.ClickHandler;
|
import siegeCore.ClickHandler;
|
||||||
import siegeCore.CrunchSiegeCore;
|
import siegeCore.CrunchSiegeCore;
|
||||||
@@ -16,24 +18,49 @@ import siegeCore.CrunchSiegeCore;
|
|||||||
public class ExplosiveProjectile implements CrunchProjectile {
|
public class ExplosiveProjectile implements CrunchProjectile {
|
||||||
|
|
||||||
public int Radius = 2;
|
public int Radius = 2;
|
||||||
public float Inaccuracy = 3.0f;
|
public float Inaccuracy = 0.4f;
|
||||||
public int ProjectilesCount = 1;
|
public int ProjectilesCount = 1;
|
||||||
|
public Boolean DelayedFire = false;
|
||||||
|
public int DelayTime = 6;
|
||||||
|
public Particle ParticleType = Particle.EXPLOSION_LARGE;
|
||||||
|
public Sound SoundType = Sound.ENTITY_GENERIC_EXPLODE;
|
||||||
@Override
|
@Override
|
||||||
public void Shoot(Player player, Entity entity, Location loc, Float velocity) {
|
public void Shoot(Player player, Entity entity, Location loc, Float velocity) {
|
||||||
|
int baseDelay = 0;
|
||||||
for (int i = 0; i < ProjectilesCount; i++) {
|
for (int i = 0; i < ProjectilesCount; i++) {
|
||||||
if (Inaccuracy > 0) {
|
if (DelayedFire) {
|
||||||
float randomVar = CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1);
|
baseDelay += DelayTime;
|
||||||
loc.setYaw(loc.getYaw() + randomVar);
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
|
||||||
|
CreateEntity(entity, loc, velocity);
|
||||||
|
}, (long) baseDelay);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CreateEntity(entity, loc, velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
World world = entity.getLocation().getWorld();
|
// }
|
||||||
Entity tnt = world.spawnEntity(loc, EntityType.SNOWBALL);
|
|
||||||
ClickHandler.projectiles.put(tnt.getUniqueId(), this);
|
|
||||||
tnt.setVelocity(loc.getDirection().multiply(velocity));
|
|
||||||
world.playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 20, 2);
|
|
||||||
world.spawnParticle(Particle.EXPLOSION_LARGE, loc.getX(), loc.getY(), loc.getZ(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateEntity(Entity entity, Location loc, Float velocity) {
|
||||||
|
World world = entity.getLocation().getWorld();
|
||||||
|
Entity tnt = world.spawnEntity(loc, EntityType.SNOWBALL);
|
||||||
|
ClickHandler.projectiles.put(tnt.getUniqueId(), this);
|
||||||
|
if (Inaccuracy != 0f) {
|
||||||
|
tnt.setVelocity(loc.getDirection().multiply(velocity).add(Randomise())
|
||||||
|
.subtract(Randomise()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tnt.setVelocity(loc.getDirection().multiply(velocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
world.playSound(loc, this.SoundType, 20, 2);
|
||||||
|
world.spawnParticle(this.ParticleType, loc.getX(), loc.getY(), loc.getZ(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector Randomise() {
|
||||||
|
return new Vector(CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1),CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1),CrunchSiegeCore.random.nextFloat() * (Inaccuracy - (Inaccuracy * -1)) + (Inaccuracy * -1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ import java.util.logging.Level;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
@@ -126,8 +127,9 @@ public class CrunchSiegeCore extends JavaPlugin {
|
|||||||
equip.Projectiles.put(Material.COBBLESTONE, proj);
|
equip.Projectiles.put(Material.COBBLESTONE, proj);
|
||||||
proj = new ExplosiveProjectile();
|
proj = new ExplosiveProjectile();
|
||||||
proj.Radius = 1;
|
proj.Radius = 1;
|
||||||
proj.ProjectilesCount = 3;
|
proj.ProjectilesCount = 50;
|
||||||
proj.Inaccuracy = 12;
|
proj.DelayedFire = true;
|
||||||
|
proj.Inaccuracy = 0.3f;
|
||||||
equip.Projectiles.put(Material.TNT, proj);
|
equip.Projectiles.put(Material.TNT, proj);
|
||||||
proj = new ExplosiveProjectile();
|
proj = new ExplosiveProjectile();
|
||||||
proj.Radius = 4;
|
proj.Radius = 4;
|
||||||
@@ -137,7 +139,19 @@ public class CrunchSiegeCore extends JavaPlugin {
|
|||||||
EntityProjectile fireProj = new EntityProjectile();
|
EntityProjectile fireProj = new EntityProjectile();
|
||||||
fireProj.EntityCount = 3;
|
fireProj.EntityCount = 3;
|
||||||
fireProj.EntityTyp = EntityType.SMALL_FIREBALL;
|
fireProj.EntityTyp = EntityType.SMALL_FIREBALL;
|
||||||
|
fireProj.ParticleType = Particle.WHITE_ASH;
|
||||||
|
fireProj.SoundType = Sound.ENTITY_BLAZE_SHOOT;
|
||||||
equip.Projectiles.put(Material.DIAMOND, fireProj);
|
equip.Projectiles.put(Material.DIAMOND, fireProj);
|
||||||
|
|
||||||
|
EntityProjectile pig = new EntityProjectile();
|
||||||
|
pig.EntityCount = 100;
|
||||||
|
pig.DelayedFire = true;
|
||||||
|
pig.DelayTime = 3;
|
||||||
|
pig.EntityTyp = EntityType.ARROW;
|
||||||
|
pig.SoundType = Sound.ITEM_CROSSBOW_SHOOT;
|
||||||
|
pig.ParticleType = Particle.GLOW;
|
||||||
|
equip.Projectiles.put(Material.PORKCHOP, pig);
|
||||||
|
|
||||||
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
||||||
equip.ReadyModelNumber = 122;
|
equip.ReadyModelNumber = 122;
|
||||||
equip.ModelNumberToFireAt = 135;
|
equip.ModelNumberToFireAt = 135;
|
||||||
|
|||||||
Reference in new issue
Block a user