338 Commits

Author SHA1 Message Date
Doc
f92a41c396
#1181: Consolidate Location conversion code 2023-04-19 19:59:19 +10:00
Parker Hawke
187bdd463f
#1160: Add more bell API 2023-04-02 14:35:13 +10:00
Jishuna
722ddff6da
#1162: Add BlockData#rotate and BlockData#mirror 2023-04-02 13:32:01 +10:00
Parker Hawke
eff1743b9c
SPIGOT-7313: More accurately edit data on Jukeboxes 2023-03-29 19:23:41 +11:00
Parker Hawke
93813509b6
SPIGOT-7309: Add API for jukebox inventories
Also fixes a crash when inserting music discs into jukeboxes with a Dropper
2023-03-23 20:55:14 +11:00
Jishuna
e5a7921f05
#1149: Add BlockData#getPlacementMaterial 2023-03-20 10:05:43 +11:00
md_5
bcedf28a1b
Update to Minecraft 1.19.4 2023-03-15 03:30:00 +11:00
Parker Hawke
6aeb5e4c35
SPIGOT-4569: Implement more BlockData API 2023-02-11 18:59:34 +11:00
mfnalex
7dbf862c26
#1131: Added methods to get translation keys for materials, itemstacks and more 2023-02-10 20:50:24 +11:00
Doc
ae8f5fc025
#1125: Add support for NoteBlock sounds in Skulls 2022-12-23 12:26:06 +11:00
md_5
645993470f
SPIGOT-7201: Spawner ItemMeta not working as expected 2022-12-11 08:40:57 +11:00
md_5
19e6be0209
Update to Minecraft 1.19.3 2022-12-08 03:00:00 +11:00
md_5
9a8e080108
SPIGOT-7069: Material.BARREL has Directional data class, should also be Openable 2022-07-10 15:10:07 +10:00
md_5
26bd88ccd7
SPIGOT-7070: Material.SCULK_VEIN has Waterlogged data class, should also be MultipleFacing 2022-07-10 15:04:44 +10:00
Parker Hawke
163e35c91b
#1079: Add support checking/survivability methods for BlockData 2022-07-09 20:09:34 +10:00
chickeneer
8f097b92fd
#1068: Add Hangable interface to MangrovePropagule 2022-06-12 18:19:01 +10:00
md_5
732c50cab7
SPIGOT-7043: EnderChest does not implement Lidded 2022-06-10 10:57:43 +10:00
md_5
c3f219edbe
Fix missing abstract in CraftLeaves 2022-06-08 17:37:43 +10:00
md_5
6c302a5e3e
Make Leaves Waterlogged 2022-06-08 17:31:13 +10:00
md_5
64c15270e7
Update to Minecraft 1.19 2022-06-08 02:00:00 +10:00
DerFrZocker
b02801aa21
#1055: Use correct tile entity for trapped chest in CraftBlockStates 2022-06-06 08:30:54 +10:00
DerFrZocker
fc4ad813aa
SPIGOT-6895: Trees grown with applyBoneMeal() don't fire the StructureGrowthEvent 2022-03-13 07:47:56 +11:00
md_5
05a38da190
Update to Minecraft 1.18.2 2022-03-01 02:00:00 +11:00
Doc
c0326c2840
#1009: Add Furnace#getRecipesUsed 2022-02-15 18:49:39 +11:00
blablubbabc
8f361ecec0
#1002: Add Player Profile API
Slight changes may occur as this API is stabilized.

This PR is based on work previously done by DerFrZocker in #938.
2022-02-03 09:25:39 +11:00
DerFrZocker
f49ffa7a50
SPIGOT-6778: Block#beakNaturally doesn't drop items in chests 2021-12-18 11:34:20 +11:00
md_5
27a27cdb84
Add Player#openSign API to edit a placed sign 2021-12-05 08:34:54 +11:00
md_5
9fb3aa4c7a
SPIGOT-6817: Revert back to old block state behaviour again 2021-11-29 11:03:16 +11:00
md_5
a11ec5d7f5
Remove unnecessary CraftBlock creation in CraftRegionAccessor#setBlock 2021-11-24 08:18:48 +11:00
coll1234567
1c82731ddb
SPIGOT-6781: Add Block#canPlace 2021-11-23 18:50:33 +11:00
md_5
a7b8b0270a
Update to Minecraft 1.18-pre5 2021-11-22 09:00:00 +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
blablubbabc
dc764e7a2f
#877: Improve and simplify CraftBlockState 2021-09-29 18:56:16 +10: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
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
aa69d1cfb9
Only remove tile entity if block type changes 2021-07-24 08:00:31 +10:00
DerFrZocker
8d244b0b7e
SPIGOT-3725, SPIGOT-6638, MC-136917: Properly clear tile entities before replacing 2021-07-19 18:53:40 +10:00
James Peters
aeb711dd3f
#889: Fix CraftChest close() sound being replaced with open sound. 2021-07-15 20:29:38 +10:00
md_5
fb556bfa14
Update to Minecraft 1.17.1 2021-07-07 00:00:00 +10:00
blablubbabc
295ab080d3
#872: SculkSensor accesses underlying TileEntity instead of snapshot for vibration frequency. 2021-06-23 09:02:10 +10:00
konsolas
ea1a84338c
#855: Add Block#getCollisionShape and associated API 2021-06-14 08:38:44 +10:00
konsolas
e7c6472526
#857: Add Block#getBreakSpeed(Player) 2021-06-14 08:30:56 +10:00
DerFrZocker
50530da9ec
SPIGOT-6514: Small Dripleaf block data is missing half property 2021-06-12 08:47:12 +10:00
md_5
e2f5ea34e9
Update to Minecraft 1.17 2021-06-11 15:00:00 +10:00
md_5
9c7acb6cbe
SPIGOT-6464: Fix ShulkerBox#getColor for undyed shulkers 2021-05-23 08:30:54 +10:00