From 54fa1449f63633468077cee48d0ab87c6a3e183b Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Mon, 25 Jan 2016 08:40:59 +0000 Subject: [PATCH] cannon crater changes --- .../clans/siege/cannon/CannonCrater.java | 29 ++++++++++++------- .../clans/clans/siege/cannon/CraterBlock.java | 8 +++-- .../clans/siege/cannon/CraterEffect.java | 1 + 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java index 19b3e407d..ec8ccf71c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java @@ -80,7 +80,7 @@ public class CannonCrater implements Listener private void createExplosion() { - _blocks.add(new CraterBlock(_origin, Material.AIR)); + _blocks.add(new CraterBlock(_origin, 0, Material.AIR)); HashMap blockList = new HashMap(); int iR = (int) EXPL_RADIUS + 1; @@ -114,13 +114,13 @@ public class CannonCrater implements Listener if (air) { - _blocks.add(new CraterBlock(block.getLocation(), Material.AIR)); + _blocks.add(new CraterBlock(block.getLocation(), distance, Material.AIR)); - Block above = block.getRelative(BlockFace.UP); + Block above = block; while (!UtilItem.isBoundless((above = above.getRelative(BlockFace.UP)).getType())) { - _blocks.add(new CraterBlock(above.getLocation(), Material.AIR)); + _blocks.add(new CraterBlock(above.getLocation(), distance, Material.AIR)); } if (!UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType()) && distance >= 1.5 && UtilMath.random.nextBoolean()) @@ -128,14 +128,21 @@ public class CannonCrater implements Listener _effects.add(new CraterEffect(ParticleType.FLAME, block.getLocation().add(0, .5, 0))); } } - else if (distance > 2 && Math.random() > .75 && UtilItem.isBoundless(block.getRelative(BlockFace.UP).getType()) && !UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType())) + } + + _blocks.forEach(CraterBlock::set); + + for (Entry entry : blockList.entrySet()) + { + Block block = entry.getKey(); + double distance = entry.getValue(); + + if (block.getType() == Material.AIR) continue; + + if (distance > 2 && Math.random() > .65 && UtilItem.isBoundless(block.getRelative(BlockFace.UP).getType()) && !UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType())) { - _blocks.add(new CraterBlock(block.getLocation(), Material.COAL_BLOCK)); - - if (UtilMath.random.nextBoolean()) - { - _effects.add(new CraterEffect(ParticleType.FLAME, block.getLocation().add(0, .5, 0))); - } + _blocks.add(new CraterBlock(block.getLocation(), distance, Material.COAL_BLOCK)); + _effects.add(new CraterEffect(ParticleType.FLAME, block.getLocation().add(0, .5, 0))); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterBlock.java index 39fa0dd7d..21f5b54b1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterBlock.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterBlock.java @@ -7,19 +7,21 @@ public class CraterBlock { public Material Type; public byte Data; + public double DistanceToOrigin; public Location Location; - public CraterBlock(Location location, Material type, byte data) + public CraterBlock(Location location, double dist, Material type, byte data) { Location = location; + DistanceToOrigin = dist; Type = type; Data = data; } - public CraterBlock(Location location, Material type) + public CraterBlock(Location location, double dist, Material type) { - this(location, type, (byte) 0); + this(location, dist, type, (byte) 0); } public void set() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterEffect.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterEffect.java index c13dcab8a..aa2392d77 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterEffect.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CraterEffect.java @@ -25,6 +25,7 @@ public class CraterEffect public void update() { UtilParticle.PlayParticle(_particle, _location, new Vector(0, 0, 0), .1f, 1, ViewDist.MAX); + System.out.println(_particle); } public long getLifetime()