Idea Nitpick ""Optimizations""

This commit is contained in:
Daniel Mills 2020-10-13 03:35:40 -04:00
parent bd3e9d01ec
commit 80b1374a61
40 changed files with 447 additions and 148 deletions

16
.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Iris" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="Iris" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

7
.idea/encodings.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

40
.idea/jarRepositories.xml generated Normal file
View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="spigot-repo" />
<option name="name" value="spigot-repo" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="WorldEdit" />
<option name="name" value="WorldEdit" />
<option name="url" value="https://maven.enginehub.org/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="bcn" />
<option name="name" value="bcn" />
<option name="url" value="http://bytecode.ninja/repository/bcn/" />
</remote-repository>
<remote-repository>
<option name="id" value="CodeMC" />
<option name="name" value="CodeMC" />
<option name="url" value="https://repo.codemc.org/repository/maven-public" />
</remote-repository>
</component>
</project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.code.gson:gson:2.8.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.5/gson-2.8.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/worldedit/worldedit-bukkit/7.2.0-SNAPSHOT/worldedit-bukkit-7.2.0-20201010.072135-175.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/worldedit/worldedit-bukkit/7.2.0-SNAPSHOT/worldedit-bukkit-7.2.0-20201010.072135-175-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/worldedit/worldedit-bukkit/7.2.0-SNAPSHOT/worldedit-bukkit-7.2.0-20201010.072135-175-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.bstats:bstats-bukkit:1.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/bstats/bstats-bukkit/1.7/bstats-bukkit-1.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/bstats/bstats-bukkit/1.7/bstats-bukkit-1.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/bstats/bstats-bukkit/1.7/bstats-bukkit-1.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.bukkit.craftbukkit:cb-1.14.4:1.14.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.14.4/1.14.4/cb-1.14.4-1.14.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.14.4/1.14.4/cb-1.14.4-1.14.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.14.4/1.14.4/cb-1.14.4-1.14.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.bukkit.craftbukkit:cb-1.15.1:1.15.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.15.1/1.15.1/cb-1.15.1-1.15.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.15.1/1.15.1/cb-1.15.1-1.15.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.15.1/1.15.1/cb-1.15.1-1.15.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.bukkit.craftbukkit:cb-1.16.1:1.16.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.16.1/1.16.1/cb-1.16.1-1.16.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.16.1/1.16.1/cb-1.16.1-1.16.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.16.1/1.16.1/cb-1.16.1-1.16.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.bukkit.craftbukkit:cb-1.16.2:1.16.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.16.2/1.16.2/cb-1.16.2-1.16.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.16.2/1.16.2/cb-1.16.2-1.16.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/craftbukkit/cb-1.16.2/1.16.2/cb-1.16.2-1.16.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.projectlombok:lombok:1.18.10">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.10/lombok-1.18.10.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.10/lombok-1.18.10-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.10/lombok-1.18.10-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.1-R0.1-SNAPSHOT/spigot-api-1.16.1-R0.1-20200811.074017-132.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.1-R0.1-SNAPSHOT/spigot-api-1.16.1-R0.1-20200811.074017-132-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.1-R0.1-SNAPSHOT/spigot-api-1.16.1-R0.1-20200811.074017-132-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/dependency-reduced-pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Iris.iml" filepath="$PROJECT_DIR$/Iris.iml" />
</modules>
</component>
</project>

59
.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="0f45a53f-092b-4cfe-9018-d283cf70a5b9" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.1\plugins\maven\lib\maven3" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectId" id="1ioTMpcuV3rRqjlmmq6B2NOTY0r" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="dart.analysis.tool.window.visible" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="0f45a53f-092b-4cfe-9018-d283cf70a5b9" name="Default Changelist" comment="" />
<created>1602572902189</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1602572902189</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="624" y="211" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1602574075211">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state x="624" y="211" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/1920.0.1920.1050/-1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1602574075211" />
<state x="312" y="0" key="SettingsEditor" timestamp="1602573024172">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state x="312" y="0" key="SettingsEditor/1920.0.1920.1050/-1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1602573024172" />
<state x="250" y="213" key="caller.chooser.dialog" timestamp="1602574007219">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state x="250" y="213" key="caller.chooser.dialog/1920.0.1920.1050/-1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1602574007219" />
</component>
</project>

39
Iris.iml Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<conelement value="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" />
<src_description expected_position="2">
<src_folder value="file://$MODULE_DIR$/src/main/java" expected_position="0" />
<src_folder value="file://$MODULE_DIR$/src/main/resources" expected_position="1" />
<src_folder value="file://$MODULE_DIR$/src/test/java" expected_position="4" />
</src_description>
</component>
<component name="MavenCustomPomFilePath">
<option name="mavenPomFileUrl" value="file://$MODULE_DIR$/dependency-reduced-pom.xml" />
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$/src/main/java">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
</content>
<content url="file://$MODULE_DIR$/src/main/resources">
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
</content>
<content url="file://$MODULE_DIR$/src/test/java">
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="JavaSE-1.8" jdkType="JavaSDK" />
<orderEntry type="library" name="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" level="application" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit.craftbukkit:cb-1.16.2:1.16.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit.craftbukkit:cb-1.16.1:1.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit.craftbukkit:cb-1.15.1:1.15.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit.craftbukkit:cb-1.14.4:1.14.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.5" level="project" />
</component>
</module>

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>bytecode.ninja</groupId> <groupId>bytecode.ninja</groupId>
<artifactId>Iris</artifactId> <artifactId>Iris</artifactId>
<version>1.0.9</version> <version>1.0.12</version>
<name>Iris</name> <name>Iris</name>
<properties> <properties>
<skip.copy>false</skip.copy> <skip.copy>false</skip.copy>

View File

@ -76,7 +76,7 @@ public class Iris extends MortarPlugin
public Iris() public Iris()
{ {
IO.delete(new File("iris")); IO.delete(new File("iris"));
lowMemoryMode = Runtime.getRuntime().maxMemory() < 4 * 1000 * 1000 * 1000; lowMemoryMode = Runtime.getRuntime().maxMemory() < 4000000000L; // 4 * 1000 * 1000 * 1000 // 4gb
} }
private static String findNMSTag() private static String findNMSTag()
@ -107,21 +107,21 @@ public class Iris extends MortarPlugin
private static boolean doesSupport3DBiomes() private static boolean doesSupport3DBiomes()
{ {
int v = Integer.valueOf(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]); int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
return v >= 15; return v >= 15;
} }
private static boolean doesSupportCustomModels() private static boolean doesSupportCustomModels()
{ {
int v = Integer.valueOf(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]); int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
return v >= 14; return v >= 14;
} }
private static boolean doesSupportAwareness() private static boolean doesSupportAwareness()
{ {
int v = Integer.valueOf(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]); int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
return v >= 15; return v >= 15;
} }
@ -158,9 +158,9 @@ public class Iris extends MortarPlugin
linkMultiverseCore = new MultiverseCoreLink(); linkMultiverseCore = new MultiverseCoreLink();
edit = new EditManager(); edit = new EditManager();
J.a(() -> IO.delete(getTemp())); J.a(() -> IO.delete(getTemp()));
J.a(() -> bstats()); J.a(this::bstats);
J.s(this::splash, 20); J.s(this::splash, 20);
J.sr(() -> tickQueue(syncJobs), 0); J.sr(this::tickQueue, 0);
super.onEnable(); super.onEnable();
} }
@ -172,22 +172,22 @@ public class Iris extends MortarPlugin
} }
} }
private void tickQueue(Queue<Runnable> q) private void tickQueue()
{ {
synchronized(q) synchronized(Iris.syncJobs)
{ {
if(!q.hasNext()) if(!Iris.syncJobs.hasNext())
{ {
return; return;
} }
long ms = M.ms(); long ms = M.ms();
while(q.hasNext() && M.ms() - ms < 25) while(Iris.syncJobs.hasNext() && M.ms() - ms < 25)
{ {
try try
{ {
q.next().run(); Iris.syncJobs.next().run();
} }
catch(Throwable e) catch(Throwable e)
@ -271,7 +271,7 @@ public class Iris extends MortarPlugin
{ {
try(BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(f)) try(BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(f))
{ {
byte dataBuffer[] = new byte[1024]; byte[] dataBuffer = new byte[1024];
int bytesRead; int bytesRead;
while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1)
{ {
@ -280,7 +280,7 @@ public class Iris extends MortarPlugin
} }
} }
catch(IOException e) catch(IOException ignored)
{ {
} }
@ -296,7 +296,7 @@ public class Iris extends MortarPlugin
try(BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(f)) try(BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(f))
{ {
byte dataBuffer[] = new byte[1024]; byte[] dataBuffer = new byte[1024];
int bytesRead; int bytesRead;
while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1)
{ {
@ -304,7 +304,7 @@ public class Iris extends MortarPlugin
} }
} }
catch(IOException e) catch(IOException ignored)
{ {
} }
@ -314,7 +314,7 @@ public class Iris extends MortarPlugin
return IO.readAll(f); return IO.readAll(f);
} }
catch(IOException e) catch(IOException ignored)
{ {
} }
@ -329,7 +329,7 @@ public class Iris extends MortarPlugin
try(BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(f)) try(BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(f))
{ {
byte dataBuffer[] = new byte[1024]; byte[] dataBuffer = new byte[1024];
int bytesRead; int bytesRead;
while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1)
{ {
@ -337,7 +337,7 @@ public class Iris extends MortarPlugin
} }
} }
catch(IOException e) catch(IOException ignored)
{ {
} }
@ -395,7 +395,7 @@ public class Iris extends MortarPlugin
splash[i] += info[i]; splash[i] += info[i];
} }
Iris.info("\n\n " + new KList<String>(splash).toString("\n") + "\n"); Iris.info("\n\n " + new KList<>(splash).toString("\n") + "\n");
if(lowMemoryMode) if(lowMemoryMode)
{ {

View File

@ -146,7 +146,7 @@ public class IrisSettings
Iris.info("Updated Configuration Files"); Iris.info("Updated Configuration Files");
} }
catch(Throwable e) catch(Throwable ignored)
{ {
} }
@ -157,6 +157,7 @@ public class IrisSettings
catch(JSONException | IOException e) catch(JSONException | IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
//noinspection ResultOfMethodCallIgnored
s.delete(); s.delete();
} }
} }

View File

@ -202,6 +202,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
if(getNoLoot().size() > 1024) if(getNoLoot().size() > 1024)
{ {
//noinspection ListRemoveInLoop
for(int i = 0; i < 64; i++) for(int i = 0; i < 64; i++)
{ {
getNoLoot().remove(0); getNoLoot().remove(0);
@ -358,7 +359,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
onClose(); onClose();
} }
protected void generateFailure(Random no, int x, int z, TerrainChunk chunk) protected void generateFailure(TerrainChunk chunk)
{ {
for(int i = 0; i < 16; i++) for(int i = 0; i < 16; i++)
{ {
@ -391,7 +392,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
if(failing) if(failing)
{ {
generateFailure(no, x, z, terrain); generateFailure(terrain);
return; return;
} }
@ -414,7 +415,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
} }
setHotloadable(true); setHotloadable(true);
generateFailure(no, x, z, terrain); generateFailure(terrain);
} }
private void doCheckHotload() private void doCheckHotload()
@ -432,11 +433,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
if(getPushLatch().flip()) if(getPushLatch().flip())
{ {
Iris.hotloader.check((IrisContext) this); Iris.hotloader.check((IrisContext) this);
IrisContext.pushContext((IrisContext) this);
if(this instanceof IrisContext)
{
IrisContext.pushContext((IrisContext) this);
}
} }
} }

View File

@ -93,7 +93,7 @@ public abstract class DimensionalTerrainProvider extends ContextualTerrainProvid
getData().preferFolder(getDimension().getLoadFile().getParentFile().getParentFile().getName()); getData().preferFolder(getDimension().getLoadFile().getParentFile().getParentFile().getName());
} }
catch(Throwable e) catch(Throwable ignored)
{ {
} }
@ -176,11 +176,11 @@ public abstract class DimensionalTerrainProvider extends ContextualTerrainProvid
public double getZoomed(double modified) public double getZoomed(double modified)
{ {
return (double) (modified) / getDimension().getTerrainZoom(); return modified / getDimension().getTerrainZoom();
} }
public double getUnzoomed(double modified) public double getUnzoomed(double modified)
{ {
return (double) (modified) * getDimension().getTerrainZoom(); return modified * getDimension().getTerrainZoom();
} }
} }

View File

@ -257,7 +257,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
public Renderer createRenderer() public Renderer createRenderer()
{ {
return (x, z) -> render(x, z); return this::render;
} }
public Color render(double x, double z) public Color render(double x, double z)
@ -281,9 +281,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
float s = 0.25f + shift + sat; float s = 0.25f + shift + sat;
float b = (float) (Math.max(0, Math.min(height + getFluidHeight(), 255)) / 255); float b = (float) (Math.max(0, Math.min(height + getFluidHeight(), 255)) / 255);
Color c = Color.getHSBColor(h, s, b); return Color.getHSBColor(h, s, b);
return c;
} }
@ -323,7 +321,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
IrisBiome bio = sampleTrueBiome(x, z); IrisBiome bio = sampleTrueBiome(x, z);
IrisBiome cbio = y < getFluidHeight() ? sampleTrueBiome(x, y, z) : null; IrisBiome cbio = y < getFluidHeight() ? sampleTrueBiome(x, y, z) : null;
if(cbio != null && bio.equals(cbio)) if(bio.equals(cbio))
{ {
cbio = null; cbio = null;
} }
@ -337,7 +335,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
KList<ItemStack> drops = new KList<>(); KList<ItemStack> drops = new KList<>();
boolean skipParents = false; boolean skipParents = false;
if(!skipParents && cbio != null) if(cbio != null)
{ {
for(IrisBlockDrops i : cbio.getBlockDrops()) for(IrisBlockDrops i : cbio.getBlockDrops())
{ {

View File

@ -242,7 +242,7 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
p.end(); p.end();
getMetrics().getParallax().put(p.getMilliseconds()); getMetrics().getParallax().put(p.getMilliseconds());
super.onPostParallaxPostGenerate(random, x, z, terrain, height, biomeMap, map); super.onPostParallaxPostGenerate(random, x, z, terrain, height, biomeMap, map);
getParallaxMap().clean(getTicks()); getParallaxMap().clean();
getData().getObjectLoader().clean(); getData().getObjectLoader().clean();
} }

View File

@ -34,7 +34,6 @@ public abstract class ParallelTerrainProvider extends DimensionalTerrainProvider
setThreads(tc); setThreads(tc);
GroupedExecutor e = getAccelerant(); GroupedExecutor e = getAccelerant();
setAccelerant(new GroupedExecutor(threads, Thread.MAX_PRIORITY, "Iris Generator - " + getTarget().getName())); setAccelerant(new GroupedExecutor(threads, Thread.MAX_PRIORITY, "Iris Generator - " + getTarget().getName()));
;
Iris.executors.add(getAccelerant()); Iris.executors.add(getAccelerant());
if(e != null) if(e != null)

View File

@ -90,7 +90,7 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
getPostLock().lock(); getPostLock().lock();
BlockData d = currentData.getBlockData(x & 15, y, z & 15); BlockData d = currentData.getBlockData(x & 15, y, z & 15);
getPostLock().unlock(); getPostLock().unlock();
return d == null ? AIR : d; return d;
} }
return sampleSliver(x, z).get(y); return sampleSliver(x, z).get(y);

View File

@ -54,13 +54,17 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
private RNG rockRandom; private RNG rockRandom;
private IrisLock regionLock; private IrisLock regionLock;
private KMap<String, IrisGenerator> generators; private KMap<String, IrisGenerator> generators;
private KList<IrisGenerator> generatorList;
private CNG masterFracture; private CNG masterFracture;
private int generatorSize;
private ChronoLatch cwarn = new ChronoLatch(1000); private ChronoLatch cwarn = new ChronoLatch(1000);
public TopographicTerrainProvider(TerrainTarget t, String dimensionName, int threads) public TopographicTerrainProvider(TerrainTarget t, String dimensionName, int threads)
{ {
super(t, dimensionName, threads); super(t, dimensionName, threads);
setGeneratorSize(0);
setGenerators(new KMap<>()); setGenerators(new KMap<>());
setGeneratorList(new KList<>());
setRegionLock(new IrisLock("BiomeChunkGenerator")); setRegionLock(new IrisLock("BiomeChunkGenerator"));
} }
@ -132,7 +136,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
int depth = 0; int depth = 0;
double noise = getTerrainHeight(rx, rz); double noise = getTerrainHeight(rx, rz);
int height = (int) Math.round(noise); int height = (int) Math.round(noise);
boolean carvable = getGlCarve().couldCarveBelow(rx, height, rz); boolean carvable = getGlCarve().couldCarveBelow(height);
IrisRegion region = sampleRegion(rx, rz); IrisRegion region = sampleRegion(rx, rz);
IrisBiome biome = sampleTrueBiome(rx, rz); IrisBiome biome = sampleTrueBiome(rx, rz);
IrisBiome carveBiome = null; IrisBiome carveBiome = null;
@ -264,7 +268,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
// Decorate underwater surface // Decorate underwater surface
if(!cavernSurface && (k == height && B.isSolid(block.getMaterial()) && k < fluidHeight)) if(!cavernSurface && (k == height && B.isSolid(block.getMaterial()) && k < fluidHeight))
{ {
decorateUnderwater(crand, biome, sliver, wx, k, wz, rx, rz, block); decorateUnderwater(crand, biome, sliver, k, rx, rz);
} }
// Decorate Cavern surfaces, but not the true surface // Decorate Cavern surfaces, but not the true surface
@ -275,7 +279,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
carveBiome = biome.getRealCarvingBiome(getData()); carveBiome = biome.getRealCarvingBiome(getData());
} }
decorateLand(crand, carveBiome, sliver, wx, k, wz, rx, rz, block); decorateLand(crand, carveBiome, sliver, k, rx, rz, block);
} }
} }
@ -323,7 +327,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
if(blockc != null && !sliver.isSolid(i.getFloor() + 1)) if(blockc != null && !sliver.isSolid(i.getFloor() + 1))
{ {
decorateCave(crand, caveBiome, sliver, wx, i.getFloor(), wz, rx, rz, blockc); decorateCave(crand, caveBiome, sliver, i.getFloor(), rx, rz, blockc);
} }
} }
} }
@ -333,7 +337,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
// Decorate True Surface // Decorate True Surface
if(block.getMaterial().isSolid()) if(block.getMaterial().isSolid())
{ {
decorateLand(crand, biome, sliver, wx, Math.max(height, fluidHeight), wz, rx, rz, block); decorateLand(crand, biome, sliver, Math.max(height, fluidHeight), rx, rz, block);
} }
} }
@ -348,7 +352,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
} }
} }
private void decorateLand(RNG rng, IrisBiome biome, AtomicSliver sliver, double wx, int k, double wz, int rx, int rz, BlockData block) private void decorateLand(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, BlockData block)
{ {
if(!getDimension().isDecorate()) if(!getDimension().isDecorate())
{ {
@ -364,7 +368,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
continue; continue;
} }
BlockData d = i.getBlockData(biome, rng.nextParallelRNG((int) (38888 + biome.getRarity() + biome.getName().length() + j++)), rx, rz, getData()); BlockData d = i.getBlockData(biome, rng.nextParallelRNG(38888 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
if(d != null) if(d != null)
{ {
@ -422,7 +426,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
} }
} }
private void decorateCave(RNG rng, IrisBiome biome, AtomicSliver sliver, double wx, int k, double wz, int rx, int rz, BlockData block) private void decorateCave(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, BlockData block)
{ {
if(!getDimension().isDecorate()) if(!getDimension().isDecorate())
{ {
@ -488,7 +492,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
} }
} }
private void decorateUnderwater(RNG random, IrisBiome biome, AtomicSliver sliver, double wx, int y, double wz, int rx, int rz, BlockData block) private void decorateUnderwater(RNG random, IrisBiome biome, AtomicSliver sliver, int y, int rx, int rz)
{ {
if(!getDimension().isDecorate()) if(!getDimension().isDecorate())
{ {
@ -580,9 +584,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
public double getNoiseHeight(int rx, int rz) public double getNoiseHeight(int rx, int rz)
{ {
double h = getBiomeHeight(rx, rz); return getBiomeHeight(rx, rz);
return h;
} }
public IrisBiome sampleTrueBiomeBase(int x, int z) public IrisBiome sampleTrueBiomeBase(int x, int z)
@ -728,7 +730,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
buildGenLayers(getMasterRandom()); buildGenLayers(getMasterRandom());
} }
public void registerGenerator(IrisGenerator g, IrisDimension dim) public void registerGenerator(IrisGenerator g)
{ {
KMap<String, IrisGenerator> generators = this.generators; KMap<String, IrisGenerator> generators = this.generators;
@ -739,6 +741,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
return; return;
} }
generatorList.add(g);
getRegionLock().unlock(); getRegionLock().unlock();
generators.put(g.getLoadKey(), g); generators.put(g.getLoadKey(), g);
} }
@ -750,13 +753,11 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
protected double getRawBiomeHeight(double rrx, double rrz) protected double getRawBiomeHeight(double rrx, double rrz)
{ {
double rx = rrx;
double rz = rrz;
double h = 0; double h = 0;
for(IrisGenerator i : getGenerators().values()) for(int j = 0; j < generatorSize; j++)
{ {
h += interpolateGenerator(rx, rz, i); h += interpolateGenerator(rrx, rrz, generatorList.get(j));
} }
return h; return h;
@ -782,8 +783,9 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
{ {
IrisBiome b = sampleBiome((int) xx, (int) zz); IrisBiome b = sampleBiome((int) xx, (int) zz);
for(IrisBiomeGeneratorLink i : b.getGenerators()) for(int j = 0; j < b.getGenerators().size(); j++)
{ {
IrisBiomeGeneratorLink i = b.getGenerators().get(j);
if(i.getGenerator().equals(gen.getLoadKey())) if(i.getGenerator().equals(gen.getLoadKey()))
{ {
return i.getMax(); return i.getMax();
@ -805,8 +807,9 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
{ {
IrisBiome b = sampleBiome((int) xx, (int) zz); IrisBiome b = sampleBiome((int) xx, (int) zz);
for(IrisBiomeGeneratorLink i : b.getGenerators()) for(int j = 0; j < b.getGenerators().size(); j++)
{ {
IrisBiomeGeneratorLink i = b.getGenerators().get(j);
if(i.getGenerator().equals(gen.getLoadKey())) if(i.getGenerator().equals(gen.getLoadKey()))
{ {
return i.getMin(); return i.getMin();
@ -828,8 +831,10 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
protected void loadGenerators() protected void loadGenerators()
{ {
generatorList.clear();
generators.clear(); generators.clear();
loadGenerators(getDimension()); loadGenerators(getDimension());
generatorSize = generatorList.size();
} }
protected void loadGenerators(IrisDimension dim) protected void loadGenerators(IrisDimension dim)
@ -865,7 +870,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
{ {
touch.add(next); touch.add(next);
IrisBiome biome = loadBiome(next); IrisBiome biome = loadBiome(next);
biome.getGenerators().forEach((i) -> registerGenerator(i.getCachedGenerator(this), dim)); biome.getGenerators().forEach((i) -> registerGenerator(i.getCachedGenerator(this)));
loadQueue.addAll(biome.getChildren()); loadQueue.addAll(biome.getChildren());
} }
} }
@ -908,9 +913,8 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
double wx = getModifiedX(x, z); double wx = getModifiedX(x, z);
double wz = getModifiedZ(x, z); double wz = getModifiedZ(x, z);
IrisRegion region = glBiome.getRegion(wx, wz); IrisRegion region = glBiome.getRegion(wx, wz);
IrisBiome res = glBiome.generateRegionData(wx, wz, x, z, region);
return res; return glBiome.generateRegionData(wx, wz, x, z, region);
} }
public IrisBiome sampleBiome(int x, int z) public IrisBiome sampleBiome(int x, int z)

View File

@ -42,8 +42,8 @@ public class AtomicRegionData
for(String i : tags.keySet()) for(String i : tags.keySet())
{ {
int x = Integer.valueOf(i.split("\\Q.\\E")[0]); int x = Integer.parseInt(i.split("\\Q.\\E")[0]);
int z = Integer.valueOf(i.split("\\Q.\\E")[1]); int z = Integer.parseInt(i.split("\\Q.\\E")[1]);
tag[(z << 5) | x] = tags.get(i); tag[(z << 5) | x] = tags.get(i);
} }
@ -104,8 +104,7 @@ public class AtomicRegionData
tag[(rz << 5) | rx] = new ByteArrayTag(rx + "." + rz, b); tag[(rz << 5) | rx] = new ByteArrayTag(rx + "." + rz, b);
} }
public AtomicSliverMap get(int rx, int rz) throws IOException public AtomicSliverMap get(int rx, int rz) {
{
AtomicSliverMap data = new AtomicSliverMap(); AtomicSliverMap data = new AtomicSliverMap();
if(!contains(rx, rz)) if(!contains(rx, rz))

View File

@ -53,7 +53,7 @@ public class AtomicSliver
public Material getTypeSafe(int h) public Material getTypeSafe(int h)
{ {
return get(h > 255 ? 255 : h < 0 ? 0 : h).getMaterial(); return get(h > 255 ? 255 : Math.max(h, 0)).getMaterial();
} }
public KList<Byte> getUpdatables() public KList<Byte> getUpdatables()
@ -125,7 +125,7 @@ public class AtomicSliver
setSilently(h, d); setSilently(h, d);
modified = true; modified = true;
lock.lock(); lock.lock();
highestBlock = h > highestBlock ? h : highestBlock; highestBlock = Math.max(h, highestBlock);
lock.unlock(); lock.unlock();
} }

View File

@ -74,7 +74,7 @@ public class AtomicSliverMap
return null; return null;
} }
return new IrisStructureResult(s.getTiles().get(Integer.valueOf(a[1])), s); return new IrisStructureResult(s.getTiles().get(Integer.parseInt(a[1])), s);
} }
public void write(OutputStream out) throws IOException public void write(OutputStream out) throws IOException

View File

@ -15,14 +15,14 @@ import com.volmit.iris.util.M;
public class AtomicWorldData public class AtomicWorldData
{ {
private TerrainTarget world; private final TerrainTarget world;
private KMap<ChunkPosition, AtomicSliverMap> loadedChunks; private final KMap<ChunkPosition, AtomicSliverMap> loadedChunks;
private KMap<ChunkPosition, AtomicRegionData> loadedSections; private final KMap<ChunkPosition, AtomicRegionData> loadedSections;
private KMap<ChunkPosition, Long> lastRegion; private final KMap<ChunkPosition, Long> lastRegion;
private KMap<ChunkPosition, Long> lastChunk; private final KMap<ChunkPosition, Long> lastChunk;
private KList<ChunkPosition> unloadRegions; private final KList<ChunkPosition> unloadRegions;
private KList<ChunkPosition> unloadChunks; private final KList<ChunkPosition> unloadChunks;
private IrisLock lock = new IrisLock("ULLock"); private final IrisLock lock = new IrisLock("ULLock");
private long last = M.ms(); private long last = M.ms();
public AtomicWorldData(TerrainTarget world) public AtomicWorldData(TerrainTarget world)
@ -34,6 +34,7 @@ public class AtomicWorldData
lastChunk = new KMap<>(); lastChunk = new KMap<>();
unloadRegions = new KList<>(); unloadRegions = new KList<>();
unloadChunks = new KList<>(); unloadChunks = new KList<>();
//noinspection ResultOfMethodCallIgnored
getSubregionFolder().mkdirs(); getSubregionFolder().mkdirs();
} }
@ -83,6 +84,7 @@ public class AtomicWorldData
public void deleteSection(int x, int z) throws IOException public void deleteSection(int x, int z) throws IOException
{ {
unloadSection(x, z, false); unloadSection(x, z, false);
//noinspection ResultOfMethodCallIgnored
getSubregionFile(x, z).delete(); getSubregionFile(x, z).delete();
} }
@ -263,7 +265,7 @@ public class AtomicWorldData
return loadedChunks; return loadedChunks;
} }
public void clean(int j) public void clean()
{ {
lock.lock(); lock.lock();
if(M.ms() - last < getUnloadBatchSpeed()) if(M.ms() - last < getUnloadBatchSpeed())

View File

@ -5,8 +5,8 @@ import com.volmit.iris.util.KMap;
public class MasterLock public class MasterLock
{ {
private KMap<String, IrisLock> locks; private final KMap<String, IrisLock> locks;
private IrisLock lock; private final IrisLock lock;
private boolean enabled; private boolean enabled;
public MasterLock() public MasterLock()

View File

@ -59,10 +59,7 @@ public class GenLayerBiome extends GenLayer
return null; return null;
} }
double x = bx; return regionGenerator.fitRarity(iris.getDimension().getAllRegions(iris), bx, bz);
double z = bz;
return regionGenerator.fitRarity(iris.getDimension().getAllRegions(iris), x, z);
} }
public IrisBiome generateData(double bx, double bz, int rawX, int rawZ) public IrisBiome generateData(double bx, double bz, int rawX, int rawZ)
@ -127,8 +124,6 @@ public class GenLayerBiome extends GenLayer
public InferredType getType(double bx, double bz, IrisRegion region) public InferredType getType(double bx, double bz, IrisRegion region)
{ {
double x = bx;
double z = bz;
double c = iris.getDimension().getLandChance(); double c = iris.getDimension().getLandChance();
InferredType bridge; InferredType bridge;
@ -142,14 +137,14 @@ public class GenLayerBiome extends GenLayer
bridge = InferredType.SEA; bridge = InferredType.SEA;
} }
bridge = bridgeGenerator.fitDouble(0, 1, x, z) < c ? InferredType.LAND : InferredType.SEA; bridge = bridgeGenerator.fitDouble(0, 1, bx, bz) < c ? InferredType.LAND : InferredType.SEA;
if(bridge.equals(InferredType.LAND) && region.isLake(lakeRandom, x, z)) if(bridge.equals(InferredType.LAND) && region.isLake(lakeRandom, bx, bz))
{ {
bridge = InferredType.LAKE; bridge = InferredType.LAKE;
} }
if(bridge.equals(InferredType.LAND) && region.isRiver(riverRandom, x, z)) if(bridge.equals(InferredType.LAND) && region.isRiver(riverRandom, bx, bz))
{ {
bridge = InferredType.RIVER; bridge = InferredType.RIVER;
} }

View File

@ -14,7 +14,7 @@ public class GenLayerCarve extends GenLayer
private static final KList<CarveResult> EMPTY_LIST = new KList<>(); private static final KList<CarveResult> EMPTY_LIST = new KList<>();
@Getter @Getter
private boolean couldCarve; private final boolean couldCarve;
@Getter @Getter
private int minimum; private int minimum;
@ -37,12 +37,12 @@ public class GenLayerCarve extends GenLayer
} }
} }
public boolean couldCarve(int x, int y, int z) public boolean couldCarve(int y)
{ {
return couldCarve && y >= minimum && y <= maximum; return couldCarve && y >= minimum && y <= maximum;
} }
public boolean couldCarveBelow(int x, int y, int z) public boolean couldCarveBelow(int y)
{ {
return couldCarve && y <= maximum; return couldCarve && y <= maximum;
} }
@ -89,7 +89,7 @@ public class GenLayerCarve extends GenLayer
public int getSurfaceCarve(int x, int y, int z) public int getSurfaceCarve(int x, int y, int z)
{ {
if(couldCarveBelow(x, y, z)) if(couldCarveBelow(y))
{ {
int h = y; int h = y;
@ -111,17 +111,14 @@ public class GenLayerCarve extends GenLayer
public boolean isCarved(int xc, int y, int zc) public boolean isCarved(int xc, int y, int zc)
{ {
if(!couldCarve(xc, y, zc)) if(!couldCarve(y))
{ {
return false; return false;
} }
double x = ((double) xc);
double z = ((double) zc);
for(IrisCarveLayer i : iris.getDimension().getCarveLayers()) for(IrisCarveLayer i : iris.getDimension().getCarveLayers())
{ {
if(i.isCarved(rng, x, y, z)) if(i.isCarved(rng, xc, y, zc))
{ {
return true; return true;
} }

View File

@ -5,7 +5,6 @@ import java.util.function.Function;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import com.volmit.iris.gen.IrisTerrainProvider;
import com.volmit.iris.gen.TopographicTerrainProvider; import com.volmit.iris.gen.TopographicTerrainProvider;
import com.volmit.iris.gen.atomics.AtomicSliver; import com.volmit.iris.gen.atomics.AtomicSliver;
import com.volmit.iris.noise.FastNoiseDouble; import com.volmit.iris.noise.FastNoiseDouble;
@ -25,7 +24,7 @@ public class GenLayerCave extends GenLayer
public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR"); public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
public static final BlockData AIR = B.getBlockData("AIR"); public static final BlockData AIR = B.getBlockData("AIR");
private static final KList<CaveResult> EMPTY = new KList<>(); private static final KList<CaveResult> EMPTY = new KList<>();
private FastNoiseDouble gg; private final FastNoiseDouble gg;
public GenLayerCave(TopographicTerrainProvider iris, RNG rng) public GenLayerCave(TopographicTerrainProvider iris, RNG rng)
{ {
@ -76,7 +75,7 @@ public class GenLayerCave extends GenLayer
return CAVE_AIR; return CAVE_AIR;
}; };
int surface = (int) Math.round(((IrisTerrainProvider) iris).getTerrainHeight((int) wxx, (int) wzz)); int surface = (int) Math.round(iris.getTerrainHeight((int) wxx, (int) wzz));
double wx = wxx + layer.getHorizontalSlope().get(rng, wxx, wzz); double wx = wxx + layer.getHorizontalSlope().get(rng, wxx, wzz);
double wz = wzz + layer.getHorizontalSlope().get(rng, -wzz, -wxx); double wz = wzz + layer.getHorizontalSlope().get(rng, -wzz, -wxx);
double baseWidth = (14 * scale); double baseWidth = (14 * scale);
@ -118,15 +117,15 @@ public class GenLayerCave extends GenLayer
if(data == null) if(data == null)
{ {
ceiling = pu > ceiling ? pu : ceiling; ceiling = Math.max(pu, ceiling);
floor = pu < floor ? pu : floor; floor = Math.min(pu, floor);
ceiling = pd > ceiling ? pd : ceiling; ceiling = Math.max(pd, ceiling);
floor = pd < floor ? pd : floor; floor = Math.min(pd, floor);
if(tunnelHeight == 1) if(tunnelHeight == 1)
{ {
ceiling = caveHeight > ceiling ? caveHeight : ceiling; ceiling = Math.max(caveHeight, ceiling);
floor = caveHeight < floor ? caveHeight : floor; floor = Math.min(caveHeight, floor);
} }
} }
@ -134,22 +133,22 @@ public class GenLayerCave extends GenLayer
{ {
if(dig(x, pu, z, data, fluid)) if(dig(x, pu, z, data, fluid))
{ {
ceiling = pu > ceiling ? pu : ceiling; ceiling = Math.max(pu, ceiling);
floor = pu < floor ? pu : floor; floor = Math.min(pu, floor);
} }
if(dig(x, pd, z, data, fluid)) if(dig(x, pd, z, data, fluid))
{ {
ceiling = pd > ceiling ? pd : ceiling; ceiling = Math.max(pd, ceiling);
floor = pd < floor ? pd : floor; floor = Math.min(pd, floor);
} }
if(tunnelHeight == 1) if(tunnelHeight == 1)
{ {
if(dig(x, (int) (caveHeight), z, data, fluid)) if(dig(x, caveHeight, z, data, fluid))
{ {
ceiling = caveHeight > ceiling ? caveHeight : ceiling; ceiling = Math.max(caveHeight, ceiling);
floor = caveHeight < floor ? caveHeight : floor; floor = Math.min(caveHeight, floor);
} }
} }
} }

View File

@ -56,7 +56,7 @@ public class GenLayerRavine extends GenLayer
return pos.getBlockData(x, y, z); return pos.getBlockData(x, y, z);
} }
private BlockData getSurfaceBlock(TerrainChunk pos, BiomeMap map, int n6, int i, RNG rmg) private BlockData getSurfaceBlock(BiomeMap map, int n6, int i, RNG rmg)
{ {
return map.getBiome(n6, i).getSurfaceBlock(n6, i, rmg, iris.getData()); return map.getBiome(n6, i).getSurfaceBlock(n6, i, rmg, iris.getData());
} }
@ -93,15 +93,15 @@ public class GenLayerRavine extends GenLayer
} }
while(n3 < n4) while(n3 < n4)
{ {
double d7 = 1.5 + (double) (MathHelper.sin((float) ((float) n3 * 3.1415927f / (float) n4)) * f * 1.0f); double d7 = 1.5 + (double) (MathHelper.sin((float) n3 * 3.1415927f / (float) n4) * f * 1.0f);
double d8 = d7 * d4; double d8 = d7 * d4;
d7 *= (double) random.nextFloat() * 0.25 + 0.75; d7 *= (double) random.nextFloat() * 0.25 + 0.75;
d8 *= (double) random.nextFloat() * 0.25 + 0.75; d8 *= (double) random.nextFloat() * 0.25 + 0.75;
float f7 = MathHelper.cos((float) f3); float f7 = MathHelper.cos(f3);
float f8 = MathHelper.sin((float) f3); float f8 = MathHelper.sin(f3);
sx += (double) (MathHelper.cos((float) f2) * f7); sx = sx + (double) (MathHelper.cos(f2) * f7);
sy += (double) f8; sy += f8;
sz += (double) (MathHelper.sin((float) f2) * f7); sz += MathHelper.sin(f2) * f7;
f3 *= 0.7f; f3 *= 0.7f;
f3 += f5 * 0.05f; f3 += f5 * 0.05f;
f2 += f4 * 0.05f; f2 += f4 * 0.05f;
@ -122,12 +122,12 @@ public class GenLayerRavine extends GenLayer
if(sx >= x - 16.0 - d7 * 2.0 && sz >= z - 16.0 - d7 * 2.0 && sx <= x + 16.0 + d7 * 2.0 && sz <= z + 16.0 + d7 * 2.0) if(sx >= x - 16.0 - d7 * 2.0 && sz >= z - 16.0 - d7 * 2.0 && sx <= x + 16.0 + d7 * 2.0 && sz <= z + 16.0 + d7 * 2.0)
{ {
int n6; int n6;
int n7 = MathHelper.floor((double) (sx - d7)) - tx * 16 - 1; int n7 = MathHelper.floor(sx - d7) - tx * 16 - 1;
int n8 = MathHelper.floor((double) (sx + d7)) - tx * 16 + 1; int n8 = MathHelper.floor(sx + d7) - tx * 16 + 1;
int n9 = MathHelper.floor((double) (sy - d8)) - 1; int n9 = MathHelper.floor(sy - d8) - 1;
int n10 = MathHelper.floor((double) (sy + d8)) + 1; int n10 = MathHelper.floor(sy + d8) + 1;
int n11 = MathHelper.floor((double) (sz - d7)) - tz * 16 - 1; int n11 = MathHelper.floor(sz - d7) - tz * 16 - 1;
int n12 = MathHelper.floor((double) (sz + d7)) - tz * 16 + 1; int n12 = MathHelper.floor(sz + d7) - tz * 16 + 1;
if(n7 < 0) if(n7 < 0)
{ {
n7 = 0; n7 = 0;
@ -221,7 +221,7 @@ public class GenLayerRavine extends GenLayer
} }
cSet(bps, n6 + tx * 16, 0, i + tz * 16); cSet(bps, n6 + tx * 16, 0, i + tz * 16);
set(terrain, n6, j - 1, i, getSurfaceBlock(terrain, biomeMap, n6, i, rng), height, map); set(terrain, n6, j - 1, i, getSurfaceBlock(biomeMap, n6, i, rng), height, map);
} }
} }
} }

View File

@ -20,7 +20,7 @@ public class GenLayerText extends GenLayer
{ {
public static final BlockData AIR = B.getBlockData("AIR"); public static final BlockData AIR = B.getBlockData("AIR");
private AtomicCache<IrisObject> debug = new AtomicCache<>(); private final AtomicCache<IrisObject> debug = new AtomicCache<>();
public GenLayerText(TopographicTerrainProvider iris, RNG rng) public GenLayerText(TopographicTerrainProvider iris, RNG rng)
{ {
@ -30,9 +30,7 @@ public class GenLayerText extends GenLayer
public IrisObject getDebug() public IrisObject getDebug()
{ {
return debug.aquire(() -> return debug.aquire(() ->
{ createTextObject("Test", "Impact", 24, B.get("STONE")));
return createTextObject("Test", "Impact", 24, B.get("STONE"));
});
} }
public IrisObject createTextObject(String text, String font, int size, BlockData b) public IrisObject createTextObject(String text, String font, int size, BlockData b)

View File

@ -32,8 +32,8 @@ import com.volmit.iris.util.RNG;
public class GenLayerUpdate extends BlockPopulator public class GenLayerUpdate extends BlockPopulator
{ {
private ParallaxTerrainProvider gen; private final ParallaxTerrainProvider gen;
private RNG rng; private final RNG rng;
public GenLayerUpdate(ParallaxTerrainProvider gen) public GenLayerUpdate(ParallaxTerrainProvider gen)
{ {
@ -52,7 +52,7 @@ public class GenLayerUpdate extends BlockPopulator
generateDepositsWithVanillaSaftey(w, rx, c); generateDepositsWithVanillaSaftey(w, rx, c);
} }
updateBlocks(w, rx, c, map); updateBlocks(rx, c, map);
spawnInitials(c, rx); spawnInitials(c, rx);
} }
@ -103,7 +103,7 @@ public class GenLayerUpdate extends BlockPopulator
gen.getMetrics().getDeposits().put(p.getMilliseconds()); gen.getMetrics().getDeposits().put(p.getMilliseconds());
} }
private void updateBlocks(World w, RNG rx, Chunk c, AtomicSliverMap map) private void updateBlocks(RNG rx, Chunk c, AtomicSliverMap map)
{ {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
for(int i = 0; i < 16; i++) for(int i = 0; i < 16; i++)
@ -159,7 +159,7 @@ public class GenLayerUpdate extends BlockPopulator
IrisRegion region = gen.sampleRegion(rx, rz); IrisRegion region = gen.sampleRegion(rx, rz);
IrisBiome biomeSurface = gen.sampleTrueBiome(rx, rz); IrisBiome biomeSurface = gen.sampleTrueBiome(rx, rz);
IrisBiome biomeUnder = gen.sampleTrueBiome(rx, b.getY(), rz); IrisBiome biomeUnder = gen.sampleTrueBiome(rx, b.getY(), rz);
KList<IrisLootTable> tables = new KList<IrisLootTable>(); KList<IrisLootTable> tables = new KList<>();
IrisStructureResult structure = gen.getStructure(rx, b.getY(), rz); IrisStructureResult structure = gen.getStructure(rx, b.getY(), rz);
double multiplier = 1D * gen.getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier(); double multiplier = 1D * gen.getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier();
injectTables(tables, gen.getDimension().getLoot()); injectTables(tables, gen.getDimension().getLoot());
@ -238,7 +238,7 @@ public class GenLayerUpdate extends BlockPopulator
addItems(false, m.getInventory(), rng, tables, slot, rx, b.getY(), rz, 15); addItems(false, m.getInventory(), rng, tables, slot, rx, b.getY(), rz, 15);
} }
catch(Throwable e) catch(Throwable ignored)
{ {
} }

View File

@ -21,7 +21,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
{ {
private static final BlockData WATER = B.getBlockData("WATER"); private static final BlockData WATER = B.getBlockData("WATER");
private static final BlockData AIR = B.getBlockData("AIR"); private static final BlockData AIR = B.getBlockData("AIR");
private RNG rng; private final RNG rng;
@DontObfuscate @DontObfuscate
public PostMasterPatcher(PostBlockTerrainProvider gen, int phase) public PostMasterPatcher(PostBlockTerrainProvider gen, int phase)

View File

@ -1,7 +1,5 @@
package com.volmit.iris.util; package com.volmit.iris.util;
import java.util.Objects;
public class ChunkPosition public class ChunkPosition
{ {
private int x; private int x;
@ -36,7 +34,11 @@ public class ChunkPosition
@Override @Override
public int hashCode() public int hashCode()
{ {
return Objects.hash(x, z); final int prime = 31;
int result = 1;
result = prime * result + x;
result = prime * result + z;
return result;
} }
@Override @Override

View File

@ -2,20 +2,26 @@ package com.volmit.iris.util;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.IntPredicate; import java.util.function.IntPredicate;
import net.minecraft.server.v1_16_R2.BaseBlockPosition;
import net.minecraft.server.v1_16_R2.SystemUtils;
public class MathHelper public class MathHelper
{ {
public static final float a = MathHelper.c(2.0f); public static final float a = MathHelper.c(2.0f);
private static final float[] b = (float[]) SystemUtils.a((Object) new float[65536], var0 -> private static final float[] b = (float[]) a((Object) new float[65536], var0 ->
{ {
for(int var1 = 0; var1 < ((float[]) var0).length; ++var1) for(int var1 = 0; var1 < ((float[]) var0).length; ++var1)
{ {
((float[]) var0)[var1] = (float) Math.sin((double) var1 * 3.141592653589793 * 2.0 / 65536.0); ((float[]) var0)[var1] = (float) Math.sin((double) var1 * 3.141592653589793 * 2.0 / 65536.0);
} }
}); });
public static <T> T a(T var0, Consumer<T> var1)
{
var1.accept(var0);
return var0;
}
private static final Random c = new Random(); private static final Random c = new Random();
private static final int[] d = new int[] {0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; private static final int[] d = new int[] {0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9};
private static final double e = Double.longBitsToDouble(4805340802404319232L); private static final double e = Double.longBitsToDouble(4805340802404319232L);
@ -319,9 +325,9 @@ public class MathHelper
return var0 - (double) MathHelper.d(var0); return var0 - (double) MathHelper.d(var0);
} }
public static long a(BaseBlockPosition var0) public static long a(BlockPosition var0)
{ {
return MathHelper.c(var0.getX(), var0.getY(), var0.getZ()); return c(var0.getX(), var0.getY(), var0.getZ());
} }
public static long c(int var0, int var1, int var2) public static long c(int var0, int var1, int var2)
@ -359,16 +365,19 @@ public class MathHelper
{ {
return Double.NaN; return Double.NaN;
} }
@SuppressWarnings("unused")
boolean bl = var6 = var0 < 0.0; boolean bl = var6 = var0 < 0.0;
if(var6) if(var6)
{ {
var0 = -var0; var0 = -var0;
} }
@SuppressWarnings("unused")
boolean bl2 = var7 = var2 < 0.0; boolean bl2 = var7 = var2 < 0.0;
if(var7) if(var7)
{ {
var2 = -var2; var2 = -var2;
} }
@SuppressWarnings("unused")
boolean bl3 = var8 = var0 > var2; boolean bl3 = var8 = var0 > var2;
if(var8) if(var8)
{ {