5177 Commits

Author SHA1 Message Date
Lars Dormans
9aeb46ae1f
SPIGOT-6023, SPIGOT-6745: Fix missing BlockDispenseArmorEvents 2021-09-26 18:38:35 +10:00
md_5
d3cc412075
SPIGOT-6738: Add entity type tags 2021-09-19 14:51:21 +10:00
DerFrZocker
1492826118
SPIGOT-6249: Add Missing Effect Constants 2021-09-11 18:40:14 +10:00
md_5
332335e1c6
SPIGOT-6731: "Nag author" message in CraftServer lists one author only 2021-09-10 17:49:53 +10:00
DerFrZocker
6cd975d07e
SPIGOT-5732, SPIGOT-6387: Overhaul Hanging entities
- SPIGOT-5732: Fix issue with spawning leash hitches and painting, by using the right block faces

- SPIGOT-6387: Allow hanging entities to be spawned mid air

- Use randomize parameter to determine if a random painting should be chosen or not

- Return BlockFace self by leash hitches entity

- Throw a standardised exception when trying to set a BlockFace to a hanging entity which the entity does not support, instead of using BlockFace south or throwing a null pointer
2021-09-10 17:46:38 +10:00
Doc
9217b523e5
#929: Call EntityBlockFormEvent for Wither Rose placed by dead entity 2021-09-06 18:57:16 +10:00
Brokkonaut
757d42aef6
SPIGOT-6729: Add Chunk.isEntitiesLoaded() 2021-09-06 18:51:39 +10:00
Phoenix616
6719d1f1e7
SPIGOT-6708: Fix Experience Orb value not being updated in mend event 2021-09-03 18:37:44 +10:00
md_5
422cec08d1
Rebuild patch 2021-09-01 19:02:09 +10:00
DerFrZocker
15f27fc710
SPIGOT-6547: Chunk#getEntities() doesn't return all entities immediately after chunk load 2021-09-01 19:01:52 +10:00
DerFrZocker
cbd747afcd
SPIGOT-6719: Add getTileEntities() to LimitedRegion 2021-08-30 18:44:44 +10:00
Brokkonaut
e167f28088
SPIGOT-6726: NPE when calling getBossBar() on plugin spawned EnderDragon 2021-08-28 19:02:19 +10:00
Doc
5be41fb80f
SPIGOT-6720: Fix bed explosion checks 2021-08-27 19:18:05 +10:00
DerFrZocker
09b99daf30
SPIGOT-6722: Close entity manager when unloading world 2021-08-27 19:14:09 +10:00
DerFrZocker
3a9561bf24
SPIGOT-6686: Changes in MaximumRepairCost for Anvil Rename cause inconsistency 2021-08-27 19:14:09 +10:00
DerFrZocker
a0a37f416c
SPIGOT-6630: Replacing an enchantment on an item creates a conflict error 2021-08-24 18:10:30 +02:00
DerFrZocker
a955f15c25
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)
2021-08-22 13:23:40 +02:00
md_5
78d5b35b82
SPIGOT-6697: Restore generateTree with BlockChangeDelegate behaviour 2021-08-22 18:12:59 +10:00
md_5
15792f0de1
Rebuild patch 2021-08-22 18:07:39 +10:00
md_5
c949675e1f
SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn 2021-08-22 18:07:31 +10:00
blablubbabc
7c8bbcbee7
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.
2021-08-20 19:41:17 +10:00
Bjarne Koll
18027d0239
#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.
2021-08-18 18:04:53 +10:00
Noah van der Aa
3cad0316e0
SPIGOT-6714: Don't fire PlayerBucketEvent when empty 2021-08-18 17:06:40 +10:00
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
e1c96e507f
SPIGOT-6682: Blocking with shield not reset after die 2021-08-04 17:09:09 +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
f7f8dce41f
SPIGOT-6552: Some inventory types reset cursor on switch 2021-07-30 19:08:43 +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
md_5
8dfa97afe4
SPIGOT-6669: Shearing a Mooshroom does not fire EntityDropItemEvent 2021-07-23 16:36:16 +10:00
DerFrZocker
629cc539f7
SPIGOT-6667: /schedule function not working correctly in other dimensions 2021-07-23 16:31:49 +10:00
md_5
0abf420c4b
SPIGOT-6665: Shearing a Snowman does not drop a carved pumpkin 2021-07-22 17:51:53 +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
8ffa54ba8c
SPIGOT-6369: Add ItemStack to HangingPlaceEvent 2021-07-21 09:32:54 +10:00
Brokkonaut
c851639c50
SPIGOT-6645: Call EntityChangeBlockEvent before PlayerHarvestBlockEvent 2021-07-19 18:54:13 +10:00
DerFrZocker
8d244b0b7e
SPIGOT-3725, SPIGOT-6638, MC-136917: Properly clear tile entities before replacing 2021-07-19 18:53:40 +10:00