Fix map generation on mine a diamond challenge.
This commit is contained in:
parent
e114b623bd
commit
45c40f5568
@ -1 +1 @@
|
|||||||
{}
|
[[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"]]
|
@ -60,23 +60,27 @@ public class ChallengeMineADiamond extends Challenge
|
|||||||
{
|
{
|
||||||
player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE));
|
player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE));
|
||||||
}
|
}
|
||||||
for(Block diamond: _diamonds)
|
for (Block diamond : _diamonds)
|
||||||
{
|
{
|
||||||
diamond.setType(Material.DIAMOND);
|
diamond.setType(Material.DIAMOND_ORE);
|
||||||
}
|
}
|
||||||
Host.BlockBreak = true;
|
Host.BlockBreak = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void generateRoom()
|
public void generateRoom()
|
||||||
{
|
{
|
||||||
int amountOfDiamonds = 0;
|
int amountOfDiamonds = 0;
|
||||||
|
|
||||||
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
|
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
|
||||||
{
|
{
|
||||||
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
|
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y <= 2; y++)
|
for (int y = 0; y <= 2; y++)
|
||||||
{
|
{
|
||||||
|
double absX = Math.abs(x);
|
||||||
|
double absZ = Math.abs(z);
|
||||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||||
|
|
||||||
if (y == 0)
|
if (y == 0)
|
||||||
@ -84,39 +88,49 @@ public class ChallengeMineADiamond extends Challenge
|
|||||||
b.setType(Material.DIRT);
|
b.setType(Material.DIRT);
|
||||||
b.setData((byte) 2);
|
b.setData((byte) 2);
|
||||||
}
|
}
|
||||||
else
|
else if (y == 1)
|
||||||
{
|
{
|
||||||
if (amountOfDiamonds == 0)
|
if (absX == getArenaSize() || absZ == getArenaSize())
|
||||||
{
|
{
|
||||||
if (y <= 1)
|
if (UtilMath.random.nextBoolean())
|
||||||
|
b.setType(Material.STONE);
|
||||||
|
else
|
||||||
|
b.setType(Material.COBBLESTONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (amountOfDiamonds == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++)
|
for (int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++)
|
||||||
{
|
{
|
||||||
Block copy = getCenter().getBlock().getRelative(
|
Block copy = getCenter().getBlock().getRelative(
|
||||||
UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1,
|
UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1,
|
||||||
UtilMath.r(getArenaSize() * 2) - (getArenaSize()));
|
UtilMath.r(getArenaSize() * 2) - (getArenaSize()));
|
||||||
if (copy.getType() == Material.DIAMOND_ORE)
|
|
||||||
|
if (copy.getType() == Material.DIAMOND_ORE && Math.abs(copy.getX()) < getArenaSize() && Math.abs(copy.getY()) < getArenaSize())
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_diamonds.add(copy);
|
_diamonds.add(copy);
|
||||||
addBlock(copy);
|
addBlock(copy);
|
||||||
|
|
||||||
amountOfDiamonds++;
|
amountOfDiamonds++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.getType() != Material.DIAMOND_ORE)
|
if (b.getType() != Material.DIAMOND_ORE)
|
||||||
{
|
{
|
||||||
b.setType(_ores.get(UtilMath.r(_ores.size())));
|
b.setType(_ores.get(UtilMath.r(_ores.size())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) && y >= 2)
|
|
||||||
{
|
|
||||||
b.setType(Material.FENCE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (y == 2 && (absX == getArenaSize() || absZ == getArenaSize()))
|
||||||
|
{
|
||||||
|
b.setType(Material.FENCE);
|
||||||
|
}
|
||||||
|
|
||||||
if (b.getType() != Material.AIR)
|
if (b.getType() != Material.AIR)
|
||||||
{
|
{
|
||||||
addBlock(b);
|
addBlock(b);
|
||||||
|
Loading…
Reference in New Issue
Block a user