4205 Commits

Author SHA1 Message Date
coll1234567
9b2585017b
#960: Add Player#showDemoScreen 2021-11-26 10:13:36 +11:00
md_5
99f3dddeac
SPIGOT-6808: Fix RegionAccessor#getBiome 2021-11-25 17:04:58 +11:00
md_5
5a39a236c1
Update to Minecraft 1.18-pre8 2021-11-25 08:00:00 +11:00
md_5
a58fde42cc
Fix crash with composters 2021-11-24 09:33:28 +11:00
md_5
a11ec5d7f5
Remove unnecessary CraftBlock creation in CraftRegionAccessor#setBlock 2021-11-24 08:18:48 +11:00
md_5
dd02403be2
Fix upgrading worlds with custom generators 2021-11-23 20:00:10 +11:00
coll1234567
1c82731ddb
SPIGOT-6781: Add Block#canPlace 2021-11-23 18:50:33 +11:00
md_5
2f6662d467
Improve multi-dimension code 2021-11-23 18:39:43 +11:00
Doc
4bf7f33cc6
#956: Add getHideOnlinePlayers 2021-11-23 12:49:03 +11:00
md_5
d181e1edd9
Fix serializing unhandled NBT + add unit test with unhandled NBT 2021-11-23 12:35:42 +11:00
Noah van der Aa
aebb79e327
#954: Add "Allow Server Listings" API 2021-11-23 08:56:35 +11:00
BlackHole
7c4707e46b
#955: Add test for BlockData class of Material 2021-11-23 08:07:10 +11:00
md_5
ecfd37b3d8
Remove Player#sendChunkChange
Method is specified according to an obsolete internal format and has not been implemented for nearly 10 years.
2021-11-22 15:08:57 +11:00
Parker Hawke
03b50154ef
#953: Add Player#sendEquipmentChange 2021-11-22 15:07:40 +11:00
md_5
bafc27ec51
Correct displayed Java version in warning 2021-11-22 11:47:01 +11:00
md_5
a7b8b0270a
Update to Minecraft 1.18-pre5 2021-11-22 09:00:00 +11:00
md_5
0ebef35c72
Remove outdated build delay. 2021-11-22 09:00:00 +11:00
md_5
20716710f8
SPIGOT-6790: Mimic structure block behaviour and do not save STRUCTURE_VOID 2021-11-11 18:40:15 +11:00
Doc
b58f4299c6
SPIGOT-6436: Add Player#stopAllSounds 2021-11-05 21:02:22 +11:00
md_5
eb19161294
SPIGOT-6783: Items do not appear in custom anvil inventories 2021-11-04 18:17:58 +11:00
Doc
376edf4fe5
SPIGOT-6779: Fix LivingEntity#attack for Player entities 2021-11-02 18:33:35 +11:00
DerFrZocker
747a73ec92
SPIGOT-6772: Use entity mailbox and re-schedule entities if they get unloaded 2021-11-01 18:54:44 +11:00
Doc
cef1fda37b
#947: Add missing spawn eggs for SpawnEggMeta 2021-10-30 18:34:04 +11:00
md_5
fd50041d32
SPIGOT-6768: Remove upper bound on setFreezeTicks 2021-10-23 18:29:53 +11:00
md_5
b86793136b
SPIGOT-6760: Chest#getInventory only returns one half of a double chest when one or both halves are blocked 2021-10-16 18:49:04 +11:00
blablubbabc
fee3152be1
SPIGOT-6759: Chest#getInventory() no longer returns double chest inventories 2021-10-16 18:49:04 +11:00
blablubbabc
11c9299fbb
#940: Fixed a NPE during CraftBlockEntityState#update.
When the BlockState's block type was changed, #update may have removed
the TileEntity, causing #isApplicable to fail with a NPE.
2021-10-15 18:03:01 +11:00
blablubbabc
960f31098d
#937: Fixes related to unplaced BlockStates and the recent world generation changes.
* CraftBlockState#getWorldHandle() would previously run into a NPE when being invoked for a non-placed BlockState. It now returns null in this case.
* CraftChest#getInventory() would previously encounter this NPE when being called for a non-placed BlockState. It will now automatically forward the call to #getBlockInventory() when it is being called for either a non-placed BlockState, or during world generation.
* CraftStructureBlock#applyTo was able to run into a NPE when being called for non-placed BlockStates (this is for example called by #getSnapshotNBT()).
* Replaced all no-world-generation preconditions with a general 'ensureNoWorldGeneration' method.
* Removed a few superfluous #isPlaced() calls. If getWorldHandle() reutrns a World, this already implies that the BlockState is placed.
2021-10-10 07:55:53 +11:00
blablubbabc
4faf479e6c
SPIGOT-6754: We ignore any still present TileEntity now when we create a BlockState for a block of type AIR.
During block destruction, the type of the block may already have been set to AIR while the TileEntity has not yet been removed.
Also, TileEntity#getOwner() skips the whole BlockState construction now if the block is of type AIR.

This removes the previous workaround again of returning a dummy CraftBlockEntityState in this case.
2021-10-10 07:55:53 +11:00
md_5
a72d54044a
SPIGOT-6754: Temporarily restore previous behaviour for tile entities with removed blocks 2021-10-09 16:29:58 +11:00
Sander Knauff
1df303e707
SPIGOT-2903: Add Structure API 2021-10-05 12:24:21 +11:00
Doc
346ebb7a7a
#934: Support for configuring Water Underground Creatures spawn settings 2021-10-05 11:39:21 +11:00
blablubbabc
dc764e7a2f
#877: Improve and simplify CraftBlockState 2021-09-29 18:56:16 +10:00
DerFrZocker
2d933bae44
SPIGOT-6741: shouldGenerateStructures isn't implemented 2021-09-28 17:52:29 +02: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
Brokkonaut
757d42aef6
SPIGOT-6729: Add Chunk.isEntitiesLoaded() 2021-09-06 18:51:39 +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
DerFrZocker
09b99daf30
SPIGOT-6722: Close entity manager when unloading world 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
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
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