Fix Breaking waterlogged blocks occasionally displays air for a frame Closes #7253 (#8128)

This commit is contained in:
ChampionAsh5357 authored and GitHub committed 2021-10-20 12:01:48 -07:00
1 parent 69ddf58600
commit 8bd517ca91
1 file changed
+1 -31
@@ -537,7 +537,7 @@ public class ForgeHooks
// Tell client the block is gone immediately then process events
if (world.getBlockEntity(pos) == null)
{
entityPlayer.connection.send(new ClientboundBlockUpdatePacket(DUMMY_WORLD, pos));
entityPlayer.connection.send(new ClientboundBlockUpdatePacket(pos, world.getFluidState(pos).createLegacyBlock()));
}
// Post the block break event
@@ -1062,36 +1062,6 @@ public class ForgeHooks
return false;
}
private static final DummyBlockReader DUMMY_WORLD = new DummyBlockReader();
private static class DummyBlockReader implements BlockGetter {
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
return null;
}
@Override
public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.defaultBlockState();
}
@Override
public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.defaultFluidState();
}
@Override
public int getHeight() {
return 0;
}
@Override
public int getMinBuildHeight() {
return 0;
}
}
public static int onNoteChange(Level world, BlockPos pos, BlockState state, int old, int _new) {
NoteBlockEvent.Change event = new NoteBlockEvent.Change(world, pos, state, old, _new);
if (MinecraftForge.EVENT_BUS.post(event))