235 Commits

Author SHA1 Message Date
Dylan K. Taylor
c310a0c50c Merge branch '3.7' 2019-04-06 15:35:58 +01:00
Dylan K. Taylor
612e9e162c Fixed worlds with unknown generators silently getting wrong generator, closes #2860 2019-04-06 15:17:36 +01:00
Dylan K. Taylor
86a5a50330 Generator: remove more useless functions
these are red herrings for plugin developers since they are not used.
2019-04-04 17:53:25 +01:00
Dylan K. Taylor
5a989d82bb Generator: remove useless function getName() 2019-04-04 16:43:04 +01:00
Dylan K. Taylor
2c4f2810d2 AsyncTask: Remove misleading methods getFromThreadStore(),saveToThreadStore(),removeFromThreadStore()
These methods are commonly mixed up when we talk about thread-local storage. What these things actually do is store persistent data on the worker thread.
2019-04-02 14:57:11 +01:00
Dylan K. Taylor
2a3e6dcf00 Rename BlockIds -> BlockLegacyIds 2019-03-23 19:46:31 +00:00
Dylan K. Taylor
79ef8e0803 Replace all legacy blockID references with BlockIds:: 2019-03-23 19:44:33 +00:00
Dylan K. Taylor
9ad7f74501 Merge branch '3.7' 2019-03-21 19:02:55 +00:00
Dylan K. Taylor
6a55021779 Flat: Allow asterisk in preset layers
closes #2818
2019-03-21 18:59:50 +00:00
Dylan K. Taylor
5830ca958b Further out-phasing of legacy ID/meta
this paves the way for making internal IDs fully dynamic.
2019-03-17 16:01:04 +00:00
Dylan K. Taylor
a858103e6b Support paletted subchunks, drop all formats except leveldb 2019-03-10 19:53:24 +00:00
Dylan K. Taylor
2795ad674b add boilerplate code to check for generator validity
perhaps we should use an enum for this...?
2019-03-05 09:36:22 +00:00
Dylan K. Taylor
2cad7166b1 GeneratorManager::getGeneratorName() now throws InvalidArgumentException on unregistered generator classes
the old behaviour allowed a bug in the world converter to go unnoticed.
2019-03-05 09:30:22 +00:00
Dylan K. Taylor
9ad0ea85c7 Rename two misleadingly-named functions 2019-02-27 12:59:12 +00:00
Dylan K. Taylor
36e9db4c07 Generate methods for surrogate enums, nip stupidity in the bud
this also allows changing the internal implementation later without breaking plugins.
2019-02-20 11:09:22 +00:00
Dylan K. Taylor
22a21ecfd6 BlockTransaction: Take world in constructor 2019-02-16 19:57:55 +00:00
Dylan K. Taylor
0794c94b4b Rename BlockWriteBatch -> BlockTransaction 2019-02-16 19:53:15 +00:00
Dylan K. Taylor
7b3993730a Block: Replace Color and WoodType magic numbers with type-safe objects
this provides automatic type safety without the need for magic number value checking everywhere.
2019-02-12 13:52:59 +00:00
Dylan K. Taylor
c124aae219 Merge branch '3.5' 2019-01-30 13:09:43 +00:00
Dylan K. Taylor
331ae5498f Crash the generator when encountering invalid presets
this is a partial fix for #2717, but still not ideal because it'll spam whenever a chunk is attempted to be generated. However, fixing this properly requires potentially breaking API changes.
2019-01-30 12:29:04 +00:00
Dylan K. Taylor
179fb9c7cb Fixed tree trunk generation bug introduced by ac87319aed4d556d85a8aeba0ea6da6667a5408f
Blocks were being overwritten in the writebatch which hadn't yet been set, so reading them from the world yielded air blocks instead of trunk, allowing the generation to overwrite blocks which should have been logs.
2019-01-19 13:41:28 +00:00
Dylan K. Taylor
5052b75565 Separate Level management functionality from Server, clean up a bunch of mess 2019-01-12 19:11:05 +00:00
Dylan K. Taylor
d8d04aeb53 fixup some imports 2019-01-04 23:49:32 +00:00
Dylan K. Taylor
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
e1064a9e36 Merge branch '3.5' 2019-01-04 00:37:48 +00:00
Dylan K. Taylor
d71a543d10 Fixed a bunch of things PHPStan finds unpalatable
close #2614, fix a bunch of docs bugs, fix sendCreativeContents() crash on Human holders, move some inline variable declarations
2019-01-04 00:23:09 +00:00
Dylan T
ac87319aed
Introduce a "block write-batch" concept (#2555)
Make use of writebatch to generate trees, doors and double plants safely

- Fixes #2441 
- Fixes #2548 
- Closes #2498
2018-12-29 12:00:14 +00:00
Dylan K. Taylor
ab75e89d95 Fixed generation changes in recent builds compared to 3.x
this was caused by improper RNG sanitization and a recent cleanup refactor.
2018-12-27 17:36:41 -05:00
Dylan K. Taylor
7d594ac6d8 Merge branch 'release/3.4' 2018-12-09 19:28:52 +00:00
Dylan K. Taylor
f704061618 Tree: fixed being able to overwrite other trees
this was observable by planting a sapling underneath an existing tree and punching it with bone meal.

This change will also prevent trees generating too close together.
2018-12-09 19:26:48 +00:00
Dylan K. Taylor
cd5b81bdb9 ChunkManager: Remove getBlockIdAt()/setBlockIdAt()/getBlockDataAt()/setBlockDataAt(), add getBlockAt() and setBlockAt() 2018-12-04 22:27:00 +00:00
Dylan K. Taylor
98efd27543 Remove ability to set blockID and blockdata independently
This was the cause of many inconsistency and broken world bugs. In the future (once we switch to paletted chunks) this won't be possible anyway. For now, some temporary API is provided to allow modifying chunkdata directly, but it is required that **both** must be provided.
2018-11-22 16:53:22 +00:00
Dylan K. Taylor
1e8b153662 Further cleanup to Simplex/Noise hierarchy 2018-10-28 16:30:18 +00:00
Dylan K. Taylor
f4105fd91a Noise: remove a ton of dead code 2018-10-27 17:04:53 +01:00
Dylan K. Taylor
ff28c982ac Kick out unnecessary Perlin class
the code in here isn't used anywhere except as a base for Simplex, so it makes more sense to flatten it and get rid of the crap.
2018-10-27 16:33:58 +01:00
Dylan K. Taylor
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
70054de575 Clean up garbage in Tree populators 2018-10-15 19:42:16 +01:00
Dylan K. Taylor
706082deb1 Fixed Flat generator using item ID/damage to build block layers 2018-10-07 12:01:43 +01:00
Dylan K. Taylor
8a062f440d Chunk: remove column methods
these were (mostly) unused, and the places they were used breaks the interface definitions. It also exposes internals that are sensitive to change.
2018-10-03 18:35:39 +01:00
Dylan K. Taylor
56d9943b0d Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
2018-09-21 19:28:10 +01:00
Dylan K. Taylor
9b4d82630b BlockFactory: remove $solid
this is premature optimization and will run into problems once we enter the flattening.
2018-09-20 16:26:15 +01:00
Dylan K. Taylor
f03ab76c83 Remove imports left over from 5ce2d5e072e8659190d1111cd394ebb8f78db4dc 2018-09-10 17:51:13 +01:00
Dylan K. Taylor
d62e00cc74 AsyncPool: Remove Server dependency (API breaks included)
This brings two plugin-breaking changes: AsyncTask->onCompletion() and AsyncTask->onProgressUpdate() no longer accept Server parameters.

This now allows for the functionality of AsyncPool and AsyncTask to be tested outside of a Server.
2018-09-10 15:48:59 +01:00
Dylan K. Taylor
5ce2d5e072 Clean up to Generator creation, remove getSeed() from ChunkManager interface
it's the generator's responsibility to know about the seed, not the chunkmanager's. This now reduces the complexity of implementing and using a chunkmanager.
2018-09-10 13:28:15 +01:00
Dylan K. Taylor
92aeab0d00 Merge branch 'release/3.2' 2018-08-19 16:03:04 +01:00
Dylan K. Taylor
2eda8cfad3 Merge branch 'release/3.1' into release/3.2 2018-08-19 16:01:47 +01:00
Dylan K. Taylor
5df601c817 Add @see docs so PhpStorm can see dynamic constructor usages
PhpStorm can't see constructor usages when the class name is dynamic. This causes maintenance problems because cross-referencing constructors called like this doesn't show up dynamic calls.
2018-08-19 16:00:15 +01:00
Dylan K. Taylor
20f3b82d52 Be less dependent on AsyncTask->onCompletion() Server parameter
this is going to get removed soon.
2018-08-04 15:56:14 +01:00
Dylan K. Taylor
eb738d1d72 Apply more typehints to generator namespace 2018-07-26 19:31:18 +01:00