change around some things

This commit is contained in:
biglyderv 2025-01-17 22:29:04 -05:00
parent 3b5a958fa6
commit 8d2f4e0039
5 changed files with 47 additions and 83 deletions

View file

@ -28,7 +28,7 @@ dependencies {
// This dependency is used by the application. // This dependency is used by the application.
implementation(libs.guava) implementation(libs.guava)
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
} }
// Apply a specific Java toolchain to ease working on different environments. // Apply a specific Java toolchain to ease working on different environments.

View file

@ -8,10 +8,17 @@ import org.bukkit.World;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.WorldInfo; import org.bukkit.generator.WorldInfo;
import org.bukkit.util.noise.PerlinNoiseGenerator;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class Generator extends ChunkGenerator { public class Generator extends ChunkGenerator {
public PerlinNoiseGenerator gen;
public Generator() {
this.gen = new PerlinNoiseGenerator(69420);
}
public static int getHash(int x,int z) { public static int getHash(int x,int z) {
return (((x * 223) ^ (z * 82395) ^ (x * 9634) ^ (z * 23958)) & 0x2FF3); return (((x * 223) ^ (z * 82395) ^ (x * 9634) ^ (z * 23958)) & 0x2FF3);
} }
@ -34,13 +41,12 @@ public class Generator extends ChunkGenerator {
int x2 = chunkX * 16 + x; int x2 = chunkX * 16 + x;
int z2 = chunkZ * 16 + z; int z2 = chunkZ * 16 + z;
if (Generator.getHash(x2,z2) == (y & (y * 7))) { double fac = (y - chunkData.getMinHeight()) / (1.0 * chunkData.getMaxHeight());
for (int a = 0; a < 8; a++) { fac = 1.0 - fac;
for (int b = 0; b < 8; b++) {
chunkData.setBlock((x+a)%16, y, (z+b)%16, Material.STONE); if (this.gen.noise(x2 * 0.01,y* 0.01,z2* 0.01, 5, 1.5, 0.5) * fac < 0.4) continue;
}
} chunkData.setBlock(x, y, z, Material.STONE);
}
} }
} }
} }

View file

@ -29,7 +29,7 @@ public class Handler implements Listener {
} }
@EventHandler @EventHandler
private void onBlockExplode(EntityExplodeEvent e) { private void onBlockExplode(BlockExplodeEvent e) {
e.setCancelled(true); e.setCancelled(true);
for (Block b : e.blockList()) { for (Block b : e.blockList()) {
Location loc = b.getLocation(); Location loc = b.getLocation();
@ -38,27 +38,30 @@ public class Handler implements Listener {
b.setType(Material.LAVA); b.setType(Material.LAVA);
} else if (b.getType() == Material.COBBLESTONE || b.getType() == Material.GRAVEL) { } else if (b.getType() == Material.COBBLESTONE || b.getType() == Material.GRAVEL) {
Material[] items = { Material[] items = {
Material.ICE,
Material.ICE,
Material.ICE,
Material.ICE,
Material.ICE,
Material.ICE,
Material.ICE, Material.ICE,
Material.ICE, Material.ICE,
Material.COAL_ORE, Material.COAL_ORE,
Material.ICE, Material.COAL_ORE,
Material.ICE, Material.COAL_ORE,
Material.COAL_ORE,
Material.COAL_ORE,
Material.COAL_ORE,
Material.COAL_ORE,
Material.COAL_ORE, Material.COAL_ORE,
Material.COPPER_ORE, Material.COPPER_ORE,
Material.ICE, Material.COPPER_ORE,
Material.ICE, Material.COPPER_ORE,
Material.COAL_ORE,
Material.ICE,
Material.ICE,
Material.COAL_ORE,
Material.COPPER_ORE, Material.COPPER_ORE,
Material.IRON_ORE, Material.IRON_ORE,
Material.IRON_ORE,
Material.GOLD_ORE,
Material.GOLD_ORE, Material.GOLD_ORE,
Material.EMERALD_ORE,
Material.LAPIS_ORE,
Material.REDSTONE_ORE,
Material.ANCIENT_DEBRIS,
Material.NETHER_QUARTZ_ORE,
Material.DIAMOND_ORE Material.DIAMOND_ORE
}; };

View file

@ -4,6 +4,7 @@ import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Server;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -21,125 +22,79 @@ public class Main extends JavaPlugin {
public void onEnable() { public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Handler(), this); Bukkit.getPluginManager().registerEvents(new Handler(), this);
Server server = getServer();
NamespacedKey key = new NamespacedKey(this, "FlintAxe"); NamespacedKey key = new NamespacedKey(this, "FlintAxe");
ItemStack item = new ItemStack(Material.STONE_AXE); ItemStack item = new ItemStack(Material.STONE_AXE);
Damageable meta = (Damageable) item.getItemMeta(); Damageable meta = (Damageable) item.getItemMeta();
meta.setMaxDamage(80); meta.setMaxDamage(80);
meta.displayName(Component.text("Flint Axe")); meta.displayName(Component.text("Flint Axe"));
item.setItemMeta(meta); item.setItemMeta(meta);
ShapedRecipe recipe = new ShapedRecipe(key, item); ShapedRecipe recipe = new ShapedRecipe(key, item);
recipe.shape("A ", "B ", " "); recipe.shape("A ", "B ", " ");
recipe.setIngredient('A', Material.FLINT); recipe.setIngredient('A', Material.FLINT);
recipe.setIngredient('B', Material.STICK); recipe.setIngredient('B', Material.STICK);
server.addRecipe(recipe);
key = new NamespacedKey(this, "FlintPickaxe"); key = new NamespacedKey(this, "FlintPickaxe");
item = new ItemStack(Material.STONE_PICKAXE); item = new ItemStack(Material.STONE_PICKAXE);
meta = (Damageable) item.getItemMeta(); meta = (Damageable) item.getItemMeta();
meta.setMaxDamage(100); meta.setMaxDamage(100);
meta.displayName(Component.text("Flint Pickaxe")); meta.displayName(Component.text("Flint Pickaxe"));
item.setItemMeta(meta); item.setItemMeta(meta);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("AA ", "B ", " "); recipe.shape("AA ", "B ", " ");
recipe.setIngredient('A', Material.FLINT); recipe.setIngredient('A', Material.FLINT);
recipe.setIngredient('B', Material.STICK); recipe.setIngredient('B', Material.STICK);
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "BoneDirt"); key = new NamespacedKey(this, "BoneDirt");
item = new ItemStack(Material.GRASS_BLOCK,1); item = new ItemStack(Material.GRASS_BLOCK,1);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("AAA", "ABA", "ACA"); recipe.shape("AAA", "ABA", "ACA");
recipe.setIngredient('A', Material.GRAVEL); recipe.setIngredient('A', Material.GRAVEL);
recipe.setIngredient('B', Material.BONE_MEAL); recipe.setIngredient('B', Material.BONE_MEAL);
recipe.setIngredient('C', new RecipeChoice.MaterialChoice(Material.COAL,Material.CHARCOAL)); recipe.setIngredient('C', new RecipeChoice.MaterialChoice(Material.COAL,Material.CHARCOAL));
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "SandCane");
item = new ItemStack(Material.SUGAR_CANE,1);
recipe = new ShapedRecipe(key, item);
recipe.shape("AAA", "ABA", "ACA");
recipe.setIngredient('A', Material.SAND);
recipe.setIngredient('B', Material.BONE_MEAL);
recipe.setIngredient('C', new RecipeChoice.MaterialChoice(Material.COAL,Material.CHARCOAL));
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "StoneStick"); key = new NamespacedKey(this, "StoneStick");
item = new ItemStack(Material.STICK,4); item = new ItemStack(Material.STICK,4);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("A ", "A ", " "); recipe.shape("A ", "A ", " ");
recipe.setIngredient('A', Material.COBBLESTONE); recipe.setIngredient('A', Material.COBBLESTONE);
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "GrassSapling"); key = new NamespacedKey(this, "GrassSapling");
item = new ItemStack(Material.OAK_SAPLING); item = new ItemStack(Material.OAK_SAPLING);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("AAA", "ABA", "AAA"); recipe.shape("AAA", "ABA", "AAA");
recipe.setIngredient('A', Material.BONE_MEAL); recipe.setIngredient('A', Material.BONE_MEAL);
recipe.setIngredient('B', Material.DIRT); recipe.setIngredient('B', Material.DIRT);
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "SandCactus");
item = new ItemStack(Material.CACTUS);
recipe = new ShapedRecipe(key, item);
recipe.shape("AAA", "ABA", "AAA");
recipe.setIngredient('A', Material.BONE_MEAL);
recipe.setIngredient('B', Material.SAND);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "CoarseishDirt"); key = new NamespacedKey(this, "CoarseishDirt");
item = new ItemStack(Material.COARSE_DIRT,2); item = new ItemStack(Material.COARSE_DIRT,2);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("AB ", " ", " "); recipe.shape("AB ", " ", " ");
recipe.setIngredient('A', Material.GRAVEL); recipe.setIngredient('A', Material.GRAVEL);
recipe.setIngredient('B', Material.DIRT); recipe.setIngredient('B', Material.DIRT);
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "StoneTable"); key = new NamespacedKey(this, "StoneTable");
item = new ItemStack(Material.CRAFTING_TABLE); item = new ItemStack(Material.CRAFTING_TABLE);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("AA ", "AA ", " "); recipe.shape("AA ", "AA ", " ");
recipe.setIngredient('A', Material.COBBLESTONE); recipe.setIngredient('A', Material.COBBLESTONE);
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "CobbledStone"); key = new NamespacedKey(this, "CobbledStone");
item = new ItemStack(Material.COBBLESTONE); item = new ItemStack(Material.COBBLESTONE);
recipe = new ShapedRecipe(key, item); recipe = new ShapedRecipe(key, item);
recipe.shape("AA ", "AA ", " "); recipe.shape("AA ", "AA ", " ");
recipe.setIngredient('A', Material.GRAVEL); recipe.setIngredient('A', Material.GRAVEL);
server.addRecipe(recipe);
getServer().addRecipe(recipe);
key = new NamespacedKey(this, "AltUpgrade");
item = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
recipe = new ShapedRecipe(key, item);
recipe.shape("ABA", "ACA", "AAA");
recipe.setIngredient('A', Material.DIAMOND);
recipe.setIngredient('B', Material.NETHERITE_INGOT);
recipe.setIngredient('C', Material.NETHERRACK);
getServer().addRecipe(recipe);
} }
@Override @Override

View file

@ -1,8 +1,8 @@
name: MinzeoPlugin name: DerverCore
version: 1.0.0 version: 2.0.0
main: net.xuyezo.main.Main main: net.xuyezo.main.Main
description: A test plugin description: A test plugin
author: 08draven author: BiglyDerv
website: https://xuyezo.net/ website: https://dervland.net/
api-version: '1.21.1' api-version: '1.21.4'
load: STARTUP load: STARTUP