exploision stuff

This commit is contained in:
biglyderv 2024-11-17 01:13:39 -05:00
parent bb8b76f22d
commit a003fc2446
6 changed files with 39 additions and 3 deletions

View file

@ -31,8 +31,8 @@ public class Generator extends ChunkGenerator {
int z2 = chunkZ * 16 + z;
if ((((x2 * 223) ^ (z2 * 82395) ^ (x2 * 9634) ^ (z2 * 23958)) & 0xFF3) == (y & (y * 7))) {
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
for (int a = 0; a < 3; a++) {
for (int b = 0; b < 3; b++) {
chunkData.setBlock((x+a)%16, y, (z+b)%16, Material.STONE);
}
}

View file

@ -10,9 +10,45 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.inventory.ItemStack;
public class Handler implements Listener {
@EventHandler
private void onBlockExplode(BlockExplodeEvent e) {
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.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
};
b.setType(items[new Random().nextInt(items.length)]);
} else if (b.getType() == Material.GRAVEL) {
b.setType(Material.AIR);
b.getWorld().dropItem(loc, new ItemStack(Material.QUARTZ));
}
}
}
@EventHandler
private void onBlockBreak(BlockBreakEvent e) {
Block b = e.getBlock();
@ -56,7 +92,6 @@ public class Handler implements Listener {
Material.IRON_NUGGET
};
for (int j = 0; j < 3; j++) {
Material r = items[new Random().nextInt(items.length)];
b.getWorld().dropItem(loc, new ItemStack(r));

View file

@ -55,6 +55,7 @@ public class Main extends JavaPlugin {
recipe.shape("AA ", "AA ", " ");
recipe.setIngredient('A', Material.COBBLESTONE);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "CobbledStone");
item = new ItemStack(Material.COBBLESTONE);