forked from archive/derver-plugin
change around some things
This commit is contained in:
parent
3b5a958fa6
commit
8d2f4e0039
5 changed files with 47 additions and 83 deletions
|
@ -28,7 +28,7 @@ dependencies {
|
|||
// This dependency is used by the application.
|
||||
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.
|
||||
|
|
|
@ -8,10 +8,17 @@ import org.bukkit.World;
|
|||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
import org.bukkit.util.noise.PerlinNoiseGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Generator extends ChunkGenerator {
|
||||
|
||||
public PerlinNoiseGenerator gen;
|
||||
|
||||
public Generator() {
|
||||
this.gen = new PerlinNoiseGenerator(69420);
|
||||
}
|
||||
|
||||
public static int getHash(int x,int z) {
|
||||
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 z2 = chunkZ * 16 + z;
|
||||
|
||||
if (Generator.getHash(x2,z2) == (y & (y * 7))) {
|
||||
for (int a = 0; a < 8; a++) {
|
||||
for (int b = 0; b < 8; b++) {
|
||||
chunkData.setBlock((x+a)%16, y, (z+b)%16, Material.STONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
double fac = (y - chunkData.getMinHeight()) / (1.0 * chunkData.getMaxHeight());
|
||||
fac = 1.0 - fac;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class Handler implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
private void onBlockExplode(EntityExplodeEvent e) {
|
||||
private void onBlockExplode(BlockExplodeEvent e) {
|
||||
e.setCancelled(true);
|
||||
for (Block b : e.blockList()) {
|
||||
Location loc = b.getLocation();
|
||||
|
@ -38,27 +38,30 @@ public class Handler implements Listener {
|
|||
b.setType(Material.LAVA);
|
||||
} else if (b.getType() == Material.COBBLESTONE || b.getType() == Material.GRAVEL) {
|
||||
Material[] items = {
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.COAL_ORE,
|
||||
Material.ICE,
|
||||
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.ICE,
|
||||
Material.ICE,
|
||||
Material.COAL_ORE,
|
||||
Material.ICE,
|
||||
Material.ICE,
|
||||
Material.COAL_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.COPPER_ORE,
|
||||
Material.IRON_ORE,
|
||||
Material.IRON_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
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.kyori.adventure.text.Component;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
@ -21,18 +22,19 @@ public class Main extends JavaPlugin {
|
|||
public void onEnable() {
|
||||
Bukkit.getPluginManager().registerEvents(new Handler(), this);
|
||||
|
||||
Server server = getServer();
|
||||
|
||||
NamespacedKey key = new NamespacedKey(this, "FlintAxe");
|
||||
ItemStack item = new ItemStack(Material.STONE_AXE);
|
||||
Damageable meta = (Damageable) item.getItemMeta();
|
||||
meta.setMaxDamage(80);
|
||||
meta.displayName(Component.text("Flint Axe"));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
ShapedRecipe recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("A ", "B ", " ");
|
||||
recipe.setIngredient('A', Material.FLINT);
|
||||
recipe.setIngredient('B', Material.STICK);
|
||||
|
||||
server.addRecipe(recipe);
|
||||
|
||||
key = new NamespacedKey(this, "FlintPickaxe");
|
||||
item = new ItemStack(Material.STONE_PICKAXE);
|
||||
|
@ -40,106 +42,59 @@ public class Main extends JavaPlugin {
|
|||
meta.setMaxDamage(100);
|
||||
meta.displayName(Component.text("Flint Pickaxe"));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("AA ", "B ", " ");
|
||||
recipe.setIngredient('A', Material.FLINT);
|
||||
recipe.setIngredient('B', Material.STICK);
|
||||
|
||||
getServer().addRecipe(recipe);
|
||||
server.addRecipe(recipe);
|
||||
|
||||
key = new NamespacedKey(this, "BoneDirt");
|
||||
item = new ItemStack(Material.GRASS_BLOCK,1);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("AAA", "ABA", "ACA");
|
||||
recipe.setIngredient('A', Material.GRAVEL);
|
||||
recipe.setIngredient('B', Material.BONE_MEAL);
|
||||
recipe.setIngredient('C', new RecipeChoice.MaterialChoice(Material.COAL,Material.CHARCOAL));
|
||||
|
||||
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);
|
||||
server.addRecipe(recipe);
|
||||
|
||||
key = new NamespacedKey(this, "StoneStick");
|
||||
item = new ItemStack(Material.STICK,4);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("A ", "A ", " ");
|
||||
recipe.setIngredient('A', Material.COBBLESTONE);
|
||||
|
||||
getServer().addRecipe(recipe);
|
||||
server.addRecipe(recipe);
|
||||
|
||||
key = new NamespacedKey(this, "GrassSapling");
|
||||
item = new ItemStack(Material.OAK_SAPLING);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("AAA", "ABA", "AAA");
|
||||
recipe.setIngredient('A', Material.BONE_MEAL);
|
||||
recipe.setIngredient('B', Material.DIRT);
|
||||
|
||||
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);
|
||||
server.addRecipe(recipe);
|
||||
|
||||
|
||||
key = new NamespacedKey(this, "CoarseishDirt");
|
||||
item = new ItemStack(Material.COARSE_DIRT,2);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("AB ", " ", " ");
|
||||
recipe.setIngredient('A', Material.GRAVEL);
|
||||
recipe.setIngredient('B', Material.DIRT);
|
||||
|
||||
getServer().addRecipe(recipe);
|
||||
server.addRecipe(recipe);
|
||||
|
||||
|
||||
key = new NamespacedKey(this, "StoneTable");
|
||||
item = new ItemStack(Material.CRAFTING_TABLE);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("AA ", "AA ", " ");
|
||||
recipe.setIngredient('A', Material.COBBLESTONE);
|
||||
|
||||
getServer().addRecipe(recipe);
|
||||
server.addRecipe(recipe);
|
||||
|
||||
key = new NamespacedKey(this, "CobbledStone");
|
||||
item = new ItemStack(Material.COBBLESTONE);
|
||||
|
||||
recipe = new ShapedRecipe(key, item);
|
||||
recipe.shape("AA ", "AA ", " ");
|
||||
recipe.setIngredient('A', Material.GRAVEL);
|
||||
|
||||
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);
|
||||
server.addRecipe(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
name: MinzeoPlugin
|
||||
version: 1.0.0
|
||||
name: DerverCore
|
||||
version: 2.0.0
|
||||
main: net.xuyezo.main.Main
|
||||
description: A test plugin
|
||||
author: 08draven
|
||||
website: https://xuyezo.net/
|
||||
api-version: '1.21.1'
|
||||
author: BiglyDerv
|
||||
website: https://dervland.net/
|
||||
api-version: '1.21.4'
|
||||
load: STARTUP
|
Loading…
Reference in a new issue