Commit graph

3769 commits

Author SHA1 Message Date
CraftBukkit/Spigot
44cc499340 Fix issues with new ChunkGenerator API
- RegionAccessor#setType / RegionAccessor#setBlockData doesn't run entity removal logic
- RegionAccessor#generateTree crashes by bee nest (TreeType#TALL_BIRCH)

By: DerFrZocker <derrieple@gmail.com>
2021-08-22 13:23:40 +02:00
CraftBukkit/Spigot
80b1ef0c8e SPIGOT-6697: Restore generateTree with BlockChangeDelegate behaviour
By: md_5 <git@md-5.net>
2021-08-22 18:12:59 +10:00
CraftBukkit/Spigot
49c30227d2 Rebuild patch
By: md_5 <git@md-5.net>
2021-08-22 18:07:39 +10:00
CraftBukkit/Spigot
00c0964347 SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn
By: md_5 <git@md-5.net>
2021-08-22 18:07:31 +10:00
CraftBukkit/Spigot
9c5dd3b837 SPIGOT-6716: Preserve the order of stored enchantments of enchanted books.
In some cases, differences in this order can result in item stack
comparisons to fails.

By: blablubbabc <lukas@wirsindwir.de>
2021-08-20 19:40:31 +10:00
CraftBukkit/Spigot
973f763605 #914: Add World#spawn with randomizeData parameter
The current implementation of World#spawn or World#spawnEntity
respectively, always prepares/finalizes the spawn of every entity
spawned through the API. While this is great to simulate natural
spawning of entities in the world through the API, it fails at
reliably creating default entities for purposes other than vanilla
gameplay.

While the caller of the API could attempt to undo all of the
customization that is applied in the prepare/finalization step, they are
numerous (reaching from sheep colour to equipment) and in some cases,
such as the chicken jockey, even spawn in other entities.

Hence this commit introduces a new overload to the World#spawn and
World#spawnEntity methods that accepts the 'randomizeData' parameter
that, when set to false, skips the prior mentioned
preparation/finalization step.

By: Bjarne Koll <lynxplay101@gmail.com>
2021-08-18 18:04:53 +10:00
CraftBukkit/Spigot
03aecfb428 SPIGOT-6714: Don't fire PlayerBucketEvent when empty
By: Noah van der Aa <ndvdaa@gmail.com>
2021-08-18 17:06:40 +10:00
CraftBukkit/Spigot
3a23c54a91 Fix server crash with BlockPopulator when entities are at a negative chunk border
By: DerFrZocker <derrieple@gmail.com>
2021-08-16 07:07:13 +02:00
CraftBukkit/Spigot
c2e4e91b1b 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.

By: DerFrZocker <derrieple@gmail.com>
2021-08-15 08:08:16 +10:00
CraftBukkit/Spigot
fdefaeeccd Update ASM and add support for Java 17
By: md_5 <git@md-5.net>
2021-08-13 08:45:32 +10:00
CraftBukkit/Spigot
3483bd08b3 #913: Handle campfire damage with EntityDamageByBlockEvent
By: Doc <nachito94@msn.com>
2021-08-11 19:05:08 +10:00
CraftBukkit/Spigot
6d08059769 Add dimension setting getters to World
By: Doc <nachito94@msn.com>
2021-08-11 18:57:16 +10:00
CraftBukkit/Spigot
72591f6038 SPIGOT-2222, SPIGOT-6687: Pre-set keepLevel and only use it
By: DerFrZocker <derrieple@gmail.com>
2021-08-11 18:49:49 +10:00
CraftBukkit/Spigot
4a49f6bf8b SPIGOT-6692: Add sendSignChange overload with a hasGlowingText parameter
By: Brokkonaut <hannos17@gmx.de>
2021-08-05 08:43:03 +10:00
CraftBukkit/Spigot
4beaa19a39 SPIGOT-6682: Blocking with shield not reset after die
By: DerFrZocker <derrieple@gmail.com>
2021-08-04 17:09:09 +10:00
CraftBukkit/Spigot
aab97ffee0 SPIGOT-6220: Structures in the world with custom generator not work
By: DerFrZocker <derrieple@gmail.com>
2021-08-01 08:26:30 +10:00
CraftBukkit/Spigot
fa9a064a7d Increase outdated build delay
By: md_5 <git@md-5.net>
2021-07-30 19:11:09 +10:00
CraftBukkit/Spigot
87f8ab3fb3 SPIGOT-6552: Some inventory types reset cursor on switch
By: DerFrZocker <derrieple@gmail.com>
2021-07-30 19:08:43 +10:00
CraftBukkit/Spigot
af0d8b70df SPIGOT-6678: ChunkSnapshot#isSectionEmpty() not working as intended.
By: DerFrZocker <derrieple@gmail.com>
2021-07-27 18:07:14 +10:00
CraftBukkit/Spigot
eda6555bbf #901: Fix PlayerStatisticIncrementEvent spam
By: Mitchell Sulkowski <mitchellsulkowski@gmail.com>
2021-07-26 19:32:51 +10:00
CraftBukkit/Spigot
e4b545e047 Only remove tile entity if block type changes
By: md_5 <git@md-5.net>
2021-07-24 07:55:52 +10:00
CraftBukkit/Spigot
353c9f5090 SPIGOT-1753: ChunkGenerator lighting updates
By: DerFrZocker <derrieple@gmail.com>
2021-07-23 16:43:53 +10:00
CraftBukkit/Spigot
f294d260b8 SPIGOT-6666: NPE when deserializing bundle
By: md_5 <git@md-5.net>
2021-07-23 16:38:51 +10:00
CraftBukkit/Spigot
dcfc8b355a SPIGOT-6669: Shearing a Mooshroom does not fire EntityDropItemEvent
By: md_5 <git@md-5.net>
2021-07-23 16:36:16 +10:00
CraftBukkit/Spigot
999bd6c0ef SPIGOT-6667: /schedule function not working correctly in other dimensions
By: DerFrZocker <derrieple@gmail.com>
2021-07-23 16:29:04 +10:00
CraftBukkit/Spigot
9273a60cdb SPIGOT-6665: Shearing a Snowman does not drop a carved pumpkin
By: md_5 <git@md-5.net>
2021-07-22 17:51:53 +10:00
CraftBukkit/Spigot
93f615157d #893: Add Crafting methods to API
By: James Peters <jameslfc19@gmail.com>
2021-07-22 11:35:48 +10:00
CraftBukkit/Spigot
0376264d06 Fix missing varargs from previous commit
By: md_5 <git@md-5.net>
2021-07-22 11:30:14 +10:00
CraftBukkit/Spigot
bacb1b57f1 SPIGOT-6641: Use varargs in sendMessage
By: md_5 <git@md-5.net>
2021-07-22 09:54:57 +10:00
CraftBukkit/Spigot
2ccd460e09 SPIGOT-6663: Chicken Jockeys chickens don't despawn
By: md_5 <git@md-5.net>
2021-07-22 09:53:26 +10:00
CraftBukkit/Spigot
bfc74e8628 SPIGOT-6545: Unable to set Guardian target via API while awareness is disabled
By: DerFrZocker <derrieple@gmail.com>
2021-07-22 09:36:54 +10:00
CraftBukkit/Spigot
0474cc8833 SPIGOT-6369: Add ItemStack to HangingPlaceEvent
By: DerFrZocker <derrieple@gmail.com>
2021-07-21 09:32:54 +10:00
CraftBukkit/Spigot
8650786dad SPIGOT-6645: Call EntityChangeBlockEvent before PlayerHarvestBlockEvent
By: Brokkonaut <hannos17@gmx.de>
2021-07-19 18:54:13 +10:00
CraftBukkit/Spigot
1e8509d8ef SPIGOT-3725, SPIGOT-6638, MC-136917: Properly clear tile entities before replacing
By: DerFrZocker <derrieple@gmail.com>
2021-07-19 18:49:27 +10:00
CraftBukkit/Spigot
fd8748b4bd SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
By: md_5 <git@md-5.net>
2021-07-18 11:08:18 +10:00
CraftBukkit/Spigot
5eb7a2ed61 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron
By: md_5 <git@md-5.net>
2021-07-18 10:14:55 +10:00
CraftBukkit/Spigot
59f5a7ab59 SPIGOT-6653: Canceling snow bucket placement removes snow from bucket
By: md_5 <git@md-5.net>
2021-07-18 10:06:38 +10:00
CraftBukkit/Spigot
71d4016a4d #891: Fix scheduler task ID overflow and duplication issues
By: Phoenix616 <max@themoep.de>
2021-07-17 11:39:56 +10:00
CraftBukkit/Spigot
96ffc08c35 #874: Add FurnaceStartSmeltEvent
By: Rabbitual <38820203+Rabbitual@users.noreply.github.com>
2021-07-17 11:19:51 +10:00
CraftBukkit/Spigot
215fa0caef SPIGOT-6649: Call BlockFadeEvent when Nylium fades to Netherrack
By: Brokkonaut <hannos17@gmx.de>
2021-07-15 20:29:38 +10:00
CraftBukkit/Spigot
c1484dc4b1 #890: Include yaw in player's spawn location
By: Phoenix616 <max@themoep.de>
2021-07-15 20:29:38 +10:00
CraftBukkit/Spigot
96eed49699 #889: Fix CraftChest close() sound being replaced with open sound.
By: James Peters <jameslfc19@gmail.com>
2021-07-15 20:29:38 +10:00
CraftBukkit/Spigot
a061943cac SPIGOT-5561: Warning in logs when changing a Mob Spawner to Air on chunk load
By: DerFrZocker <derrieple@gmail.com>
2021-07-13 19:22:27 +10:00
CraftBukkit/Spigot
e797fdd58a #886: Add new Causes for LightningStrikeEvent
By: Doc <nachito94@msn.com>
2021-07-13 19:16:36 +10:00
CraftBukkit/Spigot
18a453f567 SPIGOT-6637: Revert "#874: Add FurnaceStartSmeltEvent"
This reverts commit 38faf28378.

By: md_5 <git@md-5.net>
2021-07-11 12:26:27 +10:00
CraftBukkit/Spigot
cae78fadd8 SPIGOT-6579: DragonFireBall movement with setDirection jumps around a lot
By: DerFrZocker <derrieple@gmail.com>
2021-07-11 09:34:35 +10:00
CraftBukkit/Spigot
81ee774c37 SPIGOT-6623: Missing API reasons for entity freezing
By: Doc <nachito94@msn.com>
2021-07-11 09:32:27 +10:00
CraftBukkit/Spigot
38faf28378 #874: Add FurnaceStartSmeltEvent
By: Rabbitual <38820203+rabbitual@users.noreply.github.com>
2021-07-11 09:26:46 +10:00
CraftBukkit/Spigot
413825611f SPIGOT-5560, SPIGOT-6574, SPIGOT-6632: Remove no longer needed tile entity fix
By: DerFrZocker <derrieple@gmail.com>
2021-07-11 09:05:59 +10:00
CraftBukkit/Spigot
02134e4ee6 SPIGOT-6634: Override needed method
By: DerFrZocker <derrieple@gmail.com>
2021-07-09 23:48:16 +10:00