feat: more config options for projectiles

This commit is contained in:
ShermansWorld committed 2024-01-29 22:56:38 -05:00
1 parent 629211c8dc
commit 082d6e4087
6 files changed
+30 -10

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.github.alathra</groupId>
<artifactId>SiegeEngines</artifactId>
<version>0.7.8</version>
<version>0.7.9</version>
<packaging>jar</packaging>
<name>SiegeEngines</name>
@@ -23,6 +23,7 @@ import com.github.alathra.siegeengines.projectile.FireworkProjectile;
import com.github.alathra.siegeengines.projectile.ProjectileType;
import com.github.alathra.siegeengines.projectile.SiegeEngineProjectile;
@SuppressWarnings("deprecation")
public class Config {
private static FileConfiguration config;
@@ -257,6 +258,8 @@ public class Config {
.getInt("Projectiles." + projectileName + ".ProjectileCount");
explosiveProjectile.soundType = Sound
.valueOf(config.getString("Projectiles." + projectileName + ".FireSound"));
explosiveProjectile.velocityFactor = (float) config
.getDouble("Projectiles." + projectileName + ".VelocityFactor");
projectileMap.put(projectileName, explosiveProjectile);
break;
case ENTITY:
@@ -269,6 +272,12 @@ public class Config {
.valueOf(config.getString("Projectiles." + projectileName + ".EntityType"));
entityProjectile.soundType = Sound
.valueOf(config.getString("Projectiles." + projectileName + ".FireSound"));
entityProjectile.velocityFactor = (float) config
.getDouble("Projectiles." + projectileName + ".VelocityFactor");
if (entityProjectile.entityType.equals(EntityType.ARROW)) {
entityProjectile.arrowDamageFactor = (float) config
.getDouble("Projectiles." + projectileName + ".ArrowDamageFactor");
}
projectileMap.put(projectileName, entityProjectile);
break;
case FIREWORK:
@@ -5,7 +5,6 @@ import com.github.alathra.siegeengines.SiegeEnginesUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.World;
@@ -26,6 +25,8 @@ public class EntityProjectile extends SiegeEngineProjectile {
public float inaccuracy = 0.2f;
public Particle particleType = Particle.CAMPFIRE_SIGNAL_SMOKE;
public Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
public float velocityFactor = 1.0f;
public float arrowDamageFactor = 1.0f;
private boolean playSound = true;
@@ -43,10 +44,10 @@ public class EntityProjectile extends SiegeEngineProjectile {
if (delayedFire) {
baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
CreateEntity(entity, FireLocation, velocity, player);
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
}, (long) baseDelay);
} else {
CreateEntity(entity, FireLocation, velocity, player);
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
}
}
}
@@ -69,7 +70,7 @@ public class EntityProjectile extends SiegeEngineProjectile {
}
if (arrow instanceof Arrow) {
Arrow arr = (Arrow) arrow;
arr.setDamage(8);
arr.setDamage(8*arrowDamageFactor);
if (player instanceof org.bukkit.projectiles.ProjectileSource) {
arr.setShooter((org.bukkit.projectiles.ProjectileSource) player);
arr.setPickupStatus(org.bukkit.entity.AbstractArrow.PickupStatus.CREATIVE_ONLY);
@@ -29,6 +29,7 @@ public class ExplosiveProjectile extends SiegeEngineProjectile {
public Particle particleType = Particle.EXPLOSION_LARGE;
public Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
public Boolean alertOnLanding = false;
public float velocityFactor = 1.0f;
private boolean playSound = true;
@@ -44,10 +45,10 @@ public class ExplosiveProjectile extends SiegeEngineProjectile {
if (delayedFire) {
baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
CreateEntity(entity, loc, velocity, player);
CreateEntity(entity, loc, velocity*velocityFactor, player);
}, (long) baseDelay);
} else {
CreateEntity(entity, loc, velocity, player);
CreateEntity(entity, loc, velocity*velocityFactor, player);
}
}
}
@@ -25,7 +25,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
public float inaccuracy = 0.125f;
public Particle particleType = Particle.FLASH;
public Sound soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
public float velocityFactor = 0.5f;
public float velocityFactor = 1.0f;
private boolean playSound = true;
@@ -55,7 +55,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
}, (long) baseDelay);
} else {
CreateEntity(entity, FireLocation, velocity, player);
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
}
}
}
+10 -1
View File
@@ -49,6 +49,7 @@ Projectiles:
ExplodePower: 3.25
Inaccuracy: 0.125
ProjectileCount: 1
VelocityFactor: 1.0
AmmoItem: COBBLESTONE
FireSound: ENTITY_GENERIC_EXPLODE
BreachShot:
@@ -56,6 +57,7 @@ Projectiles:
ExplodePower: 5.25
Inaccuracy: 0.375
ProjectileCount: 1
VelocityFactor: 1.0
AmmoItem: IRON_BLOCK
FireSound: ENTITY_GENERIC_EXPLODE
RepeatingShot:
@@ -63,26 +65,32 @@ Projectiles:
ExplodePower: 1.75
Inaccuracy: 0.525
ProjectileCount: 6
VelocityFactor: 1.0
AmmoItem: TNT
FireSound: ENTITY_GENERIC_EXPLODE
ScatterShot:
ProjectileType: ENTITY
Inaccuracy: 0.365
EntityCount: 24
VelocityFactor: 1.0
EntityType: ARROW
ArrowDamageFactor: 1.0
AmmoItem: GRAVEL
FireSound: ITEM_CROSSBOW_SHOOT
BallistaBoltShot:
ProjectileType: ENTITY
Inaccuracy: 0.0125
EntityCount: 1
VelocityFactor: 0.5
EntityType: ARROW
ArrowDamageFactor: 1.0
AmmoItem: ARROW
FireSound: ITEM_CROSSBOW_SHOOT
DragonsBreath:
ProjectileType: ENTITY
Inaccuracy: 0.125
EntityCount: 1
VelocityFactor: 1.0
EntityType: DRAGON_FIREBALL
AmmoItem: DRAGON_BREATH
FireSound: ENTITY_GENERIC_EXPLODE
@@ -90,6 +98,7 @@ Projectiles:
ProjectileType: ENTITY
Inaccuracy: 0.475
EntityCount: 8
VelocityFactor: 1.0
EntityType: SMALL_FIREBALL
AmmoItem: MAGMA_BLOCK
FireSound: ENTITY_GENERIC_EXPLODE
@@ -117,7 +126,7 @@ SiegeEngines:
CanMount: false
Ballista:
ShotAmount: 1
VelocityPerFuel: 0.975
VelocityPerFuel: 2.0
MaxFuel: 2
FuelItem: STRING
Projectiles: