This commit replaces calls to Minecraft's shapeChunk with a custom ocean
generation algorithm. This allows us to remove Byte Buddy as a
dependency and avoid wasteful computations.
The main change consists of adding an `OceanOracle` class which now
handles ocean generation. The relevant algorithms were mostly pretty
straightforward to implement, though the `mergeNoises` function is a bit
complex.
Due to this change, we no longer need to deal with an entire chunk
worth of data; instead we now only allocate one or two layers. The
massive overhead from calling shapeChunk through reflection has also
been eliminated.
I added another config constant, INTERPOLATE_NOISE_VERTICALLY, that
could be disabled for even more performance at the cost of accuracy. I
consider the current performance good enough, so I didn't turn it on by
default.
This commit enables displaying oceans in beta versions. I was able to
largely solve the performance issues by implementing a custom noise
generator that only generates at ocean level and by only generating the
most significant octaves.
We are now running part of Minecraft's chunk generation, the
`shapeChunk` method. This uses several PerlinOctaveNoises to determine
for each block in a chunk if it should be air, stone, water, or ice.
As was discovered on the support_early_betas branch, just doing this
would be *very* slow.
This commit employs two major optimizations to get good performance,
both targeting Minecraft's 3D interpolation noise. This noise is
responsible for scrambling the terrain generated by the depth and biome
noises and is vital for accurately showing oceans. The vanilla
implementation is wasteful in two ways: It generates noise for Y values
which are not relevant for determining the blocks at Y=63 and it uses 16
octaves of nosie. My optimized implementation skips irrelevant Y values
and allows us to limit the number of octaves to only the n most
significant ones. This setting is controlled via the OCEAN_PRECISION
constant, I set it to 4 as that provides good accuracy while still being
fast.
This involved implementing my own PerlinNoise and PerlinOctaveNoise
classes. The code is mostly just a straightforward implementation of
Perlin's algorithm while conforming to the interface Minecraft expects.
I actually had to implement a bug, as Minecraft's PerlinNoise
implementation is slightly broken.
This commit adds a new dependency, Byte Buddy, for generating two
classes at runtime:
In order to access an OverworldLevelSource, we need to isntantiate an
OverworldDimension. Until b1.6, OverworldDimension was simply the
non-abstract base of all other dimensions. However, it became abstract
in b1.6 with DimensionOverworld now being an empty class inheriting from
it. I did not know of a way to match this DimensionOverworld, so I am
using Byte Buddy to create a class that inherits from Dimension at
runtime.
Byte Buddy is used to generate a subclass of Minecraft's
PerlinOctaveNoise that delegates to our optimized implementation. These
optimizations are vital to supporting accurate oceans at a reasonable
performance and this was the best way I knew to add them.
* broken still, but whatever
* possibly finish up structures for master merge
* add some null checks
* fix nether fortresses freezing fragment loading
* fix most pillager outposts, fix some other bugs
* fix accidental true instead of false, change some comments
* fix bastions/nether fortresses, finish master merge
* fix all of the compilation errors
* Fix old fortresses and bastions
* improve performance by doing the fragment bounds check before isValidLocation
* add back buggyStructureCoordinateMath to what should have it
* fix tests
* Still working on the biome list, but everything else is there
Also need to reformat biome profiles to use ids
* update some biomes
* possibly finished biome list, changed CursorInformationWidget a bit
* update biome profiles to new format, add new nether biomes to the list, change the color of the nether biome
* update biome profiles to inclue latest biome changes
* wip biome list
* maybe final revision of biome list
* Remove allBiomes() completely in Biome, allow using nulls in DefaultVersionFeatures builder for getting default biome list
* Update CursorInformationWidget.java
* fix bug with getting default profile after building jar
* move some stuff from the b1.7.3 support branch to here
* remove guava, change some stuff to not need guava, add serial ids to 2 exceptions
* Convert old biome profiles to new format automatically
* Update conversion map and serialization of biome profiles
* Add more recognised versions, update biome list, update some colors
* Add serialization test, add create example profile button
* tiny changes with creating example profile
* Set Ctrl+D as the default biome profile shortcut
* display dialog when saving example profile
* this seems to work better when building fat jar files
* it replaced the default output jar file (without dependencies) by the fat jar file (including all dependencies)
* removed the script that replaced the default jar file by the fat jar file
* enabled the generation of the mac wrapper, since it should work
* the mac wrapper will contain all dependencies twice
* removed the maven plugin that builds the mac application launcher (configuration was still broken)
* the minecraft code uses google guava
* when executing amidst with eclipse, an exception occured from within the minecraft jar file, while using guava
* the removed maven plugin also uses guava, but another version which seems to be incompatible with the guava version used by the minecraft jar file
* the issue was caused by eclipse adding all maven dependencies to the amidst classpath, which caused the minecraft jar file to use the wrong version of guava ... I guess
* since the maven plugin has a scope of "provided", it is not included in the amidst jar file that is generated by maven
* when executing the generated amidst jar file instead of using eclipse, the issue did not occur ... this supports my guess that eclipse adds all maven dependencies to the amidst classpath
* generates windows and mac icon files using imagemagick
* generates the executables using maven plugins launch4j for windows and appbundle for mac
* renames the jar from (removes the -jar-with-dependencies suffix)
* creates a zip file from the mac app directory
* added maven-eclipse-plugin to download javadoc and sources for maven dependencies in eclipse
* extracted the jdk version to an extra property
* added the build timestamp to the jar filename and to the manifest file