diff --git a/src/main/java/com/github/alathra/siegeengines/SiegeEngines.java b/src/main/java/com/github/alathra/siegeengines/SiegeEngines.java index a013813..e536bd2 100644 --- a/src/main/java/com/github/alathra/siegeengines/SiegeEngines.java +++ b/src/main/java/com/github/alathra/siegeengines/SiegeEngines.java @@ -125,6 +125,28 @@ public class SiegeEngines extends JavaPlugin { trebuchet.cycleThroughModelsBeforeFiring = true; definedSiegeEngines.put(trebuchet.readyModelNumber, trebuchet); + // Ballista + SiegeEngine ballista = new SiegeEngine("Ballista", Config.ballistaProjectiles, new ItemStack(Material.GUNPOWDER), 143); + // config options + ballista.shotAmount = Config.ballistaShotAmount; + ballista.velocityPerFuel = Config.ballistaVelocityPerFuel; + ballista.maxFuel = Config.ballistaMaxFuel; + ballista.fuelItem = new ItemStack(Config.ballistaFuelItem); + ballista.projectiles = Config.ballistaProjectiles; + + ballista.xOffset = 1; + ballista.yOffset = 1; + ballista.placementOffsetY = -0.75; + ballista.rotateStandHead = true; + ballista.rotateSideways = true; + ballista.readyModelNumber = 145; + ballista.modelNumberToFireAt = 143; + ballista.firingModelNumbers = new ArrayList<>(Arrays.asList( + 143, 144, 145 + )); + ballista.cycleThroughModelsBeforeFiring = true; + definedSiegeEngines.put(ballista.readyModelNumber, ballista); + // Siege Cannon SiegeEngine siegeCannon = new SiegeEngine("Siege Cannon", Config.siegeCannonProjectiles, new ItemStack(Material.GUNPOWDER), 141); // config options @@ -160,4 +182,4 @@ public class SiegeEngines extends JavaPlugin { definedSiegeEngines.put(navalCannon.readyModelNumber, navalCannon); } -} \ No newline at end of file +} diff --git a/src/main/java/com/github/alathra/siegeengines/config/Config.java b/src/main/java/com/github/alathra/siegeengines/config/Config.java index ae9e442..1af5776 100644 --- a/src/main/java/com/github/alathra/siegeengines/config/Config.java +++ b/src/main/java/com/github/alathra/siegeengines/config/Config.java @@ -33,22 +33,28 @@ public class Config { // Siege Engine Options - Defaults public static int trebuchetShotAmount = 1; public static float trebuchetVelocityPerFuel = 0.3f; - public static int trebuchetMaxFuel = 5; + public static int trebuchetMaxFuel = 3; public static Material trebuchetFuelItem = Material.STRING; + public static HashMap trebuchetProjectiles = new HashMap<>(); + + public static int ballistaShotAmount = 1; + public static float ballistaVelocityPerFuel = 0.925f; + public static int ballistaMaxFuel = 4; + public static Material ballistaFuelItem = Material.STRING; + public static HashMap ballistaProjectiles = new HashMap<>(); public static int siegeCannonShotAmount = 1; public static float siegeCannonVelocityPerFuel = 1.0125f; public static int siegeCannonMaxFuel = 5; - public static Material siegeCannonFuelItem = Material.STRING; + public static Material siegeCannonFuelItem = Material.GUNPOWDER; + public static HashMap siegeCannonProjectiles = new HashMap<>(); public static int navalCannonShotAmount = 1; - public static float navalCannonVelocityPerFuel = 1.0125f; - public static int navalCannonMaxFuel = 5; - public static Material navalCannonFuelItem = Material.STRING; - - public static HashMap trebuchetProjectiles = new HashMap<>(); - public static HashMap siegeCannonProjectiles = new HashMap<>(); + public static float navalCannonVelocityPerFuel = 1.075f; + public static int navalCannonMaxFuel = 4; + public static Material navalCannonFuelItem = Material.GUNPOWDER; public static HashMap navalCannonProjectiles = new HashMap<>(); + // Projectiles @@ -96,6 +102,22 @@ public class Config { } } + ballistaShotAmount = config.getInt("SiegeEngines.Ballista.ShotAmount"); + ballistaVelocityPerFuel = (float) config.getDouble("SiegeEngines.Ballista.VelocityPerFuel"); + ballistaMaxFuel = config.getInt("SiegeEngines.Ballista.MaxFuel"); + try { + ballistaFuelItem = Material.getMaterial(config.getString("SiegeEngines.Ballista.FuelItem")); + } catch (Exception e) { + ballistaFuelItem = Material.STRING; + SiegeEnginesLogger.warn("Propellant item material could not be found, defaulting to " + + ballistaFuelItem.toString() + " !"); + } + for (String projectileName : config.getStringList("SiegeEngines.Ballista.Projectiles")) { + if (projectileMap.keySet().contains(projectileName)) { + ballistaProjectiles.put(projectileMap.get(projectileName).getAmmuinitionItem(), projectileMap.get(projectileName)); + } + } + siegeCannonShotAmount = config.getInt("SiegeEngines.SiegeCannon.ShotAmount"); siegeCannonVelocityPerFuel = (float) config.getDouble("SiegeEngines.SiegeCannon.VelocityPerFuel"); siegeCannonMaxFuel = config.getInt("SiegeEngines.SiegeCannon.MaxFuel"); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 62e2a81..c3d52d0 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -34,20 +34,20 @@ AutoReload: false Projectiles: StoneShot: ProjectileType: EXPLOSIVE - ExplodePower: 1.0 - Inaccuracy: 0.3 + ExplodePower: 1.5 + Inaccuracy: 0.125 ProjectileCount: 1 AmmoItem: COBBLESTONE BreachShot: ProjectileType: EXPLOSIVE - ExplodePower: 3.0 + ExplodePower: 3.75 Inaccuracy: 0.3 ProjectileCount: 1 AmmoItem: IRON_BLOCK RepeatingShot: ProjectileType: EXPLOSIVE ExplodePower: 1.0 - Inaccuracy: 0.45 + Inaccuracy: 0.325 ProjectileCount: 5 AmmoItem: TNT ScatterShot: @@ -56,10 +56,22 @@ Projectiles: EntityCount: 24 EntityShotType: ARROW AmmoItem: GRAVEL + BallistaBoltShot: + ProjectileType: ENTITY + Inaccuracy: 0.025 + EntityCount: 1 + EntityShotType: ARROW + AmmoItem: ARROW + DragonsBreath: + ProjectileType: ENTITY + Inaccuracy: 0.25 + EntityCount: 3 + EntityShotType: DRAGON_FIREBALL + AmmoItem: DRAGON_BREATH FireShot: ProjectileType: ENTITY - Inaccuracy: 0.75 - EntityCount: 4 + Inaccuracy: 0.475 + EntityCount: 8 EntityShotType: SMALL_FIREBALL AmmoItem: MAGMA_BLOCK FireworkShot: @@ -67,18 +79,29 @@ Projectiles: Inaccuracy: 0.125 EntityCount: 1 VelocityFactor: 0.5 - Delay: 6 + Delay: 5 SiegeEngines: Trebuchet: ShotAmount: 1 VelocityPerFuel: 0.3 - MaxFuel: 5 + MaxFuel: 3 FuelItem: STRING Projectiles: - StoneShot - BreachShot - FireShot + - RepeatingShot + Ballista: + ShotAmount: 1 + VelocityPerFuel: 0.925 + MaxFuel: 2 + FuelItem: STRING + Projectiles: + - BallistaBoltShot + - ScatterShot + - DragonsBreath + - FireworkShot SiegeCannon: ShotAmount: 1 VelocityPerFuel: 1.0125 @@ -91,8 +114,8 @@ SiegeEngines: - FireworkShot NavalCannon: ShotAmount: 1 - VelocityPerFuel: 1.0125 - MaxFuel: 5 + VelocityPerFuel: 0.975 + MaxFuel: 4 FuelItem: GUNPOWDER Projectiles: - StoneShot @@ -100,4 +123,4 @@ SiegeEngines: - BreachShot - FireShot - FireworkShot - \ No newline at end of file +