Skip to content
Success

Changes

Summary

  1. SPIGOT-6754: We ignore any still present TileEntity now when we create a (details)
  2. #937: Fixes related to unplaced BlockStates and the recent world (details)
Commit 4faf479e6c485fa0fb247f040a8096d6cccf0e36 by md_5
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.
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
The file was modified nms-patches/net/minecraft/world/level/block/entity/TileEntity.patch
Commit 960f31098d3dce07482c771a938ac111abfbeed3 by md_5
#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.
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftLectern.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
The file was modified src/main/java/org/bukkit/craftbukkit/block/CraftChest.java