1.18 world gen
This commit is contained in:
parent
3c9c76e169
commit
d47b65ebfd
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -39,10 +39,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>worldedit-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.io/repository/maven-public/</url>
|
||||
@ -53,42 +49,10 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.2.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>worldedit-core</artifactId>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<groupId>com.sk89q.worldedit.worldedit-libs</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<groupId>io.papermc</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<groupId>org.bstats</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>fastutil</artifactId>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@ -113,11 +77,5 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>nl.rutgerkok</groupId>
|
||||
<artifactId>worldgeneratorapi</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
19
pom.xml
19
pom.xml
@ -45,10 +45,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>worldedit-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.io/repository/maven-public/</url>
|
||||
@ -58,26 +54,13 @@
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.2.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>nl.rutgerkok</groupId>
|
||||
<artifactId>worldgeneratorapi</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>provided</scope> <!-- Important, otherwise WorldGeneratorApi will be placed in your JAR file if you're using maven-shade-plugin -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
|
@ -1,423 +0,0 @@
|
||||
package io.github.officereso;
|
||||
|
||||
import nl.rutgerkok.worldgeneratorapi.decoration.Decoration;
|
||||
import nl.rutgerkok.worldgeneratorapi.decoration.DecorationArea;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static nl.rutgerkok.worldgeneratorapi.decoration.DecorationArea.DECORATION_RADIUS;
|
||||
|
||||
public class DecorationGenerator implements Decoration {
|
||||
World world;
|
||||
List<List<List<BlockData>>> tree1 = new ArrayList<>();
|
||||
List<List<List<BlockData>>> tree2 = new ArrayList<>();
|
||||
List<List<List<BlockData>>> tree3 = new ArrayList<>();
|
||||
List<List<List<BlockData>>> tree4 = new ArrayList<>();
|
||||
List<List<List<List<BlockData>>>> trees = new ArrayList<>();
|
||||
|
||||
public DecorationGenerator() {
|
||||
this.world = Bukkit.getWorld("world");
|
||||
String tree1String = null;
|
||||
String tree2String = null;
|
||||
String tree3String = null;
|
||||
String tree4String = null;
|
||||
try {
|
||||
tree1String = new String (Files.readAllBytes(Paths.get("plugins/stonedIn/tree1.txt")));
|
||||
tree2String = new String (Files.readAllBytes(Paths.get("plugins/stonedIn/tree2.txt")));
|
||||
tree3String = new String (Files.readAllBytes(Paths.get("plugins/stonedIn/tree3.txt")));
|
||||
tree4String = new String (Files.readAllBytes(Paths.get("plugins/stonedIn/tree4.txt")));
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
tree1String = tree1String.replace("Â", "");
|
||||
tree2String = tree2String.replace("Â", "");
|
||||
tree3String = tree3String.replace("Â", "");
|
||||
tree4String = tree4String.replace("Â", "");
|
||||
|
||||
for (String YChunk : tree1String.split("\u00A7")) {
|
||||
List<List<BlockData>> layer = new ArrayList<>();
|
||||
for (String ZChunk : YChunk.split("\u00B6")) {
|
||||
List<BlockData> row = new ArrayList<>();
|
||||
layer.add(row);
|
||||
for (String XChunk : ZChunk.split("✓")){
|
||||
BlockData blockData = Bukkit.getServer().createBlockData(XChunk);
|
||||
row.add(blockData);
|
||||
}
|
||||
}
|
||||
tree1.add(layer);
|
||||
}
|
||||
|
||||
for (String YChunk : tree2String.split("\u00A7")) {
|
||||
List<List<BlockData>> layer = new ArrayList<>();
|
||||
for (String ZChunk : YChunk.split("\u00B6")) {
|
||||
List<BlockData> row = new ArrayList<>();
|
||||
layer.add(row);
|
||||
for (String XChunk : ZChunk.split("✓")){
|
||||
BlockData blockData = Bukkit.getServer().createBlockData(XChunk);
|
||||
row.add(blockData);
|
||||
}
|
||||
}
|
||||
tree2.add(layer);
|
||||
}
|
||||
|
||||
for (String YChunk : tree3String.split("\u00A7")) {
|
||||
List<List<BlockData>> layer = new ArrayList<>();
|
||||
for (String ZChunk : YChunk.split("\u00B6")) {
|
||||
List<BlockData> row = new ArrayList<>();
|
||||
layer.add(row);
|
||||
for (String XChunk : ZChunk.split("✓")){
|
||||
BlockData blockData = Bukkit.getServer().createBlockData(XChunk);
|
||||
row.add(blockData);
|
||||
}
|
||||
}
|
||||
tree3.add(layer);
|
||||
}
|
||||
|
||||
for (String YChunk : tree4String.split("\u00A7")) {
|
||||
List<List<BlockData>> layer = new ArrayList<>();
|
||||
for (String ZChunk : YChunk.split("\u00B6")) {
|
||||
List<BlockData> row = new ArrayList<>();
|
||||
layer.add(row);
|
||||
for (String XChunk : ZChunk.split("✓")){
|
||||
BlockData blockData = Bukkit.getServer().createBlockData(XChunk);
|
||||
row.add(blockData);
|
||||
}
|
||||
}
|
||||
tree4.add(layer);
|
||||
}
|
||||
|
||||
trees.add(tree1);
|
||||
trees.add(tree2);
|
||||
trees.add(tree3);
|
||||
trees.add(tree4);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorate(DecorationArea decorationArea, Random random) {
|
||||
structures(decorationArea, random);
|
||||
andesite(decorationArea, random);
|
||||
diorite(decorationArea, random);
|
||||
granite(decorationArea, random);
|
||||
gravel(decorationArea, random);
|
||||
sand(decorationArea, random);
|
||||
coal(decorationArea, random);
|
||||
redstone(decorationArea, random);
|
||||
lapis(decorationArea, random);
|
||||
iron(decorationArea, random);
|
||||
gold(decorationArea, random);
|
||||
diamond(decorationArea, random);
|
||||
}
|
||||
|
||||
|
||||
public void coal(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(20) + 10;
|
||||
int veinRadius = random.nextInt(5) + 1;
|
||||
int veinLength = 6;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(220) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.COAL_ORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void iron(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(15) + 10;
|
||||
int veinRadius = random.nextInt(2)+1;
|
||||
int veinLength = 3;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(130) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.IRON_ORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void gold(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(8) + 5;
|
||||
int veinRadius = random.nextInt(2) + 2;
|
||||
int veinLength = 2;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(180) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.GOLD_ORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void diamond(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(3) + 1;
|
||||
int veinRadius = random.nextInt(1) + 1;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(110) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, 1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.DIAMOND_ORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void redstone(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(7) + 3;
|
||||
int veinRadius = random.nextInt(5) + 2;
|
||||
int veinLength = 4;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(170) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.REDSTONE_ORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void andesite(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(20) + 20;
|
||||
int veinRadius = random.nextInt(30) + 35;
|
||||
int veinLength = 6;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(240) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.ANDESITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void granite(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(20) + 20;
|
||||
int veinRadius = random.nextInt(30) + 35;
|
||||
int veinLength = 6;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(240) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.GRANITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void diorite(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(20) + 20;
|
||||
int veinRadius = random.nextInt(30) + 35;
|
||||
int veinLength = 6;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(240) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.DIORITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void gravel(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(20) + 20;
|
||||
int veinRadius = random.nextInt(30) + 35;
|
||||
int veinLength = 6;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(240) + 6;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.GRAVEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sand(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(20) + 20;
|
||||
int veinRadius = random.nextInt(30) + 35;
|
||||
int veinLength = 6;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(75) + 150;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.SAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void lapis(DecorationArea decorationArea, Random random) {
|
||||
int veinCount = random.nextInt(2) + 1;
|
||||
int veinRadius = random.nextInt(3) + 3;
|
||||
int veinLength = 1;
|
||||
|
||||
for (int i = 0; i < veinCount; i++) {
|
||||
int x = decorationArea.getCenterX() - DECORATION_RADIUS + random.nextInt(16);
|
||||
int y = random.nextInt(30) + 200;
|
||||
int z = decorationArea.getCenterZ() - DECORATION_RADIUS + random.nextInt(16);
|
||||
|
||||
for (int vr = 0; vr <= veinRadius; vr++) {
|
||||
Location loc1 = new Location(world, x, y, z, (random.nextFloat() - .5f) * 360F, (random.nextFloat() - .5f) * 360F);
|
||||
BlockIterator veinLine = new BlockIterator(loc1, 0, random.nextInt(veinLength)+1);
|
||||
|
||||
while (veinLine.hasNext()) {
|
||||
Location loc = veinLine.next().getLocation();
|
||||
Material material = decorationArea.getBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ());
|
||||
if (material == Material.STONE) {
|
||||
decorationArea.setBlock((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(), Material.LAPIS_ORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void structures(DecorationArea decorationArea, Random random) {
|
||||
int rand = random.nextInt(300);
|
||||
int y = random.nextInt(50) + 175;
|
||||
if (rand == 0){
|
||||
List<List<List<BlockData>>> tree = trees.get(random.nextInt(trees.size()));
|
||||
int startX = decorationArea.getCenterX() - DECORATION_RADIUS;
|
||||
int startZ = decorationArea.getCenterZ() - DECORATION_RADIUS;
|
||||
|
||||
int blockY = y-tree.size();
|
||||
for (List<List<BlockData>> layer : tree){
|
||||
blockY++;
|
||||
int blockZ = startZ;
|
||||
for (List<BlockData> row : layer){
|
||||
blockZ++;
|
||||
int blockX = startX;
|
||||
for (BlockData block : row){
|
||||
blockX++;
|
||||
decorationArea.setBlock(blockX, blockY, blockZ, block.getMaterial());
|
||||
decorationArea.setBlockData(blockX, blockY, blockZ, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,121 @@
|
||||
package io.github.officereso;
|
||||
|
||||
import nl.rutgerkok.worldgeneratorapi.BaseTerrainGenerator;
|
||||
import nl.rutgerkok.worldgeneratorapi.BiomeGenerator;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Generate implements BaseTerrainGenerator {
|
||||
import java.util.Random;
|
||||
|
||||
public class Generate extends ChunkGenerator {
|
||||
@Override
|
||||
public void setBlocksInChunk(GeneratingChunk generatingChunk) {
|
||||
generatingChunk.getBlocksForChunk().setRegion(0, 0, 0, CHUNK_SIZE, 230, CHUNK_SIZE, Material.STONE);
|
||||
generatingChunk.getBlocksForChunk().setRegion(0, 230, 0, CHUNK_SIZE, 254, CHUNK_SIZE, Material.BEDROCK);
|
||||
public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkY, @NotNull ChunkGenerator.ChunkData chunkData) {
|
||||
int minHeight = worldInfo.getMinHeight();
|
||||
int maxHeight = worldInfo.getMaxHeight();
|
||||
|
||||
|
||||
for (int y = minHeight + 3; y <= maxHeight - 20; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunkData.setBlock(x, y, z, Material.STONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = maxHeight - 50; y <= maxHeight - 20; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
if (random.nextInt(10) <= 6)
|
||||
chunkData.setBlock(x, y, z, Material.SAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = maxHeight - 80; y <= maxHeight - 20; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
if (random.nextInt(10) <= 6)
|
||||
chunkData.setBlock(x, y, z, Material.GRAVEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = maxHeight - 80; y <= maxHeight - 20; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
if (random.nextInt(20) == 1)
|
||||
chunkData.setBlock(x, y, z, Material.LAVA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = maxHeight - 80; y <= maxHeight - 20; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
if (random.nextInt(200) == 1)
|
||||
chunkData.setBlock(x, y, z, Material.GRASS_BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = maxHeight - 80; y <= maxHeight - 20; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
if (random.nextInt(100) == 1)
|
||||
chunkData.setBlock(x, y, z, Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = minHeight; y <= minHeight + 2; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunkData.setBlock(x, y, z, Material.BEDROCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = maxHeight - 19; y <= maxHeight; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunkData.setBlock(x, y, z, Material.BEDROCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight(BiomeGenerator biomeGenerator, int x, int z, HeightType type) {
|
||||
return 230;
|
||||
public void generateBedrock(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull ChunkGenerator.ChunkData chunkData) {
|
||||
super.generateBedrock(worldInfo, random, x, z, chunkData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateSurface() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateBedrock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateCaves() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateDecorations() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateMobs() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateStructures() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,11 @@
|
||||
package io.github.officereso;
|
||||
|
||||
import nl.rutgerkok.worldgeneratorapi.WorldGeneratorApi;
|
||||
import nl.rutgerkok.worldgeneratorapi.WorldRef;
|
||||
import nl.rutgerkok.worldgeneratorapi.decoration.BaseDecorationType;
|
||||
import nl.rutgerkok.worldgeneratorapi.decoration.DecorationType;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
@Override
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
return WorldGeneratorApi
|
||||
.getInstance(this, 0, 5)
|
||||
.createCustomGenerator(WorldRef.ofName(worldName), generator -> {
|
||||
generator.setBaseTerrainGenerator(new Generate());
|
||||
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.UNDERGROUND_DECORATION);
|
||||
generator.getWorldDecorator().withoutDefaultBaseDecorations(BaseDecorationType.SURFACE);
|
||||
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.SURFACE_STRUCTURES);
|
||||
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.VEGETAL_DECORATION);
|
||||
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.TOP_LAYER_MODIFICATION);
|
||||
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.UNDERGROUND_ORES);
|
||||
generator.getWorldDecorator().withCustomDecoration(DecorationType.UNDERGROUND_ORES, new DecorationGenerator());
|
||||
});
|
||||
return new Generate();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
load: startup
|
||||
load: STARTUP
|
||||
name: stoned-in
|
||||
version: 1.0
|
||||
api-version: "1.16"
|
||||
main: io.github.officereso.Main
|
||||
depend: [WorldGeneratorApi]
|
||||
main: io.github.officereso.Main
|
12
stoned-in.iml
Normal file
12
stoned-in.iml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
Loading…
x
Reference in New Issue
Block a user