reicpe changes
This commit is contained in:
parent
d6d70a80dc
commit
3a3bcaeeae
4 changed files with 42 additions and 37 deletions
Binary file not shown.
Binary file not shown.
|
@ -12,6 +12,10 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class Generator extends ChunkGenerator {
|
||||
|
||||
public static int getHash(int x,int z) {
|
||||
return (((x * 223) ^ (z * 82395) ^ (x * 9634) ^ (z * 23958)) & 0x2FF3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateNoise(WorldInfo worldInfo, Random random, int chunkX, int chunkZ,
|
||||
ChunkGenerator.ChunkData chunkData) {
|
||||
|
@ -30,9 +34,9 @@ public class Generator extends ChunkGenerator {
|
|||
int x2 = chunkX * 16 + x;
|
||||
int z2 = chunkZ * 16 + z;
|
||||
|
||||
if ((((x2 * 223) ^ (z2 * 82395) ^ (x2 * 9634) ^ (z2 * 23958)) & 0xFF3) == (y & (y * 7))) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
for (int b = 0; b < 3; b++) {
|
||||
if (Generator.getHash(x2,z2) == (y & (y * 7))) {
|
||||
for (int a = 0; a < 6; a++) {
|
||||
for (int b = 0; b < 6; b++) {
|
||||
chunkData.setBlock((x+a)%16, y, (z+b)%16, Material.STONE);
|
||||
}
|
||||
}
|
||||
|
@ -44,14 +48,13 @@ public class Generator extends ChunkGenerator {
|
|||
|
||||
@Override
|
||||
public boolean canSpawn(World world, int x, int z) {
|
||||
int h = (((x * 223) ^ (z * 82395) ^ (x * 9634) ^ (z * 23958)) & 0xFF3);
|
||||
return (h >= 0 && h < 256);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBaseHeight(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z,
|
||||
@NotNull HeightMap heightMap) {
|
||||
int h = (((x * 223) ^ (z * 82395) ^ (x * 9634) ^ (z * 23958)) & 0xFF3);
|
||||
int h = Generator.getHash(x,z);
|
||||
h = Math.max(h, worldInfo.getMinHeight());
|
||||
return Math.min(h,worldInfo.getMaxHeight());
|
||||
}
|
||||
|
|
|
@ -21,33 +21,46 @@ public class Handler implements Listener {
|
|||
e.setCancelled(true);
|
||||
for (Block b : e.blockList()) {
|
||||
Location loc = b.getLocation();
|
||||
|
||||
if (b.getType() == Material.STONE) {
|
||||
b.setType(Material.LAVA);
|
||||
} else if (b.getType() == Material.COBBLESTONE) {
|
||||
Material[] items = {
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.COAL_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.IRON_ORE,
|
||||
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.IRON_ORE,
|
||||
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.IRON_ORE,
|
||||
|
||||
Material.GOLD_ORE,
|
||||
Material.ICE
|
||||
Material.GOLD_ORE
|
||||
};
|
||||
|
||||
b.setType(items[new Random().nextInt(items.length)]);
|
||||
|
||||
b.setType(Material.AIR);
|
||||
if (new Random().nextInt(8) != 0) continue;
|
||||
b.getWorld().dropItem(loc, new ItemStack(items[new Random().nextInt(items.length)]));
|
||||
} else if (b.getType() == Material.GRAVEL) {
|
||||
b.setType(Material.AIR);
|
||||
b.getWorld().dropItem(loc, new ItemStack(Material.QUARTZ));
|
||||
if (new Random().nextInt(8) != 0) continue;
|
||||
b.getWorld().dropItem(loc, new ItemStack(Material.NETHER_QUARTZ_ORE));
|
||||
} else if (b.getType() == Material.COAL_ORE) {
|
||||
Material[] items = {
|
||||
Material.GRASS_BLOCK,
|
||||
Material.GRASS_BLOCK,
|
||||
Material.GRASS_BLOCK,
|
||||
Material.DIAMOND_ORE
|
||||
};
|
||||
|
||||
b.setType(Material.AIR);
|
||||
if (new Random().nextInt(8) != 0) continue;
|
||||
b.getWorld().dropItem(loc, new ItemStack(items[new Random().nextInt(items.length)]));
|
||||
} else if (b.getType() == Material.NETHER_QUARTZ_ORE) {
|
||||
Material[] items = {
|
||||
Material.EMERALD_ORE,
|
||||
Material.LAPIS_ORE,
|
||||
Material.REDSTONE_ORE,
|
||||
Material.ANCIENT_DEBRIS
|
||||
};
|
||||
|
||||
b.setType(Material.AIR);
|
||||
if (new Random().nextInt(8) != 0) continue;
|
||||
b.getWorld().dropItem(loc, new ItemStack(items[new Random().nextInt(items.length)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +74,7 @@ public class Handler implements Listener {
|
|||
|
||||
ItemStack i = p.getInventory().getItem(p.getInventory().getHeldItemSlot());
|
||||
|
||||
if (i != null && !i.isEmpty())
|
||||
if (i != null && !i.isEmpty() && b.isPreferredTool(i))
|
||||
return;
|
||||
|
||||
Location loc = b.getLocation();
|
||||
|
@ -71,8 +84,6 @@ public class Handler implements Listener {
|
|||
if (b.getType() == Material.STONE) {
|
||||
e.setCancelled(true);
|
||||
b.setType(Material.COBBLESTONE);
|
||||
|
||||
b.getWorld().dropItem(loc, new ItemStack(Material.GRAVEL));
|
||||
} else if (b.getType() == Material.COBBLESTONE) {
|
||||
e.setCancelled(true);
|
||||
b.setType(Material.AIR);
|
||||
|
@ -81,18 +92,9 @@ public class Handler implements Listener {
|
|||
Material.GRAVEL,
|
||||
Material.GRAVEL,
|
||||
Material.SAND,
|
||||
Material.SAND,
|
||||
Material.CLAY_BALL,
|
||||
Material.CLAY_BALL,
|
||||
Material.RED_SAND,
|
||||
Material.GRAVEL,
|
||||
Material.GRAVEL,
|
||||
Material.SAND,
|
||||
Material.SAND,
|
||||
Material.CLAY_BALL,
|
||||
Material.CLAY_BALL,
|
||||
Material.RED_SAND,
|
||||
Material.IRON_NUGGET
|
||||
Material.CLAY_BALL
|
||||
};
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
|
|
Loading…
Reference in a new issue