working on shell entity wrapper
This commit is contained in:
parent
2756a560a9
commit
3038df3197
@ -17,18 +17,23 @@ public class Shell {
|
|||||||
public double baseVelocity = 2.5;
|
public double baseVelocity = 2.5;
|
||||||
public double failChance = .01;
|
public double failChance = .01;
|
||||||
|
|
||||||
|
public boolean isFired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shell with default stats. Represents the first basic craftable shell in-game.
|
* Creates a shell item wrapper with default stats. Represents the first basic craftable shell in-game.
|
||||||
*/
|
*/
|
||||||
public Shell(){
|
public Shell(){
|
||||||
|
isFired = false;
|
||||||
//TODO: Create default constructor
|
//TODO: Create default constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shell from a pre-existing arrow ItemStack with lore. If arrow is not a Shell, will create a default shell.
|
* Creates a shell item wrapper from a pre-existing arrow ItemStack with lore. If arrow is not a Shell, will create a default shell.
|
||||||
* @param shell The ItemStack with lore
|
* @param shell The ItemStack with lore
|
||||||
*/
|
*/
|
||||||
public Shell(ItemStack shell){
|
public Shell(ItemStack shell){
|
||||||
|
isFired = false;
|
||||||
|
if(isShell(shell)){
|
||||||
List<String> stats = shell.getItemMeta().getLore();
|
List<String> stats = shell.getItemMeta().getLore();
|
||||||
explosionMultiplier = Double.parseDouble(stats.get(1).substring(11, 14));
|
explosionMultiplier = Double.parseDouble(stats.get(1).substring(11, 14));
|
||||||
penetration = Integer.parseInt(stats.get(2).substring(13));
|
penetration = Integer.parseInt(stats.get(2).substring(13));
|
||||||
@ -36,10 +41,11 @@ public class Shell {
|
|||||||
baseVelocity = Double.parseDouble(stats.get(4).substring(10));
|
baseVelocity = Double.parseDouble(stats.get(4).substring(10));
|
||||||
failChance = Double.parseDouble(stats.get(5).substring(13));
|
failChance = Double.parseDouble(stats.get(5).substring(13));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shell with the specified statistics.
|
* Creates a shell with the specified statistics.
|
||||||
* @param explosionMultiplier Explosion multiplier. 1 represents default 2.5
|
* @param explosionMultiplier Explosion multiplier. 1 represents default 3 (for blockDamage)
|
||||||
* @param penetration
|
* @param penetration
|
||||||
* @param incendiaryType
|
* @param incendiaryType
|
||||||
* @param baseVelocity
|
* @param baseVelocity
|
||||||
@ -53,7 +59,7 @@ public class Shell {
|
|||||||
this.failChance = failChance;
|
this.failChance = failChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** TODO: Finish documentation for this
|
||||||
* Checks if the item stack is a shell
|
* Checks if the item stack is a shell
|
||||||
* @param item ItemStack to check against
|
* @param item ItemStack to check against
|
||||||
* @return True if item is an arrow with a gray name "Shell"
|
* @return True if item is an arrow with a gray name "Shell"
|
||||||
|
@ -26,6 +26,7 @@ public class MortarHandler {
|
|||||||
shellProjectile.setShooter(shooter);
|
shellProjectile.setShooter(shooter);
|
||||||
shellProjectile.setCustomName("shell");
|
shellProjectile.setCustomName("shell");
|
||||||
mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL, mortarLocation, 500, 0, 0, 0, .5);
|
mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL, mortarLocation, 500, 0, 0, 0, .5);
|
||||||
|
//TODO: Experiment with spawnParticle offset parameters. This may create more realistic smoke.
|
||||||
if(shooter instanceof Player) ((Player) shooter).sendMessage("DEBUG: Shell fired with a velocity " + shell.baseVelocity);
|
if(shooter instanceof Player) ((Player) shooter).sendMessage("DEBUG: Shell fired with a velocity " + shell.baseVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user