mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 00:17:15 +00:00
Push
This commit is contained in:
parent
37e4fd55d3
commit
da464f99d4
32
.classpath
Normal file
32
.classpath
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target/
|
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Iris</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
4
.settings/org.eclipse.core.resources.prefs
Normal file
4
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
8
.settings/org.eclipse.jdt.core.prefs
Normal file
8
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
109
dependency-reduced-pom.xml
Normal file
109
dependency-reduced-pom.xml
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>bytecode.ninja</groupId>
|
||||||
|
<artifactId>Iris</artifactId>
|
||||||
|
<name>Iris</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
<include>**/*.yml</include>
|
||||||
|
<include>**/*.txt</include>
|
||||||
|
<include>**/*.properties</include>
|
||||||
|
<include>**/*.html</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>true</minimizeJar>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>runbatchfile</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<skip>${skip.copy}</skip>
|
||||||
|
<executable>${project.basedir}/scripts/copy.bat</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>${project.basedir}\target\${project.name}-${project.version}.jar</argument>
|
||||||
|
<argument>${development.location}</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>pub</id>
|
||||||
|
<url>http://nexus.mpm.care/content/repositories/pub</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<development.location>${user.home}\Documents\development\server\plugins\${project.name}.jar</development.location>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
</project>
|
||||||
|
|
93
pom.xml
Normal file
93
pom.xml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>bytecode.ninja</groupId>
|
||||||
|
<artifactId>Iris</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<name>Iris</name>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<development.location>${user.home}\Documents\development\server\plugins\${project.name}.jar</development.location>
|
||||||
|
</properties>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
<include>**/*.yml</include>
|
||||||
|
<include>**/*.txt</include>
|
||||||
|
<include>**/*.properties</include>
|
||||||
|
<include>**/*.html</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>true</minimizeJar>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>runbatchfile</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<skip>${skip.copy}</skip>
|
||||||
|
<executable>${project.basedir}/scripts/copy.bat</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>${project.basedir}\target\${project.name}-${project.version}.jar</argument>
|
||||||
|
<argument>${development.location}</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>pub</id>
|
||||||
|
<url>http://nexus.mpm.care/content/repositories/pub</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ninja.bytecode</groupId>
|
||||||
|
<artifactId>Shuriken</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
3
scripts/copy.bat
Normal file
3
scripts/copy.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@Echo off
|
||||||
|
echo Apply Script: COPY
|
||||||
|
echo F|xcopy /y /s /f /q "%1" "%2"
|
22
src/main/java/ninja/bytecode/iris/Iris.java
Normal file
22
src/main/java/ninja/bytecode/iris/Iris.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
||||||
|
|
||||||
|
public class Iris extends JavaPlugin
|
||||||
|
{
|
||||||
|
public static TaskExecutor executor;
|
||||||
|
|
||||||
|
public void onEnable()
|
||||||
|
{
|
||||||
|
executor = new TaskExecutor(-1, Thread.MIN_PRIORITY, "Iris Generator");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
|
||||||
|
{
|
||||||
|
return new IrisGenerator();
|
||||||
|
}
|
||||||
|
}
|
178
src/main/java/ninja/bytecode/iris/IrisGenerator.java
Normal file
178
src/main/java/ninja/bytecode/iris/IrisGenerator.java
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import ninja.bytecode.shuriken.math.CNG;
|
||||||
|
import ninja.bytecode.shuriken.math.M;
|
||||||
|
import ninja.bytecode.shuriken.math.RNG;
|
||||||
|
|
||||||
|
public class IrisGenerator extends ParallelChunkGenerator
|
||||||
|
{
|
||||||
|
private static final MB water = new MB(Material.STATIONARY_WATER);
|
||||||
|
private static final MB bedrock = new MB(Material.BEDROCK);
|
||||||
|
private static final MB air = new MB(Material.AIR);
|
||||||
|
private static final MB grass = new MB(Material.GRASS);
|
||||||
|
private static final MB[] earth = {new MB(Material.DIRT), new MB(Material.DIRT, 1),
|
||||||
|
};
|
||||||
|
private static final MB[] sand = {new MB(Material.SAND), new MB(Material.SAND), new MB(Material.SAND, 1),
|
||||||
|
};
|
||||||
|
private static final MB[] sandygrass = {new MB(Material.GRASS), new MB(Material.SAND, 1),
|
||||||
|
};
|
||||||
|
private static final MB[] rock = {new MB(Material.STONE), new MB(Material.STONE, 5), new MB(Material.COBBLESTONE),
|
||||||
|
};
|
||||||
|
private double[][][] scatterCache;
|
||||||
|
private CNG gen;
|
||||||
|
private CNG fracture;
|
||||||
|
private CNG basegen;
|
||||||
|
private CNG faultline;
|
||||||
|
private RNG rng;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInit(World world, Random random)
|
||||||
|
{
|
||||||
|
//@builder
|
||||||
|
rng = new RNG(world.getSeed());
|
||||||
|
CNG scatter = new CNG(rng.nextRNG(), 1, 1)
|
||||||
|
.scale(10);
|
||||||
|
basegen = new CNG(rng.nextRNG(), 0.46, 3)
|
||||||
|
.scale(0.00295)
|
||||||
|
.fractureWith(new CNG(rng.nextRNG(), 1, 2)
|
||||||
|
.scale(0.025), 70);
|
||||||
|
gen = new CNG(rng.nextRNG(), 0.19D, 4)
|
||||||
|
.scale(0.012)
|
||||||
|
.amp(0.5)
|
||||||
|
.freq(1.1)
|
||||||
|
.fractureWith(new CNG(rng.nextRNG(), 1, 2)
|
||||||
|
.scale(0.018)
|
||||||
|
.fractureWith(new CNG(rng.nextRNG(), 1, 1)
|
||||||
|
.scale(0.15), 24), 44);
|
||||||
|
fracture = new CNG(rng.nextRNG(), 0.6D, 4)
|
||||||
|
.scale(0.118);
|
||||||
|
faultline = new CNG(rng.nextRNG(), 1D, 1)
|
||||||
|
.scale(0.005)
|
||||||
|
.child(new CNG(rng.nextRNG(), 1D, 1)
|
||||||
|
.scale(0.012))
|
||||||
|
.injectWith(CNG.MULTIPLY)
|
||||||
|
.fractureWith(new CNG(rng.nextRNG(), 1, 1)
|
||||||
|
.scale(0.07), 200);
|
||||||
|
//@done
|
||||||
|
|
||||||
|
scatterCache = new double[16][][];
|
||||||
|
|
||||||
|
for(int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
scatterCache[i] = new double[16][];
|
||||||
|
|
||||||
|
for(int j = 0; j < 16; j++)
|
||||||
|
{
|
||||||
|
scatterCache[i][j] = new double[16];
|
||||||
|
|
||||||
|
for(int k = 0; k < 16; k++)
|
||||||
|
{
|
||||||
|
scatterCache[i][j][k] = scatter.noise(i, j, k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void genColumn(int wx, int wz, int x, int z)
|
||||||
|
{
|
||||||
|
int height = getHeight(wx, wz);
|
||||||
|
MB mb = rock[0];
|
||||||
|
|
||||||
|
for(int i = 0; i < Math.max(height, 63); i++)
|
||||||
|
{
|
||||||
|
int surfdepth = i < height ? height - i : 0;
|
||||||
|
double scatter = scatterCache[x][z][i % 16];
|
||||||
|
|
||||||
|
if(i == 0)
|
||||||
|
{
|
||||||
|
mb = bedrock;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(scatter > 0.4 && i == 2)
|
||||||
|
{
|
||||||
|
mb = bedrock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scatter > 0.6 && i == 1)
|
||||||
|
{
|
||||||
|
mb = bedrock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i > height)
|
||||||
|
{
|
||||||
|
mb = water;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(i == height)
|
||||||
|
{
|
||||||
|
mb = pick(sand, scatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(i == height + 1 + scatter)
|
||||||
|
{
|
||||||
|
mb = pick(sandygrass, scatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(i == height - 1)
|
||||||
|
{
|
||||||
|
mb = grass;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(i > height - ((scatter * 2) + 1))
|
||||||
|
{
|
||||||
|
mb = pick(earth, scatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mb = pick(rock, scatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mb.data < 0)
|
||||||
|
{
|
||||||
|
mb = new MB(mb.material, pick(Math.abs(mb.data), scatter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setBlock(x, i, z, mb.material, mb.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight(double dx, double dz)
|
||||||
|
{
|
||||||
|
double fnoise = fracture.noise(dx, dz);
|
||||||
|
double fault = faultline.noise(dx, dz);
|
||||||
|
dx += (fnoise * 12);
|
||||||
|
dz -= (fnoise * 12);
|
||||||
|
double base = basegen.noise(dx, dz);
|
||||||
|
double noise = base + gen.noise(dx, dz);
|
||||||
|
double n = noise * 250;
|
||||||
|
n = n > 255 ? 255 : n;
|
||||||
|
n = n < 0 ? 0 : n;
|
||||||
|
|
||||||
|
if(n > 75 && fault > 0.35)
|
||||||
|
{
|
||||||
|
n += (fault * (n / 19.5));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int pick(int max, double noise)
|
||||||
|
{
|
||||||
|
return (int) (noise * max);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MB pick(MB[] array, double noise)
|
||||||
|
{
|
||||||
|
return array[pick(array.length, noise)];
|
||||||
|
}
|
||||||
|
}
|
20
src/main/java/ninja/bytecode/iris/MB.java
Normal file
20
src/main/java/ninja/bytecode/iris/MB.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
public class MB
|
||||||
|
{
|
||||||
|
public final Material material;
|
||||||
|
public final byte data;
|
||||||
|
|
||||||
|
public MB(Material material, int data)
|
||||||
|
{
|
||||||
|
this.material = material;
|
||||||
|
this.data = (byte) data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MB(Material material)
|
||||||
|
{
|
||||||
|
this(material, 0);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
|
import ninja.bytecode.shuriken.Shuriken;
|
||||||
|
import ninja.bytecode.shuriken.execution.ChronoLatch;
|
||||||
|
import ninja.bytecode.shuriken.execution.J;
|
||||||
|
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
||||||
|
import ninja.bytecode.shuriken.format.F;
|
||||||
|
|
||||||
|
public abstract class ParallelChunkGenerator extends ChunkGenerator
|
||||||
|
{
|
||||||
|
private int i;
|
||||||
|
private int j;
|
||||||
|
private int wx;
|
||||||
|
private int wz;
|
||||||
|
private ChunkData data;
|
||||||
|
private TaskGroup tg;
|
||||||
|
private boolean ready = false;
|
||||||
|
private ChronoLatch cl = new ChronoLatch(5000);
|
||||||
|
|
||||||
|
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||||
|
{
|
||||||
|
Shuriken.profiler.start("chunkgen-" + world.getName());
|
||||||
|
|
||||||
|
if(!ready)
|
||||||
|
{
|
||||||
|
onInit(world, random);
|
||||||
|
ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = createChunkData(world);
|
||||||
|
tg = Iris.executor.startWork();
|
||||||
|
|
||||||
|
for(i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
wx = (x * 16) + i;
|
||||||
|
|
||||||
|
for(j = 0; j < 16; j++)
|
||||||
|
{
|
||||||
|
wz = (z * 16) + j;
|
||||||
|
int a = wx;
|
||||||
|
int b = wz;
|
||||||
|
int c = i;
|
||||||
|
int d = j;
|
||||||
|
tg.queue(() -> genColumn(a, b, c, d));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tg.execute();
|
||||||
|
Shuriken.profiler.stop("chunkgen-" + world.getName());
|
||||||
|
|
||||||
|
if(cl.flip())
|
||||||
|
{
|
||||||
|
J.a(() -> System.out.print("Gen: " + F.duration(Shuriken.profiler.getResult("chunkgen-" + world.getName()).getAverage(), 2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onInit(World world, Random random);
|
||||||
|
|
||||||
|
public abstract void genColumn(int wx, int wz, int x, int z);
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void setBlock(int x, int y, int z, Material b)
|
||||||
|
{
|
||||||
|
setBlock(x, y, z, b.getId(), (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void setBlock(int x, int y, int z, Material b, byte d)
|
||||||
|
{
|
||||||
|
setBlock(x, y, z, b.getId(), d);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setBlock(int x, int y, int z, int b)
|
||||||
|
{
|
||||||
|
setBlock(x, y, z, b, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void setBlock(int x, int y, int z, int b, byte d)
|
||||||
|
{
|
||||||
|
data.setBlock(x, y, z, b, d);
|
||||||
|
}
|
||||||
|
}
|
3
src/main/resources/plugin.yml
Normal file
3
src/main/resources/plugin.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name: ${project.name}
|
||||||
|
version: ${project.version}
|
||||||
|
main: ninja.bytecode.iris.Iris
|
Loading…
x
Reference in New Issue
Block a user