3717 Commits

Author SHA1 Message Date
DerFrZocker
8c6d60cf50
Fix server crash with BlockPopulator when entities are at a negative chunk border 2021-08-16 07:07:13 +02:00
DerFrZocker
4f6bcc84f9
SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API
## **Current API**
The current world generation API is very old and limited when you want to make more complex world generation. Resulting in some hard to fix bugs such as that you cannot modify blocks outside the chunk in the BlockPopulator (which should and was per the docs possible), or strange behavior such as SPIGOT-5880.

## **New API**
With the new API, the generation is more separate in multiple methods and is more in line with Vanilla chunk generation. The new API is designed to as future proof as possible. If for example a new generation step is added it can easily also be added as a step in API by simply creating the method for it. On the other side if a generation step gets removed, the method can easily be called after another, which is the case with surface and bedrock. The new API and changes are also fully backwards compatible with old chunk generators.

### **Changes in the new api**
**Extra generation steps:**
Noise, surface, bedrock and caves are added as steps. With those generation steps three extra methods for Vanilla generation are also added. Those new methods provide the ChunkData instead of returning one. The reason for this is, that the ChunkData is now backed by a ChunkAccess. With this, each step has the information of the step before and the Vanilla information (if chosen by setting a 'should' method to true). The old method is deprecated.

**New class BiomeProvider**
The BiomeProvider acts as Biome source and wrapper for the NMS class WorldChunkManager. With this the underlying Vanilla ChunkGeneration knows which Biome to use for the structure and decoration generation. (Fixes: SPIGOT-5880). Although the List of Biomes which is required in BiomeProvider, is currently not much in use in Vanilla, I decided to add it to future proof the API when it may be required in later versions of Minecraft.
The BiomeProvider is also separated from the ChunkGenerator for plugins which only want to change the biome map, such as single Biome worlds or if some biomes should be more present than others.

**Deprecated isParallelCapable**
Mojang has and is pushing to a more multi threaded chunk generation. This should also be the case for custom chunk generators. This is why the new API only supports multi threaded generation. This does not affect the old API, which is still checking this.

**Base height method added**
This method was added to also bring the Minecraft generator and Bukkit generator more in line. With this it is possible to return the max height of a location (before decorations). This is useful to let most structures know were to place them. This fixes SPIGOT-5567. (This fixes not all structures placement, desert pyramids for example are still way up at y-level 64, This however is more a vanilla bug and should be fixed at Mojangs end).

**WorldInfo Class**
The World object was swapped for a WorldInfo object. This is because many methods of the World object won't work during world generation and would mostly likely result in a deadlock. It contains any information a plugin should need to identify the world.

**BlockPopulator Changes**
Instead of directly manipulating a chunk, changes are now made to a new class LimitedRegion, this class provides methods to populated the chunk and its surrounding area. The wrapping is done so that the population can be moved into the place where Minecraft generates decorations. Where there is no chunk to access yet. By moving it into this place the generation is now async and the surrounding area of the chunk can also be used.

For common methods between the World and LimitedRegion a RegionAccessor was added.
2021-08-15 08:08:16 +10:00
md_5
61e4ca7b9e
Update ASM and add support for Java 17 2021-08-13 08:45:32 +10:00
Doc
c30e8f8d51
#913: Handle campfire damage with EntityDamageByBlockEvent 2021-08-11 19:05:08 +10:00
Doc
6cfc062a5b
Add dimension setting getters to World 2021-08-11 18:57:16 +10:00
DerFrZocker
97a4f34a8d
SPIGOT-2222, SPIGOT-6687: Pre-set keepLevel and only use it 2021-08-11 18:49:49 +10:00
Brokkonaut
2cdc6b1e4c
SPIGOT-6692: Add sendSignChange overload with a hasGlowingText parameter 2021-08-05 08:43:03 +10:00
DerFrZocker
97f629b68f
SPIGOT-6220: Structures in the world with custom generator not work 2021-08-01 08:26:30 +10:00
md_5
853792584b
Increase outdated build delay 2021-07-30 19:11:09 +10:00
DerFrZocker
6788550f7e
SPIGOT-6678: ChunkSnapshot#isSectionEmpty() not working as intended. 2021-07-27 18:07:14 +10:00
Mitchell Sulkowski
3ad0fb1c04
#901: Fix PlayerStatisticIncrementEvent spam 2021-07-26 19:32:51 +10:00
md_5
aa69d1cfb9
Only remove tile entity if block type changes 2021-07-24 08:00:31 +10:00
DerFrZocker
64d149a5a9
SPIGOT-1753: ChunkGenerator lighting updates 2021-07-23 16:43:53 +10:00
md_5
82f0955b3b
SPIGOT-6666: NPE when deserializing bundle 2021-07-23 16:38:51 +10:00
James Peters
e8e3cbccf5
#893: Add Crafting methods to API 2021-07-22 11:37:22 +10:00
md_5
879acfee29
Fix missing varargs from previous commit 2021-07-22 11:30:14 +10:00
md_5
6572b9c31a
SPIGOT-6641: Use varargs in sendMessage 2021-07-22 09:54:57 +10:00
md_5
9e06bb2a26
SPIGOT-6663: Chicken Jockeys chickens don't despawn 2021-07-22 09:53:26 +10:00
DerFrZocker
699f2d36b0
SPIGOT-6545: Unable to set Guardian target via API while awareness is disabled 2021-07-22 09:36:54 +10:00
DerFrZocker
8d244b0b7e
SPIGOT-3725, SPIGOT-6638, MC-136917: Properly clear tile entities before replacing 2021-07-19 18:53:40 +10:00
Phoenix616
4f34a67b5e
#891: Fix scheduler task ID overflow and duplication issues 2021-07-17 11:39:56 +10:00
Phoenix616
b7e3ce0233
#890: Include yaw in player's spawn location 2021-07-15 20:29:38 +10:00
James Peters
aeb711dd3f
#889: Fix CraftChest close() sound being replaced with open sound. 2021-07-15 20:29:38 +10:00
Doc
2f038f2de0
#886: Add new Causes for LightningStrikeEvent 2021-07-13 19:16:36 +10:00
DerFrZocker
f4066854f9
SPIGOT-6579: DragonFireBall movement with setDirection jumps around a lot 2021-07-11 09:34:35 +10:00
DerFrZocker
b5d7883afc
SPIGOT-6634: Override needed method 2021-07-09 23:48:16 +10:00
md_5
fb556bfa14
Update to Minecraft 1.17.1 2021-07-07 00:00:00 +10:00
md_5
ec116f636d
Remove outdated build delay. 2021-07-06 22:16:50 +10:00
Doc
07ed44a415
SPIGOT-6527: Add AxolotlBucketMeta 2021-07-04 09:32:25 +10:00
md_5
1e8368ea8d
Update Maven plugins 2021-07-03 11:07:13 +10:00
md_5
cbe0ac7ce1
SPIGOT-6616: Cancellable StriderTemperatureChangeEvent 2021-07-03 09:36:51 +10:00
Doc
7aa02e3a31
SPIGOT-6615 Fix Glow Item Frame to use EntityTagMeta 2021-07-03 09:33:04 +10:00
md_5
b121d3b953
SPIGOT-6605: Add method to access value of enforce-whitelist 2021-06-26 09:58:34 +10:00
md_5
f81f49940f
SPIGOT-6594: NPE at Bukkit.getServer().getGenerateStructures() 2021-06-24 08:37:58 +10:00
blablubbabc
295ab080d3
#872: SculkSensor accesses underlying TileEntity instead of snapshot for vibration frequency. 2021-06-23 09:02:10 +10:00
md_5
887bc05190
SPIGOT-6592: Tile entities in custom ChunkGenerator causes crash 2021-06-21 08:46:23 +10:00
Ibrahim Ansari
9ba1c67efc
#870: Add isTrusting/setTrusting to CraftOcelot. 2021-06-21 08:43:09 +10:00
md_5
470050ad1e
SPIGOT-6587: Update documentation/error of drop chance API 2021-06-20 12:15:28 +10:00
md_5
1c39efa340
Fix Inventory#getViewers on the player inventory not returning the player first time their inventory is opened 2021-06-20 09:27:32 +10:00
Eric Su
9122f5a6e0
#869: Fix BossBar setColor and setStyle updates 2021-06-17 17:37:30 +10:00
md_5
96a15d7a4a
Incrase outdated build delay 2021-06-17 08:42:37 +10:00
md_5
ded19075b1
SPIGOT-6570: Missing InventoryType: COMPOSTER 2021-06-17 08:29:15 +10:00
md_5
d7ef1e91fa
SPIGOT-6558: Attempt to improve SkullMeta 2021-06-16 10:28:42 +10:00
md_5
f992ce6097
Fix duplicate datapack reload on /reload 2021-06-15 15:51:13 +10:00
md_5
622cf61119
SPIGOT-6555: Cannot access shield BlockStateMeta 2021-06-15 13:06:23 +10:00
md_5
6ed400043b
SPIGOT-6560: Crash when falling stalactite hits player 2021-06-15 08:01:07 +10:00
VendoAU
a07e783a69
#865: Implement Villager#shakeHead 2021-06-14 19:15:13 +10:00
Martoph
3252ff189c
#863: Add LivingEntity#isClimbing 2021-06-14 19:11:46 +10:00
md_5
77058c79de
SPIGOT-6554: Worlds created with the bukkit ChunkGenerator cannot save 2021-06-14 13:52:25 +10:00
Bjarne Koll
85b8c1fda6
SPIGOT-6507: Implement abstract skeleton and stray conversion
The previous layout and class hierarchy of the skeleton API defined
variances of the skeleton, such as the wither skeleton or the stray, as
child types of the normal skeleton variance, which is technically
incorrect, yet did not produce any specific issue as the normal skeleton
variance did not have any unique logic.

With the introduction of powdered snow in the 1.17 update, the normal
skeleton variance now has unique logic, specifically the conversion to
a stay when stuck inside powdered snow, which cannot be represented in
the current API layout due to the prior mentioned hierarchy.

This commit implements the hierarchy changes made in the bukkit
repository by representing the new hierarchy on the craftbukkit side
through the CraftAbstractSkeleton and the respective additions to the
skeleton implementation in regards to the stray conversion.

This commit does not break ABI yet breaks backwards compatibility due to
the mentioned hierarchy changes. Plugins that previously used the
Skelton interface to compute whether or not an entity is skeleton-like
through instanceOf checks will now only match the normal skeleton variance
instead of any skeleton-like entity.
2021-06-14 10:01:19 +10:00