cannon crater changes
This commit is contained in:
parent
c43c09fd3c
commit
54fa1449f6
@ -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<Block, Double> blockList = new HashMap<Block, Double>();
|
||||
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.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.forEach(CraterBlock::set);
|
||||
|
||||
for (Entry<Block, Double> 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(), distance, Material.COAL_BLOCK));
|
||||
_effects.add(new CraterEffect(ParticleType.FLAME, block.getLocation().add(0, .5, 0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user