153 Commits

Author SHA1 Message Date
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
blablubbabc
dc764e7a2f
#877: Improve and simplify CraftBlockState 2021-09-29 18:56:16 +10: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
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
md_5
e2f5ea34e9
Update to Minecraft 1.17 2021-06-11 15:00:00 +10:00
Flo0
9db9aeecee
#823: Add Block#isPreferredTool 2021-04-21 17:31:47 +10:00
Martoph
0e26ddb6a3
SPIGOT-5877: Add scaffolding for custom dimensions and biomes 2021-04-11 17:54:48 +10:00
md_5
90d6905b15
Repackage NMS 2021-03-16 09:00:00 +11:00
md_5
bf3d720714
Update to Minecraft 1.16.3 2020-09-11 07:00:00 +10:00
Parker Hawke
8c6115604b
#702: Add Block#applyBoneMeal() 2020-08-27 11:27:13 +10:00
md_5
2ee7318ae1
SPIGOT-6064: world.getBiome() null Error 2020-08-12 10:51:29 +10:00
md_5
9c9fb593f5
Update to Minecraft 1.16.2 2020-08-12 07:00:00 +10:00
md_5
983305bb4a
SPIGOT-5856: Soul Campfire BlockState cannot be cast to Campfire 2020-06-27 17:18:34 +10:00
md_5
3f0c333870
SPIGOT-5809: block.getState() wall signs too 2020-06-25 20:08:32 +10:00
md_5
b5db08bea5
SPIGOT-5809: block.getState() instanceof Sign for crimson_sign missed 2020-06-25 19:42:38 +10:00
md_5
9a3bd97f60
SPIGOT-5809: block.getState() instanceof Sign for warped_sign missed 2020-06-25 19:30:42 +10:00
md_5
ca19c2f48e
SPIGOT-5806: Block#getDrops(ItemStack tool) does not work as it should 2020-06-25 17:04:07 +10:00
md_5
7ea3c040bc
Update to Minecraft 1.16.1 2020-06-25 10:00:00 +10:00
Lars Dormans
8637ec008d SPIGOT-5751: Made breakNaturally and getDrops returns the correct item if no argument is given 2020-06-03 19:28:13 +10:00
md_5
46a1386066 SPIGOT-5718: Block.BreakBlockNaturally does not reflect tool used 2020-05-09 16:05:17 +10:00
md_5
ce66f6937b Misc checkstyle fixes 2020-04-14 12:34:43 +10:00
md_5
f325b9beac SPIGOT-5641: Add Block.getDrops(ItemStack, Entity) 2020-04-05 16:52:06 +10:00
ShaneBeee
b97d581af2 SPIGOT-5443: BEE_NEST BlockState
- Add missing BEE_NEST block state
- Add a missing break in CraftMetaBlockState
2019-12-13 09:12:38 +11:00
md_5
db0dafb17c SPIGOT-5422: Add support for 3-dimensional biomes 2019-12-11 15:28:37 +11:00
md_5
de42aa13f3 Update to Minecraft 1.15 2019-12-11 09:00:00 +11:00
md_5
eeae942e44 SPIGOT-5416: Block.getDrops gives drops even when tool should not give drops 2019-12-08 10:39:57 +11:00
blablubbabc
13caf84858 SPIGOT-5370: Fix Block#rayTrace considering other blocks. 2019-10-18 20:28:06 +02:00
md_5
401432b995 SPIGOT-4962: Bubble column blocks not classified as liquid 2019-05-20 19:27:02 +10:00
md_5
a584320126 SPIGOT-4836: Breaking barrier block causes error 2019-05-02 09:23:16 +10:00
md_5
e3df3d5cda Add Override annotations where appropriate 2019-04-28 11:38:01 +10:00
md_5
5fea790398 Apply import ordering rules to CraftBukkit classes 2019-04-23 14:56:58 +10:00
md_5
a2d787f6eb Update to Minecraft 1.14-pre5 2019-04-23 12:00:00 +10:00
md_5
6430d9c0ba SPIGOT-4632: BlockState location is not fixed 2019-02-21 20:32:44 +11:00
md_5
9dc56581e6 SPIGOT-4570: Add FluidLevelChangeEvent 2019-01-08 21:23:11 +11:00
md_5
d05c8b1481 Mappings Update 2018-12-26 08:00:00 +11:00
md_5
1b982fd67e Tweak Block.getTemperature to return actual block temperature 2018-12-19 10:53:08 +11:00
Evoluseis
f55c819185 SPIGOT-2151: Add support for getting simple bounding box of a block 2018-12-19 10:34:47 +11:00
md_5
aa36c8417b Mappings Update 2018-12-06 10:00:00 +11:00
blablubbabc
4a47be6164 Add ray tracing and bounding box API 2018-10-26 20:00:00 +11:00
md_5
b4230a9a7e Update to Minecraft 1.13.2 2018-10-23 06:00:00 +11:00
blablubbabc
e3d7b2fd96 Add Block#isPassable 2018-10-13 09:49:25 +11:00
md_5
e7ced970d2 Catch plugins setting null Material or BlockData to blocks 2018-10-13 09:43:05 +11:00
md_5
c2cbdc5ab4 SPIGOT-4316: Do even less processing when block placement without physics requested 2018-08-27 18:29:28 +10:00
md_5
ce1af0c348 Update to Minecraft 1.13.1 2018-08-26 12:00:00 +10:00
md_5
5e3082c7d8 SPIGOT-4230: Improve legacy block types 2018-08-05 10:04:19 +10:00
md_5
69970127c1 SPIGOT-4221: Update surrounding blocks for cancelled break/place 2018-08-03 11:34:26 +10:00