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