SPIGOT-7593: Fix sapling growth physics / client-side updates

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-03-11 15:03:33 +11:00
parent db29270cd0
commit 4624f313ca

View file

@ -135,7 +135,7 @@
} }
@Override @Override
@@ -207,6 +304,17 @@ @@ -207,6 +304,18 @@
@Override @Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@ -147,13 +147,14 @@
+ this.capturedBlockStates.put(blockposition.immutable(), blockstate); + this.capturedBlockStates.put(blockposition.immutable(), blockstate);
+ } + }
+ blockstate.setData(iblockdata); + blockstate.setData(iblockdata);
+ blockstate.setFlag(i);
+ return true; + return true;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
if (this.isOutsideBuildHeight(blockposition)) { if (this.isOutsideBuildHeight(blockposition)) {
return false; return false;
} else if (!this.isClientSide && this.isDebug()) { } else if (!this.isClientSide && this.isDebug()) {
@@ -214,13 +322,29 @@ @@ -214,13 +323,29 @@
} else { } else {
Chunk chunk = this.getChunkAt(blockposition); Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@ -184,7 +185,7 @@
if (iblockdata2 == iblockdata) { if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) { if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2); this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -247,12 +371,69 @@ @@ -247,12 +372,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2); this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
} }
@ -254,7 +255,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override @Override
@@ -338,6 +519,14 @@ @@ -338,6 +520,14 @@
@Override @Override
public IBlockData getBlockState(BlockPosition blockposition) { public IBlockData getBlockState(BlockPosition blockposition) {
@ -269,7 +270,7 @@
if (this.isOutsideBuildHeight(blockposition)) { if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState(); return Blocks.VOID_AIR.defaultBlockState();
} else { } else {
@@ -543,6 +732,16 @@ @@ -543,6 +733,16 @@
@Nullable @Nullable
@Override @Override
public TileEntity getBlockEntity(BlockPosition blockposition) { public TileEntity getBlockEntity(BlockPosition blockposition) {
@ -286,7 +287,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE)); return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
} }
@@ -550,6 +749,12 @@ @@ -550,6 +750,12 @@
BlockPosition blockposition = tileentity.getBlockPos(); BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) { if (!this.isOutsideBuildHeight(blockposition)) {
@ -299,7 +300,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity); this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
} }
} }
@@ -680,7 +885,7 @@ @@ -680,7 +886,7 @@
for (int k = 0; k < j; ++k) { for (int k = 0; k < j; ++k) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[k]; EntityComplexPart entitycomplexpart = aentitycomplexpart[k];